Here's the updated step-by-step guide to install Moodle on Alpine Linux with your provided configuration:
- Update the package list:
apk update
- Upgrade installed packages:
apk upgrade
- Install necessary packages:
apk add nginx php82 php82-fpm php82-session php82-opcache php82-gd php82-mysqli php82-pdo_mysql php82-xmlreader php82-ctype php82-zip php82-soap php82-intl php82-xmlrpc php82-mbstring php82-json php82-curl php82-tokenizer mariadb mariadb-client wget
- Enable and start services:
rc-service nginx start rc-service php-fpm82 start rc-service mariadb start rc-update add nginx rc-update add php-fpm82 rc-update add mariadb
- Secure the MariaDB installation:
mysql_secure_installation
- Log in to MariaDB:
mysql -u root -p
- Create a database and user for Moodle:
CREATE DATABASE moodle CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; CREATE USER 'moodleuser'@'localhost' IDENTIFIED BY 'mdl@123'; GRANT ALL PRIVILEGES ON moodle.* TO 'moodleuser'@'localhost'; FLUSH PRIVILEGES; EXIT;
- Download Moodle:
cd /var/www wget https://download.moodle.org/stable402/moodle-latest-402.tgz
- Extract Moodle:
tar -xvzf moodle-latest-402.tgz rm moodle-latest-402.tgz
- Create the Moodle data directory:
mkdir /var/www/moodledata chown -R nginx:nginx /var/www/moodle /var/www/moodledata chmod -R 777 /var/www/moodledata
- Edit the Nginx configuration:
nano /etc/nginx/http.d/moodle.conf
- Add the following content:
server { listen 80; server_name 192.XXX.X.XX root /var/www/moodle; index index.php index.html index.htm; location / { try_files $uri $uri/ /index.php?$query_string; } location ~ [^/]\.php(/|$) { fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_index index.php; include fastcgi_params; fastcgi_pass 127.0.0.1:9000; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; } location ~* /\. { deny all; } }
- Test and restart Nginx:
nginx -t rc-service nginx restart
- Edit the PHP-FPM configuration:
nano /etc/php82/php-fpm.d/www.conf
- Set the
user
andgroup
tonginx
:user = nginx group = nginx
- Restart PHP-FPM:
rc-service php-fpm82 restart
- Edit the Moodle configuration file:
nano /var/www/moodle/config.php
- Add the following content:
<?php $CFG->dbtype = 'mariadb'; $CFG->dblibrary = 'native'; $CFG->dbhost = 'localhost'; $CFG->dbname = 'moodle'; $CFG->dbuser = 'moodleuser'; $CFG->dbpass = 'Passwrd@12'; $CFG->prefix = 'mdl_'; $CFG->wwwroot = 'http://192.XXX.X.XXX'; $CFG->dataroot = '/var/www/moodledata'; $CFG->directorypermissions = 0777; require_once(__DIR__ . '/lib/setup.php');
- Set permissions:
chmod -R 777 /var/www/moodledata
- Access Moodle in your browser:
- Navigate to
http://192.XXX.X.XXX
.
- Navigate to
- Follow the Moodle setup wizard:
- Confirm database settings:
- Database:
moodle
- User:
moodleuser
- Password:
mdl@123
- Database:
- Complete the installation.
- Confirm database settings:
-
Ensure all required PHP extensions are installed:
php -m
If extensions are missing, install them using:
apk add php82-<extension_name>
Example:
apk add php82-soap
. -
Restart services:
rc-service php-fpm82 restart rc-service nginx restart
- Export the VM as a
.vdi
file:- In VirtualBox, go to File > Export Appliance and select your Alpine VM.
- Share the
.vdi
file via a platform like OneDrive.- Example:
https://onedrive.live.com/?id=example
.
- Example:
- Username:
moodle
- Password:
mdl@123