Moodle: Difference between revisions

From Alpine Linux
(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...")
 
No edit summary
 
(One intermediate revision by the same user not shown)
Line 2: Line 2:


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.
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
'''1. Install Apache2 Server'''
# rc-service apache2 start  # Start the service
  # apk add apache2
# rc-update add apache2    # Enable auto-start on boot
  # rc-service apache2 start  # Start the service
  # rc-update add apache2    # Enable auto-start on boot


    Configuration file location: /etc/apache2/httpd.conf
  Configuration file location: /etc/apache2/httpd.conf
    Web root directory: /var/www/localhost/htdocs
  Web root directory: /var/www/localhost/htdocs
    Log file location: /var/log/apache2
  Log file location: /var/log/apache2


Verify the installation by opening the client browser and checking for the "It works!" success page.
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


# apk add php php-apache2
'''2. Install PHP and Configure Apache2 to Support PHP'''
  # 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!
  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.
  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:
  At least one parameter in the default PHP configuration file needs to be adjusted; otherwise, the installation will fail:
# vi /etc/php/php83/php.ini
  # 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.
  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:
  After making the change, restart Apache2 to apply the PHP configuration:
# rc-service apache2 restart
  # rc-service apache2 restart


Create a test file test.php in the web root directory:
  Create a test file test.php in the web root directory:
<?php phpinfo(); ?>
                <?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.


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'''
  #apk add mariadb mariadb-client


3. Install MariaDB Database Server
  Prepare the necessary directories and permissions:
# apk add mariadb mariadb-client
  # mkdir -p /var/lib/mysql
  # chown mysql:mysql /var/lib/mysql
  # /etc/init.d/mariadb setup


Prepare the necessary directories and permissions:
  Start the MariaDB service and enable auto-start on boot:
# mkdir -p /var/lib/mysql
  # rc-service mariadb start
# chown mysql:mysql /var/lib/mysql
  # rc-update add mariadb
# /etc/init.d/mariadb setup


Start the MariaDB service and enable auto-start on boot:
  It is also recommended to perform security configurations and set a password for the database superuser:
# rc-service mariadb start
  # mysql_secure_installation
# rc-update add mariadb


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


4. Install Required PHP Modules
'''4. Install Required PHP Modules'''
Moodle requires many additional PHP modules. Install them all at once:
  Moodle requires many additional PHP modules. Install them all at once:
# 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
  # 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.
  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:
  # rc-service apache2 restart


Don’t forget to restart Apache2 to apply the changes:
# rc-service apache2 restart


5. Install Moodle
'''5. Install Moodle'''
# cd /var/www/localhost
  # cd /var/www/localhost
# chown apache:apache moodledata
  # chown apache:apache moodledata
# cd /var/www/localhost/htdocs
  # cd /var/www/localhost/htdocs
# wget https://packaging.moodle.org/stable405/moodle-4.5.2.tgz
  # 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)
  # tar zxvf 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)
  The remaining installation steps must be completed in the client browser:
Extract the downloaded file:
              http://your-ip/moodle
# tar zxvf moodle-4.5.2.tgz
  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.)


The remaining installation steps must be completed in the client browser:
  This guide should help you successfully install Moodle on Alpine Linux!
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!

Latest revision as of 07:27, 27 February 2025

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: /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

 # 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:
 # 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:
 # 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

 #apk add mariadb mariadb-client
 Prepare the necessary directories and permissions:
 # mkdir -p /var/lib/mysql
 # chown mysql:mysql /var/lib/mysql
 # /etc/init.d/mariadb setup
 Start the MariaDB service and enable auto-start on boot:
 # rc-service mariadb start
 # rc-update add mariadb
 It is also recommended to perform security configurations and set a password for the database superuser:
 # mysql_secure_installation


4. Install Required PHP Modules

 Moodle requires many additional PHP modules. Install them all at once:
 # 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:
 # rc-service apache2 restart


5. Install Moodle

 # cd /var/www/localhost
 # chown apache:apache moodledata
 # cd /var/www/localhost/htdocs
 # 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)
 # 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!