Tutorials  /  Ubuntu

Install Chamilo LMS on Ubuntu 18.04 with Apache & PHP 7.2

Ccentron Redaktion · June 2025 ·9 min read ·Ubuntu, Tutorial

Chamilo is a widely adopted open-source learning management system (LMS) designed to facilitate e-learning and team-based collaboration globally.

This tutorial outlines the steps for installing the latest stable version of Chamilo on a server running Ubuntu 18.04 LTS.

System Requirements

  • A newly created Ubuntu 18.04 LTS 64-bit server instance. For production, at least 8GB of RAM is recommended. Example IP address: 203.0.113.1.
  • An account with sudo privileges.
  • The server has been fully updated to its latest stable release. For guidance, refer to official instructions.
  • A domain name such as chamilo.example.com correctly pointed to your server's IP address.
VM

Matching infrastructure at centron

Ubuntu servers without your own hardware: ccloud³ VMs with full root access from €3.12 per month, billed by the hour and ready in seconds. Rent a cloud server →

Configure UFW Firewall Rules

In a production setting, it is essential to configure your UFW firewall to allow only incoming TCP connections on SSH, HTTP, and HTTPS ports. Use the following commands:

Console
sudo ufw allow in ssh
sudo ufw allow in http
sudo ufw allow in https
sudo ufw enable

Install and Configure Apache 2.4 on Ubuntu 18.04

To set up the Apache web server on Ubuntu 18.04 LTS, use APT to install the most recent stable version with the command below:

Console
sudo apt install -y apache2

Next, remove the default Apache welcome page to avoid exposing unnecessary content:

Console
sudo mv /var/www/html/index.html /var/www/html/index.html.old

To enhance security, prevent Apache from displaying indexes of files and folders within the default web root directory /var/www/html:

Console
sudo cp /etc/apache2/apache2.conf /etc/apache2/apache2.conf.bak
sudo sed -i "s/Options Indexes FollowSymLinks/Options FollowSymLinks/" /etc/apache2/apache2.conf

Activate Apache’s rewrite module to support URL rewriting features required by many web applications:

Console
sudo a2enmod rewrite

Start Apache and enable it to automatically launch whenever the server boots up:

Console
sudo systemctl start apache2.service
sudo systemctl enable apache2.service

Install and Secure MariaDB 10.3 on Ubuntu 18.04

To begin, install the required packages and add the MariaDB repository to your system:

Console
sudo apt install -y software-properties-common
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
sudo add-apt-repository 'deb [arch=amd64,arm64,ppc64el] http://mirrors.accretive-networks.net/mariadb/repo/10.3/ubuntu bionic main'
sudo apt update
sudo apt install -y mariadb-server

During the setup, you’ll be asked to define a strong password for the root user of MariaDB. Choose a secure one to ensure database safety.

Now start the MariaDB service and make sure it launches automatically on every reboot:

Console
sudo systemctl start mariadb.service
sudo systemctl enable mariadb.service

Run the MariaDB secure installation script to strengthen your database configuration:

Console
sudo /usr/bin/mysql_secure_installation

When prompted by the script, answer each question as recommended below:

  • Enter current password for root (enter for none): your-MariaDB-root-password
  • Change the root password? [Y/n]: n
  • Remove anonymous users? [Y/n]: y
  • Disallow root login remotely? [Y/n]: y
  • Remove test database and access to it? [Y/n]: y
  • Reload privilege tables now? [Y/n]: y

Install PHP 7.2 and Required Extensions on Ubuntu 18.04

For optimal performance with Chamilo LMS, it's best to use PHP 7.2 instead of older 5.x versions. A third-party PPA repository can be used to install the necessary PHP 7.2 components.

Begin by adding the ondrej/php PPA and updating the system packages:

Console
sudo add-apt-repository -y ppa:ondrej/php
sudo apt update
sudo apt upgrade -y
sudo apt autoremove -y

Then install the PHP 7.2 core packages and required modules:

Console
sudo apt install -y php7.2 php7.2-opcache php7.2-cli php7.2-curl php7.2-common php7.2-gd php7.2-intl php7.2-mbstring php7.2-mysql libapache2-mod-php7.2 php7.2-soap php7.2-xml php7.2-xmlrpc php7.2-zip php7.2-ldap php-apcu-bc

