How to Install Chamilo 1.11.8 on CentOS 7

Published on: Fri, Jan 25, 2019 at 11:18 am EST
CentOS Linux Guides Server Apps

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 a CentOS 7 server instance.

Prerequisites

  • A fresh Vultr CentOS 7 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 using the EPEL YUM repo. See details here.
  • A domain, chamilo.example.com, being pointed to the server instance mentioned above.

Modify firewall rules

In production, you need to modify firewall rules in order to allow only inbound TCP traffic on the SSH, HTTP, and HTTPS ports:

sudo firewall-cmd --permanent --add-service=ssh
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
sudo systemctl reload firewalld.service

Install Apache 2.4

On CentOS 7, you can use YUM to install the latest stable release of Apache:

sudo yum install httpd httpd-devel -y

Remove the pre-set Apache welcome page:

sudo sed -i 's/^/#&/g' /etc/httpd/conf.d/welcome.conf

Start the Apache service and make it auto-start on every system boot:

sudo systemctl start httpd.service
sudo systemctl enable httpd.service

Install and secure MariaDB

Setup a YUM repo for the latest stable release of MariaDB on the system:

cat <<EOF | sudo tee /etc/yum.repos.d/MariaDB.repo
# MariaDB 10.3 CentOS repository list - created 2018-09-25 14:01 UTC
# http://downloads.mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.3/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
EOF

Install MariaDB using the newly created MariaDB YUM repo:

sudo yum install -y MariaDB-server MariaDB-client

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

Press ENTER to use the defaults, and choose a secure password when prompted:

Install required PHP 7.2.x packages

In order to get greater performance on the Chamilo LMS server, it's recommended to install PHP 7.2 packages rather than legacy PHP 5.x packages. Currently, you can use the Webtatic YUM repo to install required packages:

sudo rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
sudo yum install -y mod_php72w php72w-opcache php72w-cli php72w-common php72w-gd php72w-intl php72w-mbstring php72w-mysqlnd php72w-process php72w-soap php72w-xml php72w-xmlrpc php72w-ldap php72w-pecl-apcu

Backup and update the PHP config file:

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

Note: When working on your own server instance, make sure to replace the example timezone value America/Los_Angeles with your own. You can find all of the supported timezone values here.

Create a dedicated MariaDB database for Chamilo LMS

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 apache user and the apache group:

sudo chown -R apache:apache /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.ini

Find the following lines respectively:

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

One by one, replace them as follows:

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

Save and quit:

:wq!

Setup an Apache virtual server for Chamilo LMS

Setup an Apache virtual host for your Chamilo LMS site:

cat <<EOF | sudo tee /etc/httpd/conf.d/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/httpd/chamilo.example.com-error_log
CustomLog /var/log/httpd/chamilo.example.com-access_log common
</VirtualHost>
EOF

Restart the Apache service to put all of your modifications into effect:

sudo systemctl restart httpd.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 as English, and then click the Next button.
  • Step 2 – Requirements: Make sure that all mandatory requirements have been met, and then click the New installation button.
  • Step 3 – Licence: You need to review the GNU General Public licence (GPL), select the checkbox next to the I agree sentence, fill in all of the contact info fields, and then click the Next button to move on.
  • Step 4 – MySQL database settings: Input the database credentials we setup earlier and then click the Check database connection button to verify them. Once verified, click the Next button to move on.
  • Step 5 – Config settings: Make sure to modify the pre-set administrator password (a random string), fill in other fields according to your business plan, and then click the Next button to move on.
  • Step 6 – Last check before install: Review all of the settings and then click the Install chamilo button to start the web installation.
  • Step 7 – Installation process execution: When Chamilo is successfully installed, click the Go 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

Want to contribute ?

You could earn up to $300 by adding new articles