Installation guide for Chamilo 1.11.16 on Digital Ocean with PHP7.4

This guide will take you through the process of installing the Chamilo e-learning portal, version 1.11.16 on a fresh Digital Ocean instance, on an Ubuntu 20.04 64bit distribution To follow this guide, you should be familiar with the notion of SSH keys and installing/configuring server software on Ubuntu. Previous articles on this blog explain how to install Chamilo 1.9 using Juju Charms, how to install 1.10.2 on Ubuntu 15.10, 1.10.* on Ubuntu 16.04 and 1.11.* on Ubuntu 17.04. The packages available on Ubuntu 20.04 being slightly different, we decided to write this guide to make sure the package could be installed easily by anyone with a minimum of technical skills and a will to learn. Image removed.

Step 1: Get a Digital Ocean instance

  • If you don't have one, create an account on Digital Ocean
  • Give a credit card account or make a payment through PayPal (you might not need it for the first few bucks you'll need to follow this guide)
  • Create a (cheap) instance of 1GB RAM ($10/month) with Ubuntu 20.04 x64.
  • Give an SSH key so that you can connect to your instance with "ssh root@[instance-ip]"

Step 2: Setup temporary domain name

To make it short, we'll just define the new instance's IP as a local name on our computer only. You can also use the IP directly, but I prefer using a name.
  • edit your local computer's /etc/hosts file (on Windows, C:\Windows\System32\drivers\etc\hosts),
  • add the instance IP, a blank space, and a name you want to give it. e.g.: 104.236.39.29 cham1.beeznest.com
In my case, I have IP 104.236.39.29 and name cham1.beeznest.com, but in the following guide we will assume (for simplicity) that we use the IP address directly. If you later want to add support for HTTPS, you *will* need a domain or sub-domain name.

Step 3: Connect and install software stack

Ubuntu 20.04 now comes officially with PHP 7(.3), but we'd like to use PHP 7.4 so we'll do a little bit of extra work. Launch the following commands in sequence:
  • apt update && apt -y upgrade
  • apt -y install software-properties-common
  • add-apt-repository ppa:ondrej/php
  • apt update
  • apt -y install apache2 libapache2-mod-php7.4 mariadb-client mariadb-server php-pear php7.4-{dev,gd,curl,mcrypt,intl,mysql,mbstring,zip,xml,apcu}
  • mysql_secure_installation
  • give a MySQL root password twice (remember it) and confirm every other question asked
This whole step takes about 2.5 minutes in total on Digital Ocean's super fast infrastructure.

Step 4: Downloading from Github

  • cd /var/www
  • mkdir chamilo
  • cd chamilo
  • wget https://github.com/chamilo/chamilo-lms/archive/v1.11.16.tar.gz
  • tar zxf v1.11.16.tar.gz
  • mv chamilo-lms-1.11.16 www
  • cd www
  • chmod -R 0777 main/lang main/default_course_document/images/ app web

Step 5: Database

  • mysql -u root -p
  • [give the mysql root password]
  • mysql> GRANT ALL PRIVILEGES ON chamilo.* TO chamilo@localhost IDENTIFIED BY 'chamilo';
  • mysql> FLUSH PRIVILEGES;
  • mysql> exit;

Step 6: Configure Apache's Virtual Host

Since version 1.10 of Chamilo, it is *mandatory* that your web server handles some redirections, which is done the easiest by doing the following (in the case of Apache).
  • cd /etc/apache2/sites-available/
  • vim 000-default.conf (or use another editor if you like)
  • Under the #ServerName line, add: ServerName 104.236.39.29 (or the IP of this virtual machine, or the name you've given it in /etc/hosts)
  • [change /var/www by /var/www/chamilo/www everywhere]
  • Add the following block anywhere *inside* the VirtualHost block (if using Apache 2.4, use "Require all granted" instead of  the "Order allow,deny" and "allow from all" lines.
 <Directory /var/www/chamilo/www>
   Options Indexes FollowSymLinks MultiViews
   AllowOverride All
   Order allow,deny
   allow from all
 </Directory>
 php_admin_value date.timezone "Europe/London"
 php_admin_value session.cookie_httponly 1
 php_admin_value upload_max_filesize 512M
 php_admin_value post_max_size 512M
  • exit (esc + :wq + enter)
  • a2enmod rewrite
  • systemctl restart apache2

Step 7: Browser install of Chamilo

  • Open your browser on http://104.236.39.29 (the IP of this virtual machine) and follow the installation process (see your chamilo user, password and database name in the "GRANT" command above)
That's all, folks! Don't forget this is a development-type installation, meaning that some things will not be tuned for production environments. If you need production-ready installations, the BeezNest team is available for hiring.

Extra: Setting it up with Nginx

If you want to use HTTP2, you will have to use Nginx. Using Nginx adds a few complicated steps to this procedure, so let's see what can be done here...
  • apt-get remove apache2
  • apt-get install nginx-full php7.4-fpm
  • vim /etc/nginx/sites-available/default
    • change "root" from /var/www/html to /var/www/chamilo/www
    • use https://campus.chamilo.org/documentation/installation_guide.html to copy-paste the configuration block for Nginx, only replacing /var/run/php5-fpm.sock by /var/run/php/php7.4-fpm.sock
  • vim /etc/php/7.4/fpm/pool.d/www.conf
    • add "php_admin_value[date.timezone] = "Europe/Paris" at the end
  • vim /etc/php/7.4/fpm/conf.d/10-opcache.ini
    • add a line "opcache.enable 1"
  • service nginx restart
  • service php7.4-fpm restart
To enable HTTP2 support (which, by the way, will only work with HTTPS at this time), change "listen 443 ssl" to "listen 443 ssl http2". This also means that your server will be *required* to have a domain name (in this guide we essentially used an IP address to install Chamilo), and that you will *need* an SSL certificate (you can get one for free from letsencrypt.org, but that's not very easy with Nginx as of April 2016). Because of the inherent restrictions of HTTP2 in terms of security, it is mandatory to configure the port 443 section of your Nginx config in a highly-secured manner. You can use the cipherli.st page to copy-paste most of the config (you'll need to adjust to your Nginx version, though). In any case, HTTP2 will require TLS >= 1.2. Just remember that.

Other Cloud providers

The procedure above (with some minor changes) is pretty much the same on a Google Cloud Compute instance and (to some extent) on an AWS EC2 instance, on Azure, etc.