In this tutorial, we will show you how to install Bolt CMS on Ubuntu 20.04 LTS. For those of you who didn’t know, Bolt CMS is a lightweight open source content management tool, written in PHP. It is designed for ease of use and helps you to create powerful and dynamic content websites easily. It is built on Silex microframework and is a great alternative for those looking for a modern PHP system. It is created using modern open-source libraries and is best suited to build sites in HTML5 with modern markup.
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 through the step-by-step installation of the Bolt Content Management System (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.
Install Bolt CMS 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. Configuring MariaDB for Bolt CMS.
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:
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 Bolt. 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 Bolt installation:
CREATE DATABASE boltdb; CREATE USER 'bolt'@'localhost' IDENTIFIED BY 'your-stronge-password'; GRANT ALL ON boltdb.* TO 'bolt'@'localhost'; FLUSH PRIVILEGES; EXIT;
Step 4. Installing Bolt CMS on Ubuntu 20.04.
Now we download the latest version of Bolt CMS from the Git repository:
cd /var/www/html git clone https://github.com/bolt/bolt.git
Next, change the directory to bolt and copy the sample config file:
cd bolt cp app/config/config.yml.dist app/config/config.yml
After copying the file, edit it with the help of your favorite editor:
sudo nano app/config/config.yml
Add the following line:
database: driver: mysql username: idrootuser password: your-password databasename: boltdb host: localhost prefix: prefix_
Then, run the following commands to install the composer on your system as it is a dependency manager for PHP:
sudo wget -O composer-setup.php https://getcomposer.org/installer sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer
Next, install the required PHP dependencies for Bolt CMS with the following command:
sudo composer install
We will need to change some folders permissions:
sudo chown -R www-data:www-data /var/www/html/bolt sudo chmod -R 755 /var/www/html/bolt
Step 5. Configure Apache.
Now we create a new virtual host directive in Apache. For example, create a new Apache configuration file named ‘
bold.conf’ on your virtual server:
touch /etc/apache2/sites-available/bold.conf ln -s /etc/apache2/sites-available/bold.conf /etc/apache2/sites-enabled/bold.conf nano /etc/apache2/sites-available/bold.conf
Add the following lines:
<VirtualHost *:80> ServerAdmin [email protected] DocumentRoot /var/www/html/bolt/ ServerName your-domain.com ServerAlias www.your-domain.com <Directory /var/www/html/bolt/> Options FollowSymLinks AllowOverride All Order allow,deny allow from all </Directory> ErrorLog /var/log/apache2/your-domain.com-error_log CustomLog /var/log/apache2/your-domain.com-access_log common </VirtualHost>
Now, we can restart the Apache webserver so that the changes take place:
sudo a2enmod rewrite sudo a2ensite bold.conf sudo systemctl restart apache2.service
Step 6. Set up HTTPS.
We should enable a secure HTTPS connection on Bold. We can obtain a free TLS certificate from Let’s Encrypt. Install Let’s Encrypt client (certbot) from Ubuntu 20.04 repository:
sudo apt install certbot python3-certbot-apache
Next, run the following command to obtain a free TLS certificate using the Apache plugin:
sudo certbot --apache --agree-tos --redirect --staple-ocsp --email [email protected] -d example.com
If the test is successful, reload Apache for the change to take effect:
sudo apache2ctl -t sudo systemctl reload apache2
Step 7. Configure Firewall.
In case, you enabled firewall and firewall block requests of the apache web server, open a port in the firewall:
sudo ufw allow 80/tcp sudo ufw allow 443/tcp sudo ufw reload
Step 8. Accessing Bolt CMS Web Interface.
Once successfully installed, now open your web browser and type the URL
https://your-domain.com. You will be redirected to the following page:
Congratulations! You have successfully installed Bolt. Thanks for using this tutorial for installing the Bolt 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 Bolt CMS website.