Cara Install Moodle dengan Apache di Ubuntu Server 20.04

Cara Install Moodle dengan Apache di Ubuntu Server 20.04
Add Comments
Rabu, 09 Februari 2022


Perangkat Lunak yang digunakan :

  • OS : Ubuntu Server 20.04
  • Web Server : Apache
  • PHP Engine : PHP v7.4
  • Database : MariaDB
  • Moodle : Moodle v.3.11

Update Repo

sudo apt update

Install Apache 

apt -y install apache2
sudo  ufw allow 'Apache'

Install PHP 7.4

sudo apt -y install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt -y install php7.4

Install Extension PHP

sudo apt -y install php7.4-common php7.4-mysql php7.4-xml php7.4-xmlrpc \
php7.4-curl php7.4-gd php7.4-imagick php7.4-cli php7.4-dev \
php7.4-imap php7.4-mbstring php7.4-opcache php7.4-soap \
php7.4-zip php7.4-cli php7.4-intl \
imagemagick git zip libgd-dev libapache2-mod-php 


sudo nano /etc/php/7.4/apache2/php.ini
upload_max_filesize = 100M
post_max_size = 48M
memory_limit = 512M
max_execution_time = 600
max_input_vars = 3000
max_input_time = 1000

Restart Apache2

sudo systemctl restart apache2.service

Test file .php

sudo nano /var/www/html/phpinfo.php
<?php phpinfo( ); ?>

Kemudian akses ip_server/phpinfo.php

Install MariaDB

Install MariaDB database

apt install mariadb-server -y

Mengamankan instalasi MariaDB


Jawab Pertanyaannya

Enter current password for root (enter for none): ENTER
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

Login ke MariaDB

mysql -u root -p

Membuat database untuk Moodle

CREATE DATABASE moodle DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;    
CREATE USER 'moodle'@'localhost' IDENTIFIED BY 'moodle';
GRANT ALL PRIVILEGES ON moodle.* TO 'moodle'@'localhost';

Install Moodle

Persiapkan dulu folder untuk moodle

mkdir -p /var/www/moodledata
chmod -Rf 777 /var/www/moodledata/
chown -Rf www-data: /var/www/moodledata/

Download Moodle 3.11

cd /var/www/html
chown -Rf www-data: /var/www/moodledata/
chmod -Rf 777 /var/www/html/moodle
chown -Rf www-data: /var/www/html/moodle

Kemudian lanjutkan install moodle via browser http://ip-address/moodle