Install Web Server Almalinux (Apache, MariaDB, PHP, phpMyAdmin, Webmin, WordPress, Moodle)

STEP 1 – Setting IP Address Static Almalinux

[root@localhost ~]#  nmcli
[root@localhost ~]#  dhclient
[root@localhost ~]#  nmtui

STEP 2 – Update & Install App Almalinux

[root@localhost ~]# dnf update -y
[root@localhost ~]# dnf install nano mc wget firewalld
[root@localhost ~]# reboot

STEP 3 – Disable Selinux

[root@localhost ~]#	nano /etc/selinux/config
SELINUX=disabled
[root@localhost ~]#	reboot
[root@localhost ~]#	sestatus


STEP 4 – Install Web Server Apache

[root@localhost ~]#	dnf install httpd httpd-tools
[root@localhost ~]#	systemctl status httpd
[root@localhost ~]#	systemctl start httpd
[root@localhost ~]#	systemctl status httpd
[root@localhost ~]#	systemctl enable httpd
[root@localhost ~]#	systemctl status firewalld
[root@localhost ~]#	firewall-cmd --permanent --zone=public --add-port=80/tcp
[root@localhost ~]#	firewall-cmd --permanent --zone=public --add-port=443/tcp
[root@localhost ~]#	firewall-cmd --reload
[root@localhost ~]#	firewall-cmd --list-all
[root@localhost ~]#	nano /var/www/html/test.html
<!DOCTYPE html>
<html>
<head>
<title>SERVER FIRMAN</title>
</head>
<body>
<h1></h1>
<p>WELCOME TO MY SERVER</p>
<br>
<br>
<h3>FIRMAN PRATAMA @ 2022</h3>
</body>
</html>


STEP 5 – Install DBMS MariaDB v10.6

[root@localhost ~]#	nano /etc/yum.repos.d/mariadb.repo
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.6/rhel8-amd64
module_hotfixes=1
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
[root@localhost ~]#	dnf update -y
[root@localhost ~]#	dnf install mariadb-server mariadb -y
[root@localhost ~]#	systemctl start mariadb
[root@localhost ~]#	systemctl enable mariadb
[root@localhost ~]#	systemctl status mariadb
[root@localhost ~]#	mariadb-secure-installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE!PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
haven't set the root password yet, you should just press enter here.

Enter current password for root (enter for none):[enter]
OK, successfully used password, moving on...

Setting the root password or using the unix_socket ensures that nobody
can log into the MariaDB root user without the proper authorisation.

You already have your root account protected, so you can safely answer 'n'.

Switch to unix_socket authentication [Y/n] y
Enabled successfully!
Reloading privilege tables..
 ... Success!


You already have your root account protected, so you can safely answer 'n'.

Change the root password? [Y/n] y
New password:[masukkan password root database Mariadb] [enter]
Re-enter new password: [masukkan password root database Mariadb] [enter]
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.This is intended only for testing, and to make the installation
go a bit smoother.You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y
 ... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access.This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
 ... Success!

Cleaning up...

All done!If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!
[root@localhost ~][root@localhost ~]#
[username@localhost ~]$	mysql -u root -p
MariaDB [(none)]> show databases;

STEP 6 – Install PHP v7.4

[root@localhost ~]#	dnf module list php
[root@localhost ~]#	dnf module reset php
[root@localhost ~]#	dnf module enable php:7.4
[root@localhost ~]#	dnf install php php-common php-opcache php-cli php-gd php-curl php-mysqlnd
[root@localhost ~]#	systemctl start php-fpm
[root@localhost ~]#	systemctl enable php-fpm
[root@localhost ~]#	systemctl restart httpd
[root@localhost ~]#	nano /var/www/html/info.php
<?php

// Show all information, defaults to INFO_ALL
phpinfo();

// Show just the module information.
// phpinfo(8) yields identical results.
phpinfo(INFO_MODULES);

?>
[root@localhost ~]#	php -v
PHP 7.4.19 (cli) (built: May4 2021 11:06:37) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.19, Copyright (c), by Zend Technologies


STEP 7 – Install PHPMyAdmin (v5.1.1)

