Install Moodle di Centos8-Nginx-PHP7.4-Mariadb
Referensi : https://www.tecmint.com/install-moodle-with-nginx-in-centos-8/, https://blog.emka.web.id/2021/02/cara-install-moodle-di-centos-8-dengan.html
Update Centos 8
yum update -y
sed -i -e "s|mirrorlist=|#mirrorlist=|g" /etc/yum.repos.d/CentOS-*
sed -i -e "s|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g" /etc/yum.repos.d/CentOS-*
Install software pendukung
dnf install nano
dnf install unzip
dnf install openssh-server
systemctl start sshd
systemctl enable sshd
Install nginx
dnf install nginx -y
systemctl start nginx
systemctl status nginx
Install PHP 7.4
Update Repiository
dnf install dnf-utils http://rpms.remirepo.net/enterprise/remi-release-8.rpm
jika ada masalah
dnf install dnf-utils http://rpms.remirepo.net/enterprise/remi-release-8.rpm --skip-broken
lihat yang terinstal
dnf module list php
aktifkan PHP7.4
dnf module reset php
dnf module enable php:7.4
untuk pastikan cek lagi dengan
dnf module list php
Install extension php 7.4
dnf install php php-ldap php-xml php-soap php-xmlrpc php-mbstring php-json php-gd php-curl php-zip php-common php-fpm php php-opcache php-curl php-mysqlnd php-intl
systemctl enable --now php-fpm
dnf install epel-release
Install maria DB
Secara default repository mariadb yang terinstal di centos8adalah mariadb 10.3, untuk moodle dibutuhkan minimal mariadb 10.4
Maka kita update repositorynya dengan cara
nano /etc/yum.repos.d/MariaDB.repo
copy script di bawah ini, dan masukkan di MariaDB.repo
# MariaDB 10.5 CentOS repository list - created 2020-08-21 23:57 UTC
# http://downloads.mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.5/centos8-amd64
module_hotfixes=1
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
kemudian keluar dari nano dan mulai install mariadb
dnf install MariaDB-server -y
systemctl start mariadb
systemctl status mariadb |grep Active
Secure instalation maridb
mysql_secure_installation
Pilih no jika minta rubah socket
Sisanya pilih yes
Buat database Moodle
mysql -u root -p
CREATE DATABASE moodle;
CREATE USER 'moodle'@'localhost' IDENTIFIED BY 'moodle';
GRANT ALL ON moodle.* TO 'moodle'@'localhost' IDENTIFIED BY 'moodle' WITH GRANT OPTION;
FLUSH PRIVILEGES;
EXIT;
Install Moodle
Download moodle sebagai manusia dan copy kan ke /usr/share/nginx/html
scp moodle-latest-401.zip [email protected]: /usr/share/nginx/html
cd /usr/share/nginx/html
unzip moodle-latest-401.zip
chown -R nginx:nginx moodle
chmod -R 777 moodle
Siapkan folder moodledata
cd /usr/share/nginx/
mkdir moodledata
chmod 777 moodledata/
chown -R nginx:nginx moodledata/
Setting PHP.ini untuk mengatur maxtime,max upload dll
cd /etc
nano php.ini
Edit :
upload_max_filesize = 100M
post_max_size = 48M
memory_limit = 512M
max_execution_time = 600
max_input_vars = 5000
max_input_time = 1000
Buat vhost NGINX untuk moodle, misal di file:
nano /etc/nginx/conf.d/moodle.conf
isi dengan :
server{
listen 80;
server_name ip server/domain;
root /usr/share/nginx/html/moodle;
index index.php;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ ^(.+\.php)(.*)$ {
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_index index.php;
fastcgi_pass php-fpm;
include /etc/nginx/mime.types;
include fastcgi_params;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
Lanjutkan dengan konfigurasi via web
http://localhost/moodle http://ip-address/moodle