https://www.webhostingzone.org/blog/how-to-install-moodle-on-ubuntu-22-04
Update Repo
sudo apt update
sudo apt install software-properties-common ca-certificates lsb-release apt-transport-https
sudo add-apt-repository ppa:ondrej/php
Install Apache, PHP-8.1, MariaDB MySQL server
$ sudo apt install apache2 php8.1 mariadb-server postfix
$ sudo apt install php8.1-mysql php8.1-fpm php8.1-iconv php8.1-mbstring php8.1-curl php8.1-tokenizer php8.1-xmlrpc php8.1-soap php8.1-ctype php8.1-zip php8.1-gd php8.1-simplexml php8.1-xml php8.1-intl
When installation is completed start apache web server.
$ sudo systemctl start apache2
$ sudo systemctl enable apache2
Configure Apache VirtualHost and PHP-FPM
1. Start PHP-FPM service and enable it on boot.
$ sudo systemctl start php8.1-fpm
$ sudo systemctl enable php8.1-fpm
2. To use PHP-FPM with Apache we need to enable proxy_fcgi and proxy modules.
sudo a2enmod proxy_fcgi proxy
3. Create Apache configuration file for Moodle.
$ sudo nano /etc/apache2/sites-available/moodle.conf
Enter the following configuration into the moodle.conf. Replace ServerName, DocumentRoot, Directory with your values.
<VirtualHost *:80>
ServerName moodle.example.org
ServerAlias www.moodle.example.org
DocumentRoot /var/www/html/moodle
<Directory /var/www/html/moodle>
Options -Indexes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
<FilesMatch \.php$>
SetHandler "proxy:unix:/run/php/php8.1-fpm.sock|fcgi://localhost/"
</FilesMatch>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
4. Enable new virtual host and reload Apache web server.
$ a2ensite moodle
$ systemctl reload apache2
5. Also it’s nice to have a rewrite and SSL modules enabled
# a2enmod rewrite
# a2enmod ssl (jika ada sertifikat ssl)
# systemctl restart apache2
Create database and a database user
1. Start and enable MariaDB SQL server
root@moodle-lms-install:~# systemctl start mariadb
root@moodle-lms-install:~# systemctl enable mariadb
2. Create MySQL user and database
root@moodle-lms-install:~# mysql
MariaDB [(none)]> create database moodle_dev;
MariaDB [(none)]> grant all privileges on moodle_dev.* to moodle_user@localhost identified by '123456';
MariaDB [(none)]> flush privileges;
Once we have Apache, PHP and MySQL configured we can proceed with installing moodle code.
Setting PHP.ini
$ cd /etc/php/8.1/apache2
$ sudo nano php.ini
Setting nilainya sesuai data berikut
upload_max_filesize = 100M
post_max_size = 48M
memory_limit = 512M
max_execution_time = 600
max_input_vars = 5000
max_input_time = 1000
$ systemctl restart apache2
Edit juga php.ini yang ada di
$ cd /etc/php/8.1/cli
$ cd /etc/php/8.1/fpm
Create Moodledata
$sudo mkdir /var/moodledata
$sudo chmod -Rf 777 /var/moodledata
Install Moodle
Downlod moodle sebagai manusia di https://download.moodle.org/releases/latest/
copy dengan scp ke /var/tmp
mv moodle-latest-404.gz /var/www/html
cd /var/www/html
tar zxvf moodle-latest-404.gz
chmod -Rf 777 moodle
Lanjutkan melalui browser
http://ip-server/moodle
Saat install pastikan databasenya pakai mariadb, user databasesnya disesuaikan dengan data di atas