[root@localhost ~]#	dnf install wget unzip
[root@localhost ~]#	cd /root
[root@localhost ~]#	wget https://repo.firmanpratama.id/phpmyadmin/phpMyAdmin-5.1.1-all-languages.zip
[root@localhost ~]#	unzip phpMyAdmin-5.1.1-all-languages.zip
[root@localhost ~]#	mv phpMyAdmin-5.1.1-all-languages /usr/share/phpmyadmin/
[root@localhost ~]#	cd /usr/share/phpmyadmin/
[root@localhost ~]#	ls
[root@localhost ~]#	mv config.sample.inc.php config.inc.php
[root@localhost ~]#	ls
[root@localhost ~]#	openssl rand -base64 32
Kode Hasil Generate Secret Code Copy Paste di bawah ini
[My Secret Code] = qoGomjLKgnfDXv/Wi+aq2QzXg/bbfgg5WCbp5VkzdqQ=
[root@localhost ~]#	nano config.inc.php
$cfg['blowfish_secret'] = '[My Secret Code]';
Contoh:
$cfg['blowfish_secret'] = '  ';
Tambahkan baris
$cfg['TempDir'] = '/tmp';

[root@localhost ~]#	mkdir /usr/share/phpmyadmin/tmp
[root@localhost ~]#	chown -R apache:apache /usr/share/phpmyadmin
[root@localhost ~]#	chmod 777 /usr/share/phpmyadmin/tmp
[root@localhost ~]#	nano /etc/httpd/conf.d/phpmyadmin.conf

# Config Standar
# Alias /phpmyadmin /usr/share/phpmyadmin
Alias /firmanprtama /usr/share/phpmyadmin

<Directory /usr/share/phpmyadmin/>
   AddDefaultCharset UTF-8
   <IfModule mod_authz_core.c>
     # Apache 2.4
     <RequireAny>
      Require all granted
     </RequireAny>
   </IfModule>
</Directory>

<Directory /usr/share/phpmyadmin/setup/>
   <IfModule mod_authz_core.c>
# Apache 2.4
     <RequireAny>
       Require all granted
     </RequireAny>
   </IfModule>
</Directory>
[root@localhost ~]#	systemctl restart httpd


STEP 8 – Install Webmin

[root@localhost ~]#	nano /etc/yum.repos.d/webmin.repo
[Webmin]
name=Webmin
mirrorlist=https://download.webmin.com/download/yum/mirrorlist
enabled=1
gpgkey=http://www.webmin.com/jcameron-key.asc
[root@localhost ~]#	dnf update
[root@localhost ~]#	dnf install webmin -y
[root@localhost ~]#	firewall-cmd --permanent --zone=public --add-port=10000/tcp
[root@localhost ~]#	firewall-cmd --reload
[root@localhost ~]#	firewall-cmd --list-all


STEP 9 – Instalasi WordPress

Create Database, username & password untuk wordpress
Buat local DNS pada file hosts

Windows
notepad C:\Windows\System32\drivers\etc\hosts

Mac & Linux
nano  /etc/hosts
[root@localhost ~]#	cd /root
[root@localhost ~]#	wget https://repo.firmanpratama.id/wordpress/wordpress-6.0.zip 
[root@localhost ~]#	unzip wordpress-6.0.zip 
[root@localhost ~]#	mv wordpress /var/www/html/
[root@localhost ~]#	cd /var/www/html/
Buat Konfigurasi Virtual Host
[root@localhost html]#	ls -la
[root@localhost html]#	chown -R apache:apache wordpress
[root@localhost html]#	chmod 755 -R wordpress
[root@localhost html]#	ls -la
[root@localhost wordpress]#	cd wordpress


Konfigurasi file wp-config.php
<?php
/**
 * The base configuration for WordPress
 *
 * The wp-config.php creation script uses this file during the installation.
 * You don't have to use the web site, you can copy this file to "wp-config.php"
 * and fill in the values.
 *
 * This file contains the following configurations:
 *
 * * Database settings
 * * Secret keys
 * * Database table prefix
 * * ABSPATH
 *
 * @link https://wordpress.org/support/article/editing-wp-config-php/
 *
 * @package WordPress
 */

// ** Database settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define( 'DB_NAME', 'database_name_here' );

/** Database username */
define( 'DB_USER', 'username_here' );

/** Database password */
define( 'DB_PASSWORD', 'password_here' );

/** Database hostname */
define( 'DB_HOST', '127.0.0.1' );

/** Database charset to use in creating database tables. */
define( 'DB_CHARSET', 'utf8' );

