You can support us by downloading this article as PDF from the Link below. Download the guide as PDF

Bolt is a lightweight content management system based on PHP. It is build from the beginning on Silex microftamework which makes it easy to start working on small applications. Bolt provides a good alternative for developers looking for a modern PHP system in place on WordPress. In this blog post we will be performing an installation of Bolt CMS with MySQL on Ubuntu 20.04.

Cool features of Bolt CMS

  • Clean architecture built with Silex, very easy to learn
  • Standard components for Forms and Database
  • Clean purpose, not trying to solve every problem

First update and upgrade your server before installations

sudo apt-get -y update
sudo apt-get -y upgrade

Also Set your timezone with the below command

sudo dpkg-reconfigure tzdata

Reboot your system after updates

sudo reboot

Install required packages

The below packages are required for the installation of Bolt, run the below command to install them:

sudo apt install -y curl wget vim git unzip socat bash-completion apt-transport-https

Install PHP on Ubuntu

Here, we are going to install PHP 7.2 and some of the required modules. We’ll add ppa:ondrej/php PPA repository which has the build packages of PHP.

sudo apt -y install software-properties-common 
sudo add-apt-repository ppa:ondrej/php 
sudo apt-get update

Install php 7.2 and its required modules

sudo apt install -y 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

Install Nginx on Ubuntu

Run the below command to install Nginx on Ubuntu 20.04 server machine.

sudo apt-get install nginx

Start and enable Nginx with the following commands:

sudo systemctl start nginx
sudo systemctl enable nginx

Install MySQL and Create a Database for Bolt

sudo apt -y install mysql-server
sudo systemctl start mysql
sudo systemctl enable mysql 

Secure mysql installation

$ sudo mysql_secure_istallation
Would you like to setup VALIDATE PASSWORD plugin? N 
New password: your_secure_password 
Re-enter new password: your_secure_password 
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

Connect to mysql to create a database for Bolt

sudo mysql -u root -p 

Enter root password created above. Once connected, run the following commands to create a database and database user.

CREATE DATABASE bolt;
CREATE USER 'bolt'@'localhost' IDENTIFIED BY 'mypassword';
GRANT ALL ON bolt.* TO 'bolt'@'localhost'; 
mysql> FLUSH PRIVILEGES; 
mysql> exit

Configure Nginx for Bolt CMS

Create a file called bolt.conf in nginx path as shown.

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

Add the following content into the created file

server { 
   listen 80; 
   listen [::]:80; 
   root /var/www/bolt; 
   index  index.php index.html index.htm; 
   server_name  bolt.example.com; 

   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; 
  } 

}

Enable the created website by creating a simlink as shown:

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

Check nginx configiration and restart nginx

$ sudo nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
$ sudo systemctl restart nginx

Download Bolt CMS on Ubuntu 20.04

Change to your root directory

cd /var/www/

Now download the latest version of Bolt CMS from github with the below command:

sudo git clone https://github.com/bolt/bolt.git

Once downloaded, you should see a directory named ‘bolt’. Change to the directory and install bolt

cd bolt
sudo composer install

Set up Bolt permissions

Bolt directory should be owned by nginx.

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

Configure bolt configuration file

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

Now open Bolt from your browser to continue with the installations: http://bolt.example.com/. You should get a page as below. Fill the requirements to create a user.

Once you submit the user settings, you should be taken to a page as shown

You should be done with installation. To access Bolt CMS admin, append Bolt on your url: http://bolt.example.com/bolt. Enjoy working with Bolt CMS! Remember, below are more interesting guides!!

You can support us by downloading this article as PDF from the Link below. Download the guide as PDF

LEAVE A REPLY

Please enter your comment!
Please enter your name here