Install Chamilo LMS on Ubuntu 20.04 – Quick‑Start Guide
Got a brand‑new Ubuntu server and want to turn it into an online learning hub?
This walk‑through gets Chamilo, the open‑source LMS that powers schools and corporate training sites alike, up and running in minutes.
Prerequisites
- Ubuntu 20.04 LTS (fresh install or a clean VM)
- Root or sudo access
- Basic familiarity with the terminal
Chamilo is built on PHP 7.x, MySQL/MariaDB, and an Apache/Nginx web server. If your machine already runs those, you’re good to go. Otherwise, the first few commands will have you installing them in a single line.
1. Update and install base packages
sudo apt update && sudo apt upgrade -y sudo apt install apache2 php7.4 libapache2-mod-php7.4 \ php7.4-mysql php7.4-cli php7.4-gd php7.4-curl \ mysql-server mariadb-client unzip -y
Updating pulls the latest security patches, while installing Apache and PHP modules gives Chamilo the runtime environment it needs. If you skip php7.4-mysql, database communication will fail outright.
2. Secure MySQL (optional but recommended)
sudo mysql_secure_installation
Follow the prompts: set a strong root password, remove anonymous users, disallow remote root login, drop test DB.
A default installation leaves you open to brute‑force attacks. Even if it’s just a local dev box, better safe than sorry.
3. Create Chamilo database and user
sudo mysql -u root -p
Once in MySQL:
CREATE DATABASE chamilo DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; CREATE USER 'chamilo'@'localhost' IDENTIFIED BY 'StrongPass!23'; GRANT ALL PRIVILEGES ON chamilo.* TO 'chamilo'@'localhost'; FLUSH PRIVILEGES; EXIT;
Chamilo will look for a database named chamilo and a user with matching credentials. If you skip this, installation will stall at the “Cannot connect to database” screen.
4. Download and unpack Chamilo
cd /tmp wget https://github.com/chamilo/chamilo-lms/releases/download/1.11.8/chamilo-1.11.8.zip unzip chamilo-1.11.8.zip -d /var/www/ sudo mv /var/www/chamilo-1.11.8 /var/www/chamilo
The zip contains all the PHP files Chamilo needs; moving it to /var/www keeps your web root tidy.
5. Fix ownership and permissions
sudo chown -R www-data:www-data /var/www/chamilo
sudo find /var/www/chamilo/ -type d -exec chmod 755 {} \;
sudo find /var/www/chamilo/ -type f -exec chmod 644 {} \;
Apache runs as www‑data. If the files aren’t owned by that user, Apache can’t read them. Permissions set to 755/644 prevent users from executing or editing code they shouldn’t.
6. Configure Apache virtual host
sudo bash -c 'cat > /etc/apache2/sites-available/chamilo.conf <<EOF
<VirtualHost *:80>
ServerName chamilo.example.com
DocumentRoot /var/www/chamilo
<Directory "/var/www/chamilo">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/chamilo_error.log
CustomLog ${APACHE_LOG_DIR}/chamilo_access.log combined
</VirtualHost>
EOF'
Enable the site and rewrite module, then reload:
sudo a2ensite chamilo.conf sudo a2enmod rewrite sudo systemctl reload apache2
The rewrite module allows Chamilo to use clean URLs. The <Directory> block tells Apache it can follow symbolic links and that .htaccess files inside the site are allowed.
7. Let Apache know Chamilo’s config file is in place
Chamilo ships with a sample .env‑style file called config.php. Rename the placeholder:
sudo cp /var/www/chamilo/config/conf.php.example \
/var/www/chamilo/config/conf.php
Now edit it to point at your database:
sudo nano /var/www/chamilo/config/conf.php
Change:
define ('DB_HOST', 'localhost');
define ('DB_NAME', 'chamilo');
define ('DB_USER', 'chamilo');
define ('DB_PASS', 'StrongPass!23');
Chamilo will try to connect using the values you set. If they’re wrong, the installer page will error out with a vague “Database not reachable” message.
8. Run the web installer
Open a browser and go to http://chamilo.example.com. You should see Chamilo’s installation wizard. Fill in:
- Site title
- Admin email / password
- Database details (host, name, user, password)
Click “Install”. On success you’ll be taken to the admin login.
Common hiccup:
I’ve seen users hit a “Permission denied” page after installing on a fresh VM because DocumentRoot wasn’t writable by Apache. The fix was always the chown/chmod steps above.
9. Tighten up security
Once installed, consider:
sudo ufw allow 'Apache Full' sudo ufw enable
You’re exposing port 80/443 to the world; a firewall is non‑negotiable.
Also set PHP’s display_errors to Off in /etc/php/7.4/apache2/php.ini, then reload Apache:
sudo sed -i 's/display_errors = On/display_errors = Off/' /etc/php/7.4/apache2/php.ini sudo systemctl reload apache2
Leaving error details exposed can give away your stack to a curious attacker.
10. Log in and start building
Navigate to http://chamilo.example.com/admin with the admin credentials you set. From there you can create courses, users, and configure themes. If anything feels sluggish, check Apache’s error log (/var/log/apache2/chamilo_error.log) – it usually points right at the culprit.
Quick sanity check
- Database connection? mysql -u chamilo -pStrongPass!23 chamilo -e "SELECT 1;" should return 1.
- Apache serving files? curl -I http://localhost | grep Status should say HTTP/1.1 200 OK.
- Chamilo UI? The login page should show the logo and a “Login” button.
If those three pass, you’ve got Chamilo running on Ubuntu 20.04.