Install Moodle 4.4-Ubuntu 24.04

From Dboswiki
Jump to navigation Jump to search
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>