Install Moodle 4.4-Ubuntu 24.04: Difference between revisions

From Dboswiki
Jump to navigation Jump to search
No edit summary
Line 45: Line 45:
     # a2enmod ssl (jika ada sertifikat ssl)
     # a2enmod ssl (jika ada sertifikat ssl)
     # systemctl restart apache2
     # systemctl restart apache2
==Create database and a database user==

Revision as of 01:39, 27 April 2024

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