‍Chamilo is a powerful and versatile e-learning and content management system that aims to improve access to education and knowledge worldwide. In this comprehensive guide, we will walk you through the step-by-step process of installing Chamilo on your Rocky Linux 8 server with the LEMP stack. By the end of this tutorial, you’ll have a fully functional Chamilo installation ready to empower your organization’s e-learning initiatives.

Prerequisites

Before we dive into the installation process, make sure you have the following prerequisites in place:

  • A system with Rocky Linux 8 installed and running.
  • Root access to the system.
  • LEMP stack (Nginx, MariaDB, and PHP) installed and running. If you haven’t set up the LEMP stack yet, refer to our guide on Installing LEMP Stack on Rocky Linux 8.

Additionally, we recommend having Let’s Encrypt installed for enhanced security and HTTPS support. You can follow our guide on Installing Let’s Encrypt with LEMP Stack on Rocky Linux 8 to set it up.

Now that you have all the prerequisites in place, let’s proceed with the Chamilo installation and configuration.

Step 1: Create Database

To begin, we need to create a database and a user for Chamilo. This will allow Chamilo to store and retrieve the necessary data. Execute the following commands to create the database and grant the required privileges to the user:

mysql -u root
CREATE DATABASE chamilo;
CREATE USER 'shapehost'@'localhost' IDENTIFIED BY 'YOUR-PASSWORD-HERE';
GRANT ALL PRIVILEGES ON chamilo.* TO 'shapehost'@'localhost';
FLUSH PRIVILEGES;
quit

Replace YOUR-PASSWORD-HERE with a strong and secure password of your choice. This will ensure the utmost security for your Chamilo installation.

Step 2: Configure Nginx Server Blocks

Next, we’ll configure the Nginx server blocks to ensure proper routing and domain mapping for Chamilo. Open the Nginx configuration file by running the following command:

nano /etc/nginx/nginx.conf

Replace the contents of the file with the following configuration:

# For more information on configuration, see:
# * Official English Documentation: http://nginx.org/en/docs/
# * Official Russian Documentation: http://nginx.org/ru/docs/

nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;

# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;

events {
 worker_connections 1024;
}

http {
 log_format main '$remote_addr - $remote_user [$time_local] "$request" '
 '$status $body_bytes_sent "$http_referer" '
 '"$http_user_agent" "$http_x_forwarded_for"';

 access_log /var/log/nginx/access.log main;

 sendfile on;
 tcp_nopush on;
 tcp_nodelay on;
 keepalive_timeout 65;
 types_hash_max_size 2048;

 include /etc/nginx/mime.types;
 default_type application/octet-stream;

 # Load modular configuration files from the /etc/nginx/conf.d directory.
 # See http://nginx.org/en/docs/ngx_core_module.html#include
 # for more information.
 include /etc/nginx/conf.d/*.conf;
}

Save and exit the file by pressing Ctrl+O, then Ctrl+X.

Now, create a new Nginx configuration file for your Chamilo domain using the following command:

vi /etc/nginx/conf.d/chamilo.conf

Add the following configuration to the file, replacing dev.domainhere.info with your actual domain name and adjusting the SSL path accordingly:

server {
listen 80;
server_name dev.domainhere.info;
root /var/www/html/chamilo;
index index.php index.html index.htm;

location / {
try_files $uri $uri/ /index.php?$args;
}

location = /favicon.ico {
log_not_found off;
access_log off;
}

location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
}

location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}

location ~ \.php$ {
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/run/php-fpm/www.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}

listen 443 http2 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/dev.domainhere.info/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/dev.domainhere.info/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}

Replace dev.domainhere.info with your actual domain name, and adjust the root path ( /var/www/html/chamilo ) to match the location where your Chamilo website’s data is stored.

Save and exit the file by pressing Esc, then :wq!, and finally, the Enter key.

If you have SELinux enabled on your system, run the following command to allow Nginx to connect through the network:

setsebool -P httpd_can_network_connect 1

Finally, restart Nginx to apply the changes:

systemctl restart nginx
systemctl status nginx

Step 3: Enable HTTP and HTTPS (Ports 80 and 443)

To enable HTTP and HTTPS connections through the firewall, run the following commands:

firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --permanent --zone=public --add-service=https
firewall-cmd --reload

This will ensure that your Chamilo installation is accessible over both HTTP (port 80) and HTTPS (port 443).

Step 4: Download and Install Chamilo

Now it’s time to download and install Chamilo on your Rocky Linux 8 server. Follow these steps:

  1. Change to the html directory:
cd /var/www/html
  1. Download the latest version of Chamilo from the official website:
wget https://github.com/chamilo/chamilo-lms/releases/download/v1.11.16/chamilo-1.11.16.zip
  1. Unzip the downloaded file:
unzip chamilo-1.11.16.zip
  1. Rename the extracted directory to a more user-friendly name:
mv chamilo-1.11.16 chamilo

Congratulations! You have successfully downloaded and installed Chamilo on your Rocky Linux 8 server.

Step 5: Set Up File Permissions

To ensure that Chamilo can access and modify the necessary files and directories, we need to set the correct file permissions. Run the following commands:

chmod -R 755 /var/www/html/chamilo
chmod -R 777 /var/www/html/chamilo/main/default_course_document/images
chmod -R 777 /var/www/html/chamilo/main/lang
chmod -R 777 /var/www/html/chamilo/web
chown -R nginx:nginx /var/www/html/chamilo
chcon -R -t httpd_sys_content_rw_t /var/www/html/chamilo

These commands will ensure that the Chamilo files and directories are readable and writable by the appropriate user, in this case, nginx.

Finally, restart Nginx to apply the changes:

systemctl restart nginx
systemctl status nginx

Step 6: Configure Chamilo

Now that Chamilo is installed and the necessary permissions are set, you can configure Chamilo by accessing your server’s IP address or domain name in a web browser. For example, https://dev.domainhere.info.

Follow the on-screen instructions to complete the Chamilo installation. When prompted for the database details, enter the information you configured in Step 1.

Once the configuration is complete, you will have a fully functional Chamilo installation ready to revolutionize your organization’s e-learning initiatives.

Conclusion

Congratulations on successfully installing Chamilo with the LEMP stack on your Rocky Linux 8 server! You now have a powerful e-learning and content management system at your fingertips. Utilize Chamilo’s extensive features and capabilities to provide a seamless and comprehensive learning experience for your students or employees.

Remember to regularly update Chamilo to ensure you have access to the latest features and security patches. Additionally, consider implementing a backup solution to protect your valuable educational content.

If you need assistance with managing your Chamilo installation or require a reliable and scalable cloud hosting solution, Shape.host is here to help. Shape.host offers secure and high-performance Cloud VPS services, backed by 24/7 in-house customer support. Visit Shape.host today to explore our hosting solutions tailored to your needs.