Next, create a backup of the Apache PHP configuration file and set the appropriate timezone setting:

Console
sudo cp /etc/php/7.2/apache2/php.ini /etc/php/7.2/apache2/php.ini.bak
sudo sed -i 's#;date.timezone =#date.timezone = America/Los_Angeles#' /etc/php/7.2/apache2/php.ini

Note: Adjust the timezone value (e.g., America/Los_Angeles) to match your own region. A full list of supported timezones is available online.

Deploy Chamilo LMS on LAMP Stack

With your LAMP environment ready, you can now install Chamilo. This includes creating a dedicated MariaDB database, preparing Chamilo’s source files, tuning PHP, setting up a virtual host, completing browser-based configuration, and applying security hardening measures.

Create MariaDB Database and User

Access the MariaDB shell using the root account:

Code
mysql -u root -p

Inside the shell, create the Chamilo database and a user with full privileges:

Code
CREATE DATABASE chamilo;
CREATE USER 'chamilouser'@'localhost' IDENTIFIED BY 'yourpassword';
GRANT ALL PRIVILEGES ON chamilo.* TO 'chamilouser'@'localhost' IDENTIFIED BY 'yourpassword' WITH GRANT OPTION;
FLUSH PRIVILEGES;
EXIT;

Note: Replace chamilo, chamilouser, and yourpassword with your own secure values.

Download and Prepare Chamilo LMS Files

Fetch the latest PHP 7.x-compatible Chamilo version from the official GitHub repository:

Console
cd
wget https://github.com/chamilo/chamilo-lms/releases/download/v1.11.8/chamilo-1.11.8-php7.tar.gz

Extract the archive into the /opt directory:

Console
sudo tar -zxvf chamilo-1.11.8-php7.tar.gz -C /opt

Create a symbolic link in the Apache web root directory to simplify future upgrades:

Console
sudo ln -s /opt/chamilo-1.11.8-php7 /var/www/html/chamilo

Finally, change ownership of the Chamilo files to Apache's default user and group to ensure proper permissions:

Console
sudo chown -R www-data:www-data /opt/chamilo-1.11.8-php7

Install PHP 7.2 and Required Extensions

To ensure optimal performance of the Chamilo LMS, it’s advised to use PHP 7.2 instead of older PHP 5 versions. You can use a third-party repository to install the necessary packages.

First, add the ondrej/php repository and update your system:

Console
sudo add-apt-repository -y ppa:ondrej/php
sudo apt update
sudo apt upgrade -y
sudo apt autoremove -y

Now install all required PHP 7.2 packages for Chamilo:

Console
sudo apt install -y php7.2 php7.2-opcache php7.2-cli php7.2-curl php7.2-common php7.2-gd php7.2-intl php7.2-mbstring php7.2-mysql libapache2-mod-php7.2 php7.2-soap php7.2-xml php7.2-xmlrpc php7.2-zip php7.2-ldap php-apcu-bc

Create a backup of the PHP configuration file used by Apache and adjust the timezone setting:

Console
sudo cp /etc/php/7.2/apache2/php.ini /etc/php/7.2/apache2/php.ini.bak
sudo sed -i 's#;date.timezone =#date.timezone = America/Los_Angeles#' /etc/php/7.2/apache2/php.ini

Note: Replace America/Los_Angeles with the correct timezone for your location. You can find the list of supported values online.

Create Chamilo Database and User

Login to MariaDB and create the Chamilo database and its dedicated user:

Code
mysql -u root -p

Inside the MariaDB shell, enter the following commands:

Code
CREATE DATABASE chamilo;
CREATE USER 'chamilouser'@'localhost' IDENTIFIED BY 'yourpassword';
GRANT ALL PRIVILEGES ON chamilo.* TO 'chamilouser'@'localhost' IDENTIFIED BY 'yourpassword' WITH GRANT OPTION;
FLUSH PRIVILEGES;
EXIT;

Note: Replace chamilo, chamilouser, and yourpassword with your actual database details.

Download and Set Up Chamilo Files

