Install Moodle di Centos8-Nginx-PHP7.4-Mariadb: Difference between revisions

From Dboswiki
Jump to navigation Jump to search
Created page with "Catatan yang belum diatur Install nginx dnf install nginx -y jika tidak jalan, perlu upgrade centos dengan scrip di bawah ini, kemudian install nginx lagi sed -i -e "s|mir..."
 
No edit summary
 
(10 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Catatan yang belum diatur
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


Install nginx
=== Update Centos 8 ===
yum update -y


dnf install nginx -y
sed -i -e "s|mirrorlist=|#mirrorlist=|g" /etc/yum.repos.d/CentOS-*
 
sed -i -e "s|#baseurl=<nowiki>http://mirror.centos.org|baseurl=http://vault.centos.org|g</nowiki>" /etc/yum.repos.d/CentOS-*
 
=== Install software pendukung ===
dnf install nano
 
dnf install unzip


jika tidak jalan, perlu upgrade centos dengan scrip di bawah ini, kemudian install nginx lagi
dnf install openssh-server


sed -i -e "s|mirrorlist=|#mirrorlist=|g" /etc/yum.repos.d/CentOS-*
systemctl start sshd


sed -i -e "s|#baseurl=<nowiki>http://mirror.centos.org|baseurl=http://vault.centos.org|g</nowiki>" /etc/yum.repos.d/CentOS-*
systemctl enable sshd


sed -i -e "s|#baseurl=<nowiki>http://mirror.centos.org|baseurl=http://vault.centos.org|g</nowiki>" /etc/yum.repos.d/CentOS-*
=== '''Install nginx''' ===
dnf install nginx -y


systemctl start nginx
systemctl start nginx
Line 17: Line 26:
systemctl status nginx
systemctl status nginx


Install PHP 7.4
=== '''Install PHP 7.4''' ===
 
Update Repiository


===== Update Repiository =====
dnf install dnf-utils <nowiki>http://rpms.remirepo.net/enterprise/remi-release-8.rpm</nowiki>
dnf install dnf-utils <nowiki>http://rpms.remirepo.net/enterprise/remi-release-8.rpm</nowiki>


jika ada masalah
'''''jika ada masalah'''''


dnf install dnf-utils <nowiki>http://rpms.remirepo.net/enterprise/remi-release-8.rpm</nowiki> --skip-broken
dnf install dnf-utils <nowiki>http://rpms.remirepo.net/enterprise/remi-release-8.rpm</nowiki> --skip-broken


lihat yang terinstal
'''''lihat yang terinstal'''''


dnf module list php
dnf module list php
'''''aktifkan PHP7.4'''''


dnf module reset php
dnf module reset php
Line 35: Line 45:
dnf module enable php:7.4
dnf module enable php:7.4


untuk pastikan cek lagi dengan
'''''untuk pastikan cek lagi denga'''''n


dnf module list php
dnf module list php


Install extensin 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


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 -y
=== Install maria DB ===
Secara default repository mariadb yang terinstal di centos8adalah mariadb 10.3, untuk moodle dibutuhkan minimal mariadb 10.4


Install maria DB
Maka kita update repositorynya dengan cara


Upgrade ke maria DB yang baru
'''nano /etc/yum.repos.d/MariaDB.repo'''


vim /etc/yum.repos.d/MariaDB.repo
copy script di bawah ini, dan masukkan di MariaDB.repo


<nowiki>#</nowiki> MariaDB 10.5 CentOS repository list - created 2020-08-21 23:57 UTC
''<nowiki>#</nowiki> MariaDB 10.5 CentOS repository list - created 2020-08-21 23:57 UTC''


<nowiki>#</nowiki> <nowiki>http://downloads.mariadb.org/mariadb/repositories/</nowiki>
''<nowiki>#</nowiki> <nowiki>http://downloads.mariadb.org/mariadb/repositories/</nowiki>''


[mariadb]
''[mariadb]''


name = MariaDB
''name = MariaDB''


baseurl = <nowiki>http://yum.mariadb.org/10.5/centos8-amd64</nowiki>
''baseurl = <nowiki>http://yum.mariadb.org/10.5/centos8-amd64</nowiki>''


module_hotfixes=1
''module_hotfixes=1''


gpgkey=<nowiki>https://yum.mariadb.org/RPM-GPG-KEY-MariaDB</nowiki>
''gpgkey=<nowiki>https://yum.mariadb.org/RPM-GPG-KEY-MariaDB</nowiki>''


gpgcheck=1
''gpgcheck=1''
 
 
kemudian keluar dari nano dan mulai install mariadb


dnf install MariaDB-server -y
dnf install MariaDB-server -y
Line 70: Line 89:


systemctl status mariadb |grep Active
systemctl status mariadb |grep Active
systemctl enable mariadb
'''Secure instalation maridb'''


mysql_secure_installation
mysql_secure_installation


buat database
Pilih no jika minta rubah socket
 
Sisanya pilih yes
 
 
'''Buat database Moodle'''


mysql -u root -p
mysql -u root -p
Line 79: Line 109:
CREATE DATABASE moodle;
CREATE DATABASE moodle;


CREATE USER 'moodle'@'localhost' IDENTIFIED BY 'Abcd1234';
CREATE USER 'moodle'@'localhost' IDENTIFIED BY 'moodle';


GRANT ALL ON moodle.* TO 'moodle'@'localhost' IDENTIFIED BY 'Abcd1234' WITH GRANT OPTION;
GRANT ALL ON moodle.* TO 'moodle'@'localhost' IDENTIFIED BY 'moodle' WITH GRANT OPTION;


FLUSH PRIVILEGES;
FLUSH PRIVILEGES;
Line 87: Line 117:
EXIT;
EXIT;


Install ssh server di centos
=== 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 :


dnf install openssh-server
upload_max_filesize = 100M
 
post_max_size = 48M
 
memory_limit = 512M
 
max_execution_time = 600
 
max_input_vars = 5000


systemctl start sshd
max_input_time = 1000


systemctl enable sshd


systemctl status sshd
'''Buat  vhost NGINX untuk moodle, misal di file:'''


Open the SSH port 22 to allow incoming traffic:
nano /etc/nginx/conf.d/moodle.conf


<nowiki>#</nowiki> firewall-cmd --zone=public --permanent --add-service=ssh
isi dengan :


<nowiki>#</nowiki> firewall-cmd --reload
server{


Download moodle sebagai manusia dan copy kan ke /usr/share/nginx/
   listen 80;


scp moodle-latest-401.zip [email protected]: /usr/share/nginx/
    server_name ''ip server/domain;''


cd /usr/share/nginx/
    root        /usr/share/nginx/html/moodle;


Install unzip
    index       index.php;


dnf install unzip
    location / {


unzip moodle-latest-401.zip
        try_files $uri $uri/ /index.php?$query_string;


chown -R nginx:nginx moodle
    }


chmod -R 755 moodle
    location ~ ^(.+\.php)(.*)$ {


mkdir moodledata
        fastcgi_split_path_info ^(.+\.php)(.*)$;


        fastcgi_index           index.php;


chmod 777 moodledata/
        fastcgi_pass            php-fpm;


        include                 /etc/nginx/mime.types;


chown -R nginx:nginx moodledata/
        include                 fastcgi_params;


        fastcgi_param           PATH_INFO       $fastcgi_path_info;


        fastcgi_param           SCRIPT_FILENAME $document_root$fastcgi_script_name;


}


jika apache
}




dnf install php php-opcache php-gd php-curl php-mysqlnd
'''Restart Nginx'''


nginx -t


systemctl restart nginx


Setting PHP.ini untuk mengatur maxtime,max upload dll
systemctl restart php-fpm


cd /etc
'''Lanjutkan dengan konfigurasi via web'''


nano php.ini
<nowiki>http://localhost/moodle</nowiki>
<nowiki>http://ip-address/moodle</nowiki>

Latest revision as of 12:51, 12 February 2023

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

systemctl enable mariadb


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;

}

}


Restart Nginx

nginx -t

systemctl restart nginx

systemctl restart php-fpm

Lanjutkan dengan konfigurasi via web

http://localhost/moodle
http://ip-address/moodle