Install Moodle on VPS Almalinux

Setelah webserver telah siap, langkah selanjutnya untuk menginstall LMS Moodle pada sebuah domain/subdomain yang dipointing ke IP VPS di bagi ke dalam sub tahapan berikut.

Pada studi kasus ini moodle di install pada domain dan IP Public VPS berikut

Domain e-learning.firman.kelompoksaya.my.id
IP Public VPS 103.176.79.213

Create Domain / SubDomain & Pointing to IP VPS

e-learning.firman.kelompoksaya.my.id    >   103.176.79.213

Check Propagansi Domain

Check propagansi domain dengan A record pada situs

https://dnschecker.org/

Create Database, username & password Moodle

Silahkan buat database, user dan password pada phpmyadmin

(utfmb4_unicode_ci)
DBNAME 
DBUSER
DBPASS
DBHOST 
contoh
DBNAME : moodle
DBUSER : moodle
DBPASS : moodle2022**
DBHOST : 127.0.0.1

Create Folder Moodle at /var/www/html/

[root@Almalinux-FirmanPratama ~]#	mkdir /var/www/html/moodle/

Create Folder moodledata at /var/www/html/moodle/

[root@Almalinux-FirmanPratama ~]#	mkdir /var/www/html/moodle/moodledata

Download Installer Moodle

Masuk ke folder /var/www/html/moodle/

[root@Almalinux-FirmanPratama ~]#	cd /var/www/html/moodle/

Silahkan download file installer moodle pada link berikut menggunakan wget

[root@Almalinux-FirmanPratama moodle]# wget https://repo.firmanpratama.id/moodle/moodle-latest-400.zip
Note:
Official site Moodle Download
https://download.moodle.org/releases/latest/

Extract/Unzip Installer Moodle

Check isi folder /var/www/html/moodle/

[root@Almalinux-FirmanPratama moodle]# ls -la

Jika file installer moodle ada, silahkan Extract/Unzip Installer Moodle di dalam folder /var/www/html/moodle/

[root@Almalinux-FirmanPratama moodle]# unzip moodle-latest-400.zip

Change ownership folder moodle & moodledata

Check isi, ownership serta permission file-folder di dalam folder “/var/www/html/moodle” menggunakan perintah berikut

[root@Almalinux-FirmanPratama moodle]# ls -la

Ubah Ownership untuk folder “moodle” dan “moodledata” dari “root” ke “apache” di dalam /var/www/html/moodle/

[root@Almalinux-FirmanPratama moodle]# chown -R apache:apache /var/www/html/moodle/moodle
[root@Almalinux-FirmanPratama moodle]# chown -R apache:apache /var/www/html/moodle/moodledata

Ubah Permission untuk folder “moodle” dan “moodledata” ke 755 di dalam /var/www/html/moodle/

[root@Almalinux-FirmanPratama moodle]# chmod -R 755 /var/www/html/moodle/moodle
[root@Almalinux-FirmanPratama moodle]# chmod -R 755 /var/www/html/moodle/moodledata

Check kembali isi, ownership serta permission file-folder di dalam folder “/var/www/html/moodle” menggunakan perintah berikut

[root@Almalinux-FirmanPratama moodle]# ls -la

Create Virtual Host Domain LMS moodle

Create virtual host port 80 dan 443
http://e-learning.firman.kelompoksaya.my.id
https://e-learning.firman.kelompoksaya.my.id

ke dalam folder
/var/www/html/moodle/moodle

Restart Service Apache & PHP-FPM

[root@Almalinux-FirmanPratama moodle]# systemctl restart httpd
[root@Almalinux-FirmanPratama moodle]# systemctl restart php-fpm

Install Let’s Encrypt SSL certificate. (https)

Install Let’s Encrypt SSL certificate sesuai dengan masing-masing domain/subdomain

[root@Almalinux-FirmanPratama html]# certbot --apache -d NamaDomain
Contoh
[root@Almalinux-FirmanPratama html]# certbot --apache -d e-learning.firman.kelompoksaya.my.id
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Enter email address (used for urgent renewal and security notices)
 (Enter 'c' to cancel): [email protected]

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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. Do you agree?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: y

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Would you be willing, once your first certificate is successfully issued, 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: y
Account registered.
Requesting a certificate for e-learning.firman.kelompoksaya.my.id

Successfully received certificate.
Certificate is saved at: /etc/letsencrypt/live/e-learning.firman.kelompoksaya.my.id/fullchain.pem
Key is saved at:         /etc/letsencrypt/live/e-learning.firman.kelompoksaya.my.id/privkey.pem
This certificate expires on 2022-09-14.
These files will be updated when the certificate renews.
Certbot has set up a scheduled task to automatically renew this certificate in the background.

Deploying certificate
Successfully deployed certificate for e-learning.firman.kelompoksaya.my.id to /etc/httpd/conf/httpd.conf
Congratulations! You have successfully enabled HTTPS on https://e-learning.firman.kelompoksaya.my.id

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
If you like Certbot, please consider supporting our work by:
 * Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
 * Donating to EFF:                    https://eff.org/donate-le

Web Install

Silahkan menuju browser dan akses Domain/Subdomain yang telah dibuat untuk melanjutkan instalasi moodle

Contoh
https://e-learning.firman.kelompoksaya.my.id

Jika tahapan web Intall mengalami kendala silahkan masuk ke dalam folder moodle

[root@Almalinux-FirmanPratama html]# cd /var/www/html/moodle/moodle

Check kembali isi, file-folder di dalam folder “/var/www/html/moodle/moodle” menggunakan perintah berikut, pastikan di dalam folder “/var/www/html/moodle/moodle” terdapat file wp-config.php

[root@Almalinux-FirmanPratama moodle]# cd /var/www/html/moodle/moodle
[root@Almalinux-FirmanPratama moodle]# ls

Jika file config.php tidak tergenerate silahkan buat wp-config.php secara manual seperti di bawah ini

[root@Almalinux-FirmanPratama moodle]# nano /var/www/html/moodle/moodle/config.php
Konfigurasi File config.php Moodle
Silahkan sesuaikan dbtype, dbhost, dbname, dbuser, dbpass pada database anda.

======================================================== 
//Start Copy
<?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    = 'moodle2022**';
$CFG->prefix    = 'mdl_';
$CFG->dboptions = array (
  'dbpersist' => 0,
  'dbport' => 3306,
  'dbsocket' => '',
  'dbcollation' => 'utf8mb4_unicode_ci',
);

$CFG->wwwroot   = 'https://e-learning.firman.kelompoksaya.my.id';
$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!
// End Copy

Leave a Reply

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