Moodle: Difference between revisions

From Alpine Linux
No edit summary
No edit summary
 
Line 16: Line 16:


'''2. Install PHP and Configure Apache2 to Support PHP'''
'''2. Install PHP and Configure Apache2 to Support PHP'''
  # apk add php php-apache2


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


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!
  At least one parameter in the default PHP configuration file needs to be adjusted; otherwise, the installation will fail:
It is recommended to add index.php to the appropriate location in the Apache2 configuration file for convenience in later steps.
  # 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.


At least one parameter in the default PHP configuration file needs to be adjusted; otherwise, the installation will fail:
  After making the change, restart Apache2 to apply the PHP configuration:
# vi /etc/php/php83/php.ini
  # rc-service apache2 restart
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:
  Create a test file test.php in the web root directory:
# rc-service apache2 restart
                <?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.


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


Then, enter the following URL in the client browser:
'''3. Install MariaDB Database Server'''
http://your-ip/test.php
  #apk add mariadb mariadb-client


You should see a detailed page displaying various PHP parameters.
  Prepare the necessary directories and permissions:
  # mkdir -p /var/lib/mysql
  # chown mysql:mysql /var/lib/mysql
  # /etc/init.d/mariadb setup


3. Install MariaDB Database Server
  Start the MariaDB service and enable auto-start on boot:
# apk add mariadb mariadb-client
  # rc-service mariadb start
  # rc-update add mariadb


Prepare the necessary directories and permissions:
  It is also recommended to perform security configurations and set a password for the database superuser:
# mkdir -p /var/lib/mysql
  # mysql_secure_installation
# 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:
'''4. Install Required PHP Modules'''
# mysql_secure_installation
  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


4. Install Required PHP Modules
  If any modules are missing, Moodle will detect them during the client-side installation, and you can install them later.
Moodle requires many additional PHP modules. Install them all at once:
  Don’t forget to restart Apache2 to apply the changes:
# 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
  # rc-service apache2 restart


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:
'''5. Install Moodle'''
# rc-service apache2 restart
  # 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


5. Install Moodle
  The remaining installation steps must be completed in the client browser:
# cd /var/www/localhost
              http://your-ip/moodle
# chown apache:apache moodledata
  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.)
# 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)
  This guide should help you successfully install Moodle on Alpine Linux!
Extract the downloaded file:
# 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!

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!