How To Install Contao on Ubuntu 20.04 LTS

Install Contao on Ubuntu 20.04

In this tutorial, we will show you how to install Contao on Ubuntu 20.04 LTS. For those of you who didn’t know, Contao’s is an open-source content management system (CMS). It is designed for ease of use to allow business owners and power users to create powerful and dynamic content websites. Contao can also be integrated into a regular Symfony application.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of Contao CMS on Ubuntu 20.04 (Focal Fossa). You can follow the same instructions for Ubuntu 18.04, 16.04, and any other Debian-based distribution like Linux Mint.

Prerequisites

  • A server running one of the following operating systems: Ubuntu 20.04, 18.04, and any other Debian-based distribution like Linux Mint or elementary OS.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • A non-root sudo useror access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

Install Contao on Ubuntu 20.04 LTS Focal Fossa

Step 1. First, make sure that all your system packages are up-to-date by running the following apt commands in the terminal.

sudo apt update
sudo apt upgrade

Step 2. Installing the LAMP stack.

A Ubuntu 20.04 LAMP server is required. If you do not have LAMP installed, you can follow our guide here.

Step 3. Installing Composer.

Run the following command below to install Composer to your system:

sudo curl -sS https://getcomposer.org/installer -o composer-setup.php
sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer

Verify and check the Composer version:

composer -V

Step 4. Configuring MariaDB.

By default, MariaDB is not hardened. You can secure MariaDB using the mysql_secure_installation script. you should read and below each step carefully which will set a root password, remove anonymous users, disallow remote root login, and remove the test database and access to secure MariaDB:

mysql_secure_installation

Configure it like this:

- Set root password? [Y/n] y
- 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

Next, we will need to log in to the MariaDB console and create a database for the PrestaShop. Run the following command:

mysql -u root -p

This will prompt you for a password, so enter your MariaDB root password and hit Enter. Once you are logged in to your database server you need to create a database for PrestaShop installation:

CREATE DATABASE contaodb;
CREATE USER 'contaouser'@'localhost' IDENTIFIED BY 'Your-Strong-Passwd';
GRANT ALL PRIVILEGES ON `contaodb`.* TO 'contaouser'@'localhost';
FLUSH PRIVILEGES;

Step 5. Installing Contao on Ubuntu 20.04.

Now we install Contao using Contao Manager, First, let’s enter /var/www/html/your-domain.com/web:

mkdir -p /var/www/html/your-domian.com/web
cd /var/www/html/your-domian.com/web
sudo -u www-data wget https://download.contao.org/contao-manager/stable/contao-manager.phar -O contao-manager.phar.php

Step 6. Accessing Contao Web Interface.

Once successfully installed, open up your favorite browser and navigate to http://your-domian.com in the address bar. You will see a login page as shown below:

Install Contao on Ubuntu 20.04 LTS Focal Fossa

Congratulations! You have successfully installed Contao. Thanks for using this tutorial for installing Contao’s open source content management system (CMS)  on Ubuntu 20.04 LTS Focal Fossa system. For additional help or useful information, we recommend you to check the official Contao website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!