Moodle is a widely-used, open-source Learning Management System (LMS) that allows educators to create online courses. If you’re running Ubuntu 24.04 and want to set up Moodle on your server, this guide will walk you through the installation process. This setup is ideal for both local servers and VPS servers.

Step 1: Update Your Server

Before installing any software, it's important to ensure your server is up to date. Run the following command in your terminal:

sudo apt update && sudo apt upgrade -y

Step 2: Install Apache, MySQL, and PHP

Moodle requires a web server (Apache), a database server (MySQL), and PHP. Use the following commands to install the necessary software:

sudo apt install apache2 mysql-server php libapache2-mod-php php-mysql php-xml php-mbstring php-zip php-intl php-curl php-soap -y

Once the installation is complete, enable and start the Apache and MySQL services:


sudo systemctl enable apache2
sudo systemctl start apache2
sudo systemctl enable mysql
sudo systemctl start mysql
        

Step 3: Create a MySQL Database for Moodle

Next, you need to create a database and user for Moodle in MySQL. Start by logging into the MySQL shell:

sudo mysql

Create a new database and user, then grant all privileges to that user:


CREATE DATABASE moodle;
CREATE USER 'moodleuser'@'localhost' IDENTIFIED BY 'yourpassword';
GRANT ALL PRIVILEGES ON moodle.* TO 'moodleuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;
        

Step 4: Download and Set Up Moodle

Download the latest version of Moodle from the official website. Navigate to your web server’s root directory and download Moodle:


cd /var/www/html
sudo wget https://download.moodle.org/download.php/direct/stable400/moodle-latest-400.tgz
        

Extract the downloaded file and change the ownership of the Moodle directory to the Apache user:


sudo tar -zxvf moodle-latest-400.tgz
sudo mv moodle /var/www/html/moodle
sudo chown -R www-data:www-data /var/www/html/moodle
sudo chmod -R 755 /var/www/html/moodle
        

Step 5: Configure Apache for Moodle

Create a new virtual host configuration file for Moodle in Apache:

sudo nano /etc/apache2/sites-available/moodle.conf

Add the following configuration to the file:



    ServerAdmin admin@yourdomain.com
    DocumentRoot /var/www/html/moodle
    ServerName yourdomain.com
    ServerAlias www.yourdomain.com

    
        Options FollowSymlinks
        AllowOverride All
        Require all granted
    

    ErrorLog ${APACHE_LOG_DIR}/moodle_error.log
    CustomLog ${APACHE_LOG_DIR}/moodle_access.log combined

        

Enable the new virtual host and rewrite module, then restart Apache:


sudo a2ensite moodle.conf
sudo a2enmod rewrite
sudo systemctl restart apache2
        

Step 6: Complete Moodle Installation via Web Browser

Now that Moodle is set up on the server, open a web browser and navigate to:

http://yourdomain.com

Follow the on-screen instructions to complete the installation. You will be asked to enter the database details you created earlier (database name, username, and password).

Managing Moodle on a VPS Server

Running Moodle on a VPS server offers great performance and flexibility. Whether you're hosting a small educational platform or a large online learning system, a VPS gives you full control over your environment.

Looking for Reliable VPS Hosting?

If you're looking for a powerful and reliable VPS server to host Moodle LMS, consider WindowsVPS. With WindowsVPS, you can easily manage your Moodle installation and ensure smooth performance for your online courses.

Hai trovato utile questa risposta? 0 Utenti hanno trovato utile questa risposta (0 Voti)