/** The database collate type. Don't change this if in doubt. */
define( 'DB_COLLATE', '' );

/**#@+
 * Authentication unique keys and salts.
 *
 * Change these to different unique phrases! You can generate these using
 * the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}.
 *
 * You can change these at any point in time to invalidate all existing cookies.
 * This will force all users to have to log in again.
 *
 * @since 2.6.0
 */
define( 'AUTH_KEY',         'put your unique phrase here' );
define( 'SECURE_AUTH_KEY',  'put your unique phrase here' );
define( 'LOGGED_IN_KEY',    'put your unique phrase here' );
define( 'NONCE_KEY',        'put your unique phrase here' );
define( 'AUTH_SALT',        'put your unique phrase here' );
define( 'SECURE_AUTH_SALT', 'put your unique phrase here' );
define( 'LOGGED_IN_SALT',   'put your unique phrase here' );
define( 'NONCE_SALT',       'put your unique phrase here' );

/**#@-*/

/**
 * WordPress database table prefix.
 *
 * You can have multiple installations in one database if you give each
 * a unique prefix. Only numbers, letters, and underscores please!
 */
$table_prefix = 'wp_';

/**
 * For developers: WordPress debugging mode.
 *
 * Change this to true to enable the display of notices during development.
 * It is strongly recommended that plugin and theme developers use WP_DEBUG
 * in their development environments.
 *
 * For information on other constants that can be used for debugging,
 * visit the documentation.
 *
 * @link https://wordpress.org/support/article/debugging-in-wordpress/
 */
define( 'WP_DEBUG', false );

/* Add any custom values between this line and the "stop editing" line. */



/* That's all, stop editing! Happy publishing. */

/** Absolute path to the WordPress directory. */
if ( ! defined( 'ABSPATH' ) ) {
	define( 'ABSPATH', __DIR__ . '/' );
}

/** Sets up WordPress vars and included files. */
require_once ABSPATH . 'wp-settings.php';

STEP 10 – Instalasi Moodle

[root@localhost ~]#	cd /root
[root@localhost ~]#	dnf install epel-release
[root@localhost ~]#	dnf install wget php-zip php-intl php-xmlrpc php-soap libsodium libsodium-devel
[root@localhost ~]#	nano /etc/php.ini
max_input_vars = 10000
[root@localhost ~]#	systemctl restart httpd
[root@localhost ~]#	systemctl restart php-fpm
[root@localhost ~]#	cd /var/www/html
[root@localhost ~]#	mkdir moodle
[root@localhost ~]#	cd moodle
[root@localhost moodle]#	mkdir moodledata
[root@localhost moodle]#	wget https://repo.firmanpratama.id/moodle/moodle-latest-400.zip
[root@localhost moodle]#	ls
[root@localhost moodle]#	unzip moodle-latest-400.zip
[root@localhost moodle]#	ls
[root@localhost moodle]#	chown -R apache:apache moodle moodledata
[root@localhost moodle]#	chmod -R 755 moodledata
Create Virtual Host	
Buat local DNS pada file hosts

Windows
notepad C:\Windows\System32\drivers\etc\hosts

Mac & Linux
nano  /etc/hosts
Create DB Moodle, Username & Pass	


Konfigurasi File config.php Moodle

<?php  // Moodle configuration file

unset($CFG);
global $CFG;
$CFG = new stdClass();

$CFG->dbtype    = 'mariadb';
$CFG->dblibrary = 'native';
$CFG->dbhost    = '127.0.0.1';
$CFG->dbname    = 'moodle';
$CFG->dbuser    = 'moodle';
$CFG->dbpass    = 'moodle';
$CFG->prefix    = 'mdl_';
$CFG->dboptions = array (
  'dbpersist' => 0,
  'dbport' => 3306,
  'dbsocket' => '',
  'dbcollation' => 'utf8mb4_unicode_ci',
);

$CFG->wwwroot   = 'http://e-learning.firmanpratama.site';
$CFG->dataroot  = '/var/www/html/moodle/moodledata';
$CFG->admin     = 'admin';

$CFG->directorypermissions = 0777;

require_once(__DIR__ . '/lib/setup.php');

// There is no php closing tag in this file,
// it is intentional because it prevents trailing whitespace problems!

Lembar Kerja Praktikum

Download

Leave a Reply

Your email address will not be published. Required fields are marked *