Grab the latest Chamilo PHP 7 version from GitHub and extract it:

Console
cd
wget https://github.com/chamilo/chamilo-lms/releases/download/v1.11.8/chamilo-1.11.8-php7.tar.gz
sudo tar -zxvf chamilo-1.11.8-php7.tar.gz -C /opt

Create a symbolic link to the Chamilo folder within Apache’s web root:

Console
sudo ln -s /opt/chamilo-1.11.8-php7 /var/www/html/chamilo

Assign ownership of Chamilo files to Apache's default user and group:

Console
sudo chown -R www-data:www-data /opt/chamilo-1.11.8-php7

Adjust PHP 7.2 Configuration for Chamilo

Edit the same PHP config file and update several key settings:

Console
sudo vi /etc/php/7.2/apache2/php.ini

Locate the following parameters:

  • session.cookie_httponly =
  • upload_max_filesize = 2M
  • post_max_size = 8M

And change them to:

  • session.cookie_httponly = 1
  • upload_max_filesize = 100M
  • post_max_size = 100M

Save the file and exit by typing :wq!.

Create Apache Virtual Host for Chamilo

Set up a new Apache virtual host configuration for the Chamilo site:

Code
cat < 
cat <

Be sure to replace example.com with your actual domain name.

Disable the default site and enable your new Chamilo site configuration:

Console
sudo rm /etc/apache2/sites-enabled/000-default.conf
sudo ln -s /etc/apache2/sites-available/chamilo.conf /etc/apache2/sites-enabled/

Restart Apache to apply all changes:

Console
sudo systemctl restart apache2.service

Complete the Chamilo Web Installation

Open your browser and visit http://chamilo.example.com. Follow the on-screen wizard:

  1. Installation Language: Choose your preferred language, like English, and click Next.
  2. Requirements: Ensure all requirements are fulfilled and click New Installation.
  3. License: Accept the GPL license, enter your contact info, and continue.
  4. Database Settings: Input your database details, check the connection, and proceed.
  5. Configuration: Update the admin password and fill in other fields as needed.
  6. Final Check: Confirm everything and click Install Chamilo.
  7. Finish: Click “Go to your newly created portal.”

Secure Chamilo Post Installation

Apply the following security measures after installation:

Console
sudo chmod -R 0555 /var/www/html/chamilo/app/config
sudo rm -rf /var/www/html/chamilo/main/install

Conclusion

By following this detailed guide, you have successfully installed and configured Chamilo LMS on an Ubuntu 18.04 LTS server. From setting up the Apache web server and securing the MariaDB database, to tuning PHP 7.2 for optimal performance and finalizing the Chamilo installation via a web browser, every critical step has been covered.

This deployment not only ensures a robust and scalable e-learning platform, but also maintains security best practices and system efficiency. You are now ready to leverage Chamilo's full potential for managing online courses, virtual classrooms, and collaborative learning environments.

Jetzt 200 € Guthaben sichern

Testen Sie Ihr Setup auf ccloud³

Registrieren Sie sich in der ccloud³ und erhalten Sie 200 € Startguthaben für Ihr Projekt – z. B. für eine PostgreSQL-VM mit automatischen Backups.

centron Redaktion Technische Redaktion

Das Redaktionsteam von centron schreibt Anleitungen aus dem Betriebsalltag: getestet auf unserer eigenen Plattform, betrieben im Rechenzentrum in Hallstadt bei Bamberg.

Kategorie Ubuntu
Teilen
Noch offene Fragen?

Our team will help you with your specific setup - in German or English, by people who run the platform themselves.

War dieses Tutorial hilfreich?

Your answer is stored anonymously and helps us improve our tutorials.

Kommentare

No comments yet - be the first to ask a question about this tutorial.

Sign in to comment

Comments are open to centron customers. Sign in to your account to ask a question about this tutorial.

Weiterlesen

Das könnte Sie auch interessieren

Jetzt kostenlos anfangen

Melden Sie sich an und erhalten Sie in den ersten 60 Tagen ein Guthaben von 200 € bei centron.

Dieses Werbeangebot gilt nur für neue Konten. Angebot ausschließlich für Gewerbetreibende.

Jetzt loslegen Sales kontaktieren