13.6 C
Texas

How To Install Bolt CMS On Ubuntu 20.04

Today we are going to learn that how to install bolt CMS with Nginx on Ubuntu 20.04. Bolt CMS(Content Management System) is an open source used to design & develop powerful & dynamic websites. Bolt is based on PHP & it is built on Silex microframework. It is great alternative for those developeres who are looking for a modern PHP system. So, here we’ll go through with the steps that can be taken to install bolt CMS on Ubuntu 20.04.

Step 1: Update Your System

As usual we do, first of all update your system to have the latest packages installed.

sudo apt update -y
sudo apt upgrade -y

Once, updated, reboot your system by typing

- Advertisement -
sudo reboot

Step 2: Install LEMP Server On Ubuntu 20.04

First of all, hit the below commands to install Nginx & MariaDB Server on Ubuntu 20.04.

sudo apt install nginx mariadb-server -y

After installing the above packages, you’ve to install PHP 7.2 to suit the requirements of Bolt CMS. Ubuntu repositories provides the latest PHP version but you’v to download the PHP 7.2 manually. For this add the below reposiotry.

sudo add-apt-repository ppa:ondrej/php

Once added, hit the below commands to install the PHP 7.2 on your system.

sudo apt update -y
sudo apt install php7.2 php7.2-cli php7.2-fpm php7.2-common php7.2-mbstring php7.2-zip php7.2-pgsql php7.2-sqlite3 php7.2-curl php7.2-gd php7.2-mysql php7.2-intl php7.2-json php7.2-opcache php7.2-xml -y

Make sure to verify that all packages are installed successfully. Then move towards the next step.

Step 3: Create A Database For Bolt CMS

Now, it’s time to create a database for bolt CMS. Hit the below commands to login to the MariaDB by typing

sudo mysql

After the login, hit the below commands to create a new database.

CREATE DATABASE boltdb;
CREATE USER 'bolt'@'localhost' IDENTIFIED BY 'password';
GRANT ALL ON boltdb.* TO 'bolt'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Step 4: Downloading Bolt CMS on Ubuntu 20.04

Switch to the /var/www/html/ directory & clone the latest version of bolt CMS using git.

cd /var/www/html
sudo git clone https://github.com/bolt/bolt.git

When the download finished, switch to the bolt directory.

cd bolt

And then hit the below command to copy the sample configuration file.

sudo cp app/config/config.yml.dist app/config/config.yml

After copying the file, edit it with the help of your favourite editor.

sudo nano app/config/config.yml

Then delete the default sqlite DB line & add the below lines.

database:
driver: mysql
username: osradaruser
password: password
databasename: osradardb
host: localhost
prefix: prefix_

Once done, save the file & exit.

Then, hit the below 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

You’ll see the similar output when composer is installed.

sabi@Ubuntu20:/var/www/html/bolt$ sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer
 All settings correct for using Composer
 Downloading…
 Composer (version 2.0.8) successfully installed to: /usr/local/bin/composer
 Use it: php /usr/local/bin/composer

Then hit the following command to install the required dependencies.

sudo composer install

Now, give proper permissions to the bolt directory.

sudo chown -R www-data:www-data /var/www/html/bolt
sudo chmod -R 755 /var/www/html/bolt

Step 5: Configuring Nginx For Bolt On Ubuntu 20.04

Now, it’s time to configure the Nginx for bolt CMS on Ubuntu 20.04. Edit the bolt.conf file by typing.

sudo nano /etc/nginx/sites-available/bolt.conf

And then add the below content into the file.

server {
listen 80;
root /var/www/html/bolt;
index index.php index.html index.htm;
server_name localhost;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ [^/].php(/|$) {
try_files /index.php =404;
fastcgi_split_path_info ^(.+.php)(/.+)$;
fastcgi_index index.php;
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
include fastcgi_params;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
location = /bolt {
try_files $uri /index.php?$query_string;
}
location ^~ /bolt/ {
try_files $uri /index.php?$query_string;
}
}

Next, save & close the file & link the file with nginx.

sudo ln -s /etc/nginx/sites-available/bolt.conf /etc/nginx/sites-enabled/bolt.conf

Check the nginx syntax.

nginx -t

If everything ok, you’ll see the success message.

And finally, restart the nginx.

sudo systemctl restart nginx

Step 6: Accessing Bolt CMS on Ubuntu 20.04

After updating all the configuration, it’s time to access the bolt CMS. Type bolt.example.com or http://localhost:80 in your favourite browser to access bolt CMS. You’ll see the similar page as seen below:

Note: Replace the bolt.example.com with your domain name.

Fill the required details & press on “Create the first user” button. You’ll see the Bolt CMS dashboard.

Step 7: Secure Bolt CMS with Let’s Encrypt SSL on Ubuntu 20.04

For security reasons, it is recommended to use the SSL certificates. For this purposes, we’ll use Let’s Encrypt to install the SSL over bolt CMS. To install the certs, hit the below commands.

sudo apt install python3-certbot-nginx -y

And then hit the given command to install SSL for your site.

certbot --nginx -d bolt.example.com

Fill the required fields to finish installing SSL.

So, this is how you can install bolt CMS on Ubuntu 20.04

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

LEAVE A REPLY

Please enter your comment!
Please enter your name here



Latest article