Moodle

From Alpine Linux
Revision as of 07:22, 27 February 2025 by Wenheping (talk | contribs) (Created page with "Installing Moodle on Alpine Linux Moodle is one of the most well-known open-source learning management systems. The following steps have been tested on a fresh installation of Alpine Linux 3.21.3. 1. Install Apache2 Server # apk add apache2 # rc-service apache2 start # Start the service # rc-update add apache2 # Enable auto-start on boot Configuration file location: /etc/apache2/httpd.conf Web root directory: /var/www/localhost/htdocs Log file location...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Installing Moodle on Alpine Linux

Moodle is one of the most well-known open-source learning management systems. The following steps have been tested on a fresh installation of Alpine Linux 3.21.3. 1. Install Apache2 Server

  1. apk add apache2
  2. rc-service apache2 start # Start the service
  3. rc-update add apache2 # Enable auto-start on boot
   Configuration file location: /etc/apache2/httpd.conf
   Web root directory: /var/www/localhost/htdocs
   Log file location: /var/log/apache2

Verify the installation by opening the client browser and checking for the "It works!" success page.

2. Install PHP and Configure Apache2 to Support PHP

  1. apk add php php-apache2

The current default installed PHP version is 8.3. The configuration files to enable PHP support in Apache2 are automatically generated and installed, which is great! It is recommended to add index.php to the appropriate location in the Apache2 configuration file for convenience in later steps.

At least one parameter in the default PHP configuration file needs to be adjusted; otherwise, the installation will fail:

  1. vi /etc/php/php83/php.ini

Locate the max_input_vars parameter, remove the comment symbol (;), and change the default value from 1000 to 5000.

After making the change, restart Apache2 to apply the PHP configuration:

  1. rc-service apache2 restart

Create a test file test.php in the web root directory: <?php phpinfo(); ?>

Then, enter the following URL in the client browser: http://your-ip/test.php

You should see a detailed page displaying various PHP parameters.

3. Install MariaDB Database Server

  1. apk add mariadb mariadb-client

Prepare the necessary directories and permissions:

  1. mkdir -p /var/lib/mysql
  2. chown mysql:mysql /var/lib/mysql
  3. /etc/init.d/mariadb setup

Start the MariaDB service and enable auto-start on boot:

  1. rc-service mariadb start
  2. rc-update add mariadb

It is also recommended to perform security configurations and set a password for the database superuser:

  1. mysql_secure_installation

4. Install Required PHP Modules Moodle requires many additional PHP modules. Install them all at once:

  1. apk add php-ctype php-curl php-dom php-exif php-fileinfo php-gd php-iconv php-intl php-mbstring php-mysqli php-opcache php-session php-simplexml php-soap php-sodium php-tokenizer php-xml php-xmlreader php-zip

If any modules are missing, Moodle will detect them during the client-side installation, and you can install them later.

Don’t forget to restart Apache2 to apply the changes:

  1. rc-service apache2 restart

5. Install Moodle

  1. cd /var/www/localhost
  2. chown apache:apache moodledata
  3. cd /var/www/localhost/htdocs
  4. wget https://packaging.moodle.org/stable405/moodle-4.5.2.tgz

(The latest version is 4.5.2, but you can download a newer version from the official website: www.moodle.org) Extract the downloaded file:

  1. tar zxvf moodle-4.5.2.tgz

The remaining installation steps must be completed in the client browser: http://your-ip/moodle

If the previous steps were completed without errors, the client-side installation should proceed smoothly. Follow the on-screen prompts and click "Next" as needed. During the process, a Moodle configuration file (config.php) will be generated, which needs to be manually copied to the Moodle root directory. (Alternatively, you can set the Moodle directory to a+w permissions to avoid this step, but this reduces security.)

This guide should help you successfully install Moodle on Alpine Linux!