How to install Chamilo e-learning Management System on Ubuntu 18.04 LTS

Chamilo is a free and open-source e-learning management system that is extensively used for online education and team collaboration. It allows for creating a virtual campus environment for the provision of fully online and hybrid courses. Its main purpose is to provide easy access to knowledge and education globally. It is written in PHP and comes under the GNU/GPL license.

In this article, we will explain how to install Chamilo LMS on Ubuntu. Before moving towards installation, let’s take a look at some of the features of Chamilo:

  • Download, upload and hide course content as per the requirements.
  • Manage course and user based on various user's profiles like instructors, students, administrators
  • User management, authentication, and enrollment
  • Enable deadline-based assignments.
  • Generate reports in Excel and CSV format.
  • Supports bulk generation of users
  • Multi-lingual

We will use Ubuntu 18.04 LTS for explaining the procedure mentioned in this article.

Pre-requisites

Here is the list of pre-requisites that are required for installing Chamilo:

  • Apache2
  • MySQL or MariaDB
  • PHP and the related modules

First, we will meet all the pre-requisites, then we will install and setup Chamilo. Follow the below steps to do so:

Step 1: Install Apache2

Make sure all the packages are up to date. For that, launch the Terminal by using Ctrl+Alt+T key shortcut and then run the following command in it:

$ sudo apt update

Then install Apache2 by running the following command in Terminal:

$ sudo apt install apache2

Install Apache2 web server

After installing Apache2, run the following commands one by one in order to stop, start, and enable the Apache services. Enable command will allow the Apache to always start at the boot time.

$ sudo systemctl stop apache2.service

$ sudo systemctl start apache2.service

$ sudo systemctl enable apache2.service

Enable apache2 web service

For testing Apache, open any web browser and in the address bar, type http:// followed by the hostname or IP address of your system and press Enter.

http://localhost

or

http:// IP-address

By doing so, you will see the following Apache default page.

Apache default web page

Step 2: Install MariaDB database server

Chamilo requires an empty database to work. We can install MySQL or  MariaDB database server. For this demonstration, we will use MariaDB server. Run the following command in Terminal to install it:

$ sudo apt-get install mariadb-server mariadb-client

Install MariaDB

Once finished installing MariaDB, run the following commands one by one in order to stop, start and enable the Apache services. Enable command will allow the MariaDB to always start at the boot time.

$ sudo systemctl stop mariadb.service

$ sudo systemctl start mariadb.service

$ sudo systemctl enable mariadb.service

Enable MariaDB service to start when the server boots

MariaDB is not a secure database by default. We can secure it by creating a root password and disallowing remote access. to do so, run the following command:

$ sudo mysql_secure_installation

When you will execute the above command, it will prompt for different questions. Answer them as follows:

  • Enter current password for root (enter for none): Press Enter
  • Change the root password? [Y/n]: y
  • New password: Enter password
  • Re-enter new password: Re-enter password
  • 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

Secure MariaDB installation

Now the MariaDB has installed, we can test it by running the following command in Terminal:

$ sudo mysql -u root –p

Enter the password that you have set above while configuration. If the MariaDB server has installed successfully, you will see the Welcome message as shown in the below screenshot.

Test database login

Step 3: Install PHP 7.2 and related modules

Now we will have to install PHP and its related modules. PHP is not available in Ubuntu default repositories, so we will install it from third-party PPA repository. Follow the below step to do so:

In the Terminal, run the following command:

$ sudo apt-get install software-properties-common

install software-properties-common

Then add the PPA by running this command:

$ sudo add-apt-repository ppa:ondrej/php

Install Ondrej PPA

After adding the PPA, update the local repository by running the command:

$ sudo apt update

Update package lists

Then run the following command to install PHP and its related modules:

$ sudo apt install php7.2 libapache2-mod-php7.2 php7.2-common php7.2-sqlite3 php7.2-curl php7.2-intl php7.2-mbstring php7.2-xmlrpc php7.2-mysql php7.2-gd php7.2-xml php7.2-cli php7.2-ldap php7.2-apcu php7.2-zip

Install PHP

Now we will configure the PHP settings. For that open the configuration file php.ini in an editor by executing the below command in Terminal. We are using the Nano editor.

$ sudo nano /etc/php/7.2/apache2/php.ini

Update php.ini settings

Append the lines to have following configuration. For searching the following lines in Nano editor, you can use the keyboard shortcut Ctrl+W.

file_uploads = On

allow_url_fopen = On

short_open_tag = On

memory_limit = 256M

upload_max_filesize = 100M

max_execution_time = 360

date.timezone = Add time zone

You can find your timezone in Ubuntu by typing timezonectl in Terminal.

Once done with the configuration, save the file and exit.

Step 4: Restart Apache2

So the PHP has configured, now we will restart the Apache to reload the PHP configurations. For that, run the following command in Terminal:

$ sudo systemctl restart apache2.service

Step 5: Test PHP

Then we will test PHP settings with Apache and for this, we will have to create a phpinfo.php file in Apache root directory /var/www/html. Run the following command to do so:

$ sudo nano /var/www/html/phpinfo.php

Add the below line and save the file.

<?php phpinfo( ); ?>

Now type the following address in the address bar of your browser.

http://localhost/phpinfo.php

By doing so, you will see the following default PHP page.

Test PHP

Step 6: Create Chamilo database

Now we will need to login to MariaDB server and create a database for the Chamilo. To login, run the below command in Terminal:

$ sudo mysql -u root –p

When prompted for the password, enter MariaDB root password.

Then run the following commands in Terminal to create a new database, database user and granting the user with complete access to the database respectively. Replace chamilo, chamilouser, 'databse_password and the 'user_password with your own ones.

$ CREATE DATABASE chamilo;

$ CREATE USER 'chamilouser'@'localhost' IDENTIFIED BY 'databse_password;

$ GRANT ALL ON chamilo.* TO 'chamilouser'@'localhost' IDENTIFIED BY 'user_password' WITH GRANT OPTION;

$ FlUSH PRIVILEGES

$ EXIT

Create Chamilo database

Step 7: Download and install Chamilo LMS

Now run the following command in Terminal to download Chamilo:

$ cd /tmp && wget https://github.com/chamilo/chamilo-lms/releases/download/v1.11.6/chamilo-1.11.6-php7.zip

It will download the Chamilo set up in your current working directory.

Download Chamilo LMS

The setup will be in a zip format. To unzip it, run the following command:

$ unzip chamilo-1.11.6-php7.zip

Extract Chamilo archive

Then we will need to move the extracted setup to the Apache root directory. For that run the following command:

$ sudo mv chamilo-1.11.6 /var/www/html/Chamilo

Move install directory

Now change the root permission by running the below commands:

$ sudo chown -R www-data:www-data /var/www/html/chamilo/

$ sudo chmod -R 755 /var/www/html/chamilo/

Adjust file and folder permissions

Step 8: Create Apache virtual host

We will have to create an Apache virtual host directive for our Chamilo LMS site. It will help us to define domain, ports, alias and some other configurations. For that, run the following command in Terminal to create new configuration file Chamilo.conf:

$ sudo nano /etc/apache2/sites-available/chamilo.conf

Now copy-paste the below content, Replace example.com after the ServerName with your own domain name or IP address.

<VirtualHost *:80>

ServerAdmin [email protected]

DocumentRoot /var/www/html/chamilo

ServerName example.com

<Directory /var/www/html/chamilo/>

Options FollowSymlinks

AllowOverride All

Require all granted

</Directory>

ErrorLog ${APACHE_LOG_DIR}/error.log

CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

Now press Ctrl+O to save and Ctrl+X to exit the file.

Step 9: Enable the Chamilo LMS Site and Rewrite Module

After creating a virtual host directive, we will need to enable it. Run the below command to do so:

$ sudo a2ensite chamilo.conf

Then enable the Apache Rewrite module:

$ sudo a2enmod rewrite

Finally restart the Apache webserver.

$ sudo systemctl restart apache2.service

Enable the site

Step 10: Access Chamilo web interface

As we have set up and configured everything required for Chamilo LMS, now we will move towards its web-based installation. To do so, open any web browser and open the following address:

http://ip-address

or

http://domain/

After entering the above address, you will see the Chamilo installation page. Click on the Install Chamilo button to start the installation process.

Access Chamilo web interface

Select the installation language from the drop-down menu and click Next.

Select language

In the next screen, you will see the requirements that are essential for the fully-featured Chamilo LMS. Make sure all the requirements are met. If something is missing, you will see them in the orange color and you can install them later. Click on New installation button at the bottom of the web page to move to the next step. Check system requirements

Now you will see the License agreement page, click on I Accept checkbox and click the next button.

Accept license agreement

Now we will do database configuration to connect Chamilo with the MariaDB database for the purpose of storing and retrieving data. In the fields, add localhost as a database host, 3306 as a port number. Then in the last three fields, enter database login user, password and the database name respectively that you have set earlier.

Once you are done, click on the Check database connection. If there is no error, move on to the next step by clicking on the Next button.

MySQL database settings

Now configure the admin account by entering the required admin credentials.

Config settings

Review the settings and then click on Install Chamilo button.

Install Chamilo

Wait for a while until the installation is completed and you see the following screen. Click on Go to your newly created portal to finish the installation wizard.

Installation successful

Now you will see the following Chamilo login page. Enter the required credentials and click on the Login button.

Chamilo website

Now you will be directed to the Chamilo dashboard as shown the below screenshot.

Chamilo Dashboard

Finally, we have successfully installed and configured Chamilo LMS in our Ubuntu 18.04 LTS. It is a user-friendly web-based Learning management system that facilitates sharing and collaboration. Installation and configuration of Chamilo LMS was a lengthy but straightforward procedure. I hope it will be helpful whenever you need to setup up an e-learning environment.