How to Install Chamilo 1.11.8 on Ubuntu 18.04 LTS
Chamilo is a free and open source learning management system (LMS) which is widely used for online education and team collaboration all around the world.
In this article, I will show you how to deploy the latest stable release of Chamilo on an Ubuntu 18.04 LTS server instance.
Prerequisites
- A fresh Vultr Ubuntu 18.04 LTS x64 server instance with sufficient memory, 8GB or more is recommended in production. Say its IPv4 address is
203.0.113.1
. - A sudo user.
- The server instance has been updated to the latest stable status. See details here.
- A domain
chamilo.example.com
being pointed to the server instance mentioned above.
Modify the UFW firewall rules
In production, you need to modify UFW firewall rules in order to allow only inbound TCP traffic on the SSH, HTTP, and HTTPS ports:
sudo ufw allow in ssh
sudo ufw allow in http
sudo ufw allow in https
sudo ufw enable
Install Apache 2.4
On Ubuntu 18.04 LTS, you can use APT to install the latest stable release of Apache as follows:
sudo apt install -y apache2
Remove the pre-set Apache welcome page:
sudo mv /var/www/html/index.html /var/www/html/index.html.old
Prohibit Apache from exposing files and directories within the web root directory, /var/www/html
, to visitors:
sudo cp /etc/apache2/apache2.conf /etc/apache2/apache2.conf.bak
sudo sed -i "s/Options Indexes FollowSymLinks/Options FollowSymLinks/" /etc/apache2/apache2.conf
Enable the Apache Rewrite module:
sudo a2enmod rewrite
Start the Apache service and make it auto-start on every system boot:
sudo systemctl start apache2.service
sudo systemctl enable apache2.service
Install and secure MariaDB 10.3 series
Install the latest stable release of MariaDB:
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 installation, you will be prompted to setup a new password for the MariaDB root
user. For security purposes, make sure to input a strong password here.
Start the MariaDB service and make it auto-start on every system boot:
sudo systemctl start mariadb.service
sudo systemctl enable mariadb.service
Secure MariaDB:
sudo /usr/bin/mysql_secure_installation
When prompted, reply to each question on the screen as follows:
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 required PHP 7.2 packages
In order to get greater performance on the Chamilo site, it's recommended to install the latest PHP 7.2 packages rather than legacy PHP 5.x packages. Currently, you can use a third-party PPA repo to install required PHP 7.2 packages as follows.
Install the ondrej/php
PPA repo, and then update the system:
sudo add-apt-repository -y ppa:ondrej/php
sudo apt update
sudo apt upgrade -y
sudo apt autoremove -y
Install required PHP 7.2 packages:
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
Backup and edit the Apache-oriented PHP config file:
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: When working on your own server instance, make sure to replace the example timezone value America/Los_Angeles
with your own one. You can find all of the supported timezone values here.
Install Chamilo
Having the LAMP stack in place, it's now time to deploy the Chamilo LMS. You will need to setup a dedicated MariaDB database for Chamilo, prepare Chamilo LMS files, fine tune PHP 7.2 settings, setup an Apache virtual server, finish the installation in a web browser, and execute post-installation safety measures.
Log into the MariaDB shell as root
:
mysql -u root -p
In the MariaDB shell, input the following statements:
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: For security purposes, be sure to replace the database name chamilo
, the database username chamilouser
, and the password yourpassword
with your own ones.
Prepare the Chamilo LMS files
Download the latest stable release of Chamilo from the Chamilo GitHub repo. Be sure to choose the PHP 7.x-oriented release:
cd
wget https://github.com/chamilo/chamilo-lms/releases/download/v1.11.8/chamilo-1.11.8-php7.tar.gz
Extract all of the Chamilo files to the /opt
directory:
sudo tar -zxvf chamilo-1.11.8-php7.tar.gz -C /opt
In order to facilitate daily use and potential updates, create a symbolic link, which is pointing to the /opt/chamilo-1.11.8-php7
directory, in the Apache web root directory /var/www/html
:
sudo ln -s /opt/chamilo-1.11.8-php7 /var/www/html/chamilo
Modify the ownership of all Chamilo files to the www-data
user and the www-data
group:
sudo chown -R www-data:www-data /opt/chamilo-1.11.8-php7
Fine tune PHP 7.2 settings for Chamilo
Use the vi
editor to open the same PHP config file we edited earlier:
sudo vi /etc/php/7.2/apache2/php.ini
Find the following lines, respectively:
session.cookie_httponly =
upload_max_filesize = 2M
post_max_size = 8M
Replace them with the following:
session.cookie_httponly = 1
upload_max_filesize = 100M
post_max_size = 100M
Save and quit:
:wq!
Setup an Apache virtual server for Chamilo LMS
Use the following commands to setup an Apache virtual host for your Chamilo LMS site:
cat <<EOF | sudo tee /etc/apache2/sites-available/chamilo.conf
<VirtualHost *:80>
ServerAdmin admin@example.com
DocumentRoot /var/www/html/chamilo
ServerName chamilo.example.com
ServerAlias example.com
<Directory />
AllowOverride All
Require all granted
</Directory>
<Directory /var/www/html/chamilo>
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog /var/log/apache2/chamilo.example.com-error_log
CustomLog /var/log/apache2/chamilo.example.com-access_log common
</VirtualHost>
EOF
Note: Be sure to replace all occurences of example.com
with your actual domain.
Use a new symbolic link to replace the default link file in the /etc/apache2/sites-enabled
directory:
sudo rm /etc/apache2/sites-enabled/000-default.conf
sudo ln -s /etc/apache2/sites-available/chamilo.conf /etc/apache2/sites-enabled/
Restart the Apache service to put all of your modifications into effect:
sudo systemctl restart apache2.service
Finish the installation in a web browser
Point your favorite web browser to http://chamilo.example.com
, and you will be brought into the Chamilo installation wizard. Click the Install Chamilo
button to move on. The following section will walk you through the installation process:
Step 1 - Installation Language
: Choose the language you'd like to use, such asEnglish
, and then click theNext
button.Step 2 – Requirements
: Make sure that all mandatory requirements have been met, and then click theNew installation
button.Step 3 – Licence
: You need to review the GNU General Public licence (GPL), select the checkbox next to theI agree
sentence, fill in all of the contact info fields, and then click theNext
button to move on.Step 4 – MySQL database settings
: Input the database credentials we setup earlier and then click theCheck database connection
button to verify them. Click theNext
button to move on.Step 5 – Config settings
: Make sure to modify the pre-set administrator password, fill in the other fields according to your business plan, and then click theNext
button to move on.Step 6 – Last check before install
: Review all of the settings and then click theInstall Chamilo
button to start the web installation.Step 7 – Installation process execution
: When Chamilo is successfully installed, click theGo to your newly created portal.
button to finish the web installation wizard.
Execute post-installation safety measures
In addition, two post-installation safety measures you need to take are listed below:
sudo chmod -R 0555 /var/www/html/chamilo/app/config
sudo rm -rf /var/www/html/chamilo/main/install