Perangkat Lunak yang digunakan

Perangkat lunak yang digunakan di tutorial ini adalah:


  1. OS: Ubuntu 18.04

  2. Web server: Apache 2.4

  3. PHP Engine: PHP v7.4

  4. Database: MariaDB 10.1

  5. Moodle: Moodle v3.8

  6. Subomain: moodle.defnex.com

  7. SSL: Let’s Encrypt


Install Apache

Update Ubuntu terlebih dahulu

apt update

apt upgrade -y


Install Apache web server

apt install apache2 -y

systemctl status apache2   


Install PHP

apt install php7.4 php7.4-common php7.4-pspell php7.4-curl php7.4-gd php7.4-intl php7.4-mysql php7.4-xml php7.4-xmlrpc php7.4-ldap php7.4-zip php7.4-soap php7.4-mbstring libapache2-mod-php -y


Install MariaDB database

apt install mariadb-server -y

systemctl status mariadb

mysql_secure_installation


Jawab pertanyaannya

Set root password? [Y/n] y

Remove anonymous users? [Y/n] y

Disallow root login remotely? [Y/n] y

Remove test database and access to it? [Y/n] y

Reload privilege tables now? [Y/n] y   


Konfigurasi MariaDB

vim /etc/mysql/mariadb.conf.d/50-server.cnf


Tambahkan konfigurasinya di bawah [mysqld]

default_storage_engine = innodb

innodb_file_per_table = 1

innodb_file_format = Barracuda

innodb_large_prefix = 1



Restart MariaDB

systemctl restart mariadb

systemctl status mariadb   


Membuat database untuk Moodle

mysql -u root -p


CREATE DATABASE moodle DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;    

CREATE USER 'usrmoodle'@'localhost' IDENTIFIED BY 'secret';

GRANT ALL PRIVILEGES ON moodle.* TO 'usrmoodle'@'localhost';

w

exit




Download Moodle v3.8

wget https://download.moodle.org/download.php/direct/stable38/moodle-latest-38.tgz

tar xzvf moodle-latest-38.tgz


Membuat folder untuk Moodle

mkdir -p /var/www/moodle/data

mv moodle /var/www/moodle/web

chown -R www-data:www-data /var/www/moodle

chmod -R 755 /var/www/moodle   


Konfigurasi virtual host untuk moodle.defnex.com

cd /etc/apache2/sites-available/

vim moodle.defnex.com.conf


Masukkan konfigurasi virtual host



Aktifkan virtual host dan restart Apache

a2ensite moodle.defnex.com.conf

systemctl restart apache2   

systemctl status apache2   


Install SSL Let’s Encrypt

cd

curl -O https://dl.eff.org/certbot-auto

mv certbot-auto /usr/local/bin/certbot-auto

chmod 0755 /usr/local/bin/certbot-auto


Request SSL untuk subdomain moodle.defnex.com

certbot-auto --apache -d moodle.defnex.com


Install packages, Do you want to continue? [Y/n], jawab y

Need to get 66.4 MB of archives.

After this operation, 194 MB of additional disk space will be used.

Do you want to continue? [Y/n] y   


Masukkan alamat email

Enter email address (used for urgent renewal and security notices) (Enter 'c' to cancel): hai@musaamin.web.id


Setujui ToS

Please read the Terms of Service at https://letsencrypt.org/documents/ LE-SA-v1.2-November-15-2017.pdf. You must agree in order to register with the ACME server at https://acme-v02.api.letsencrypt.org/directory

- - - - - - - - - - - - - - - - - - - - - - - - - - - 

(A)gree/(C)ancel: A


Persetujuan untuk dikirimi informasi mengenai Let’s Encrypt, bisa jawab Y atau N.

Would you be willing to share your email address with the Electronic Frontier Foundation, a founding partner of the Let's Encrypt project and the non-profit organization that develops Certbot? We'd like to send you email about our work encrypting the web, EFF news, campaigns, and ways to support digital freedom.

- - - - - - - - - - - - - - - - - - - - - - - - - - - 

(Y)es/(N)o: N


Sertifikat SSL dibuat, mengubah dan menambahkan konfigurasi virtual host untuk SSL.

Obtaining a new certificate

Performing the following challenges:

http-01 challenge for moodle.defnex.com


Kemudian pilih 2 untuk redirect HTTP ke HTTPS.

Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

1: No redirect - Make no further changes to the webserver configuration.

2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for new sites, or if you're confident your site works on HTTPS. You can undo this change by editing your web server's configuration.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2  


Install SSL untuk moodle.defnex.com selesai

Congratulations! You have successfully enabled https://moodle.defnex.com   


Sertifikat SSL hanya berlaku selama 90 hari, renew untuk memperbarui sertifikat SSL

cerbot-auto renew