How to set up Bolt CMS with MySQL on Ubuntu 20.04

You can download this article in PDF format via the link below to support us.Download the guide in PDF formatClose

Bolt is a lightweight content management system based on PHP. It is built from Silex microftamework, which makes it easy to start working on small applications. Bolt provides a good choice for developers looking for a modern PHP system on WordPress. In this blog post, we will perform Bolt CMS installation 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 databases
  • Purpose of cleaning, not trying to solve all problems

Update and upgrade the server before installation

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

Also, use the following command to set your time zone

sudo dpkg-reconfigure tzdata

Restart the system after updating

sudo reboot

Install the required packages

The following packages are required to install Bolt, please run the following command to install:

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

Install PHP on Ubuntu

Here, we will install PHP 7.2 and some necessary modules. We will add ppa:ondrej/php PPA repository, which contains the build package for 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 following command to install Nginx on the Ubuntu 20.04 server computer.

sudo apt-get install nginx

Start and enable Nginx with the following command:

sudo systemctl start nginx
sudo systemctl enable nginx

Install MySQL and create a bolt database

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 the root password created above. After connecting, run the following commands to create the 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

As shown in the figure, create a file named bolt.conf in the nginx path.

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

Add the following to 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 simlink, as shown below:

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

Check nginx configuration 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

Go to your root directory

cd /var/www/

Now, download the latest version of Bolt CMS from github using the following command:

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

After downloading, you should see a file called “bolt‘.Go to the catalog and install bolts

cd bolt
sudo composer install

Set bolt permissions

The Bolt directory should be owned by Nginx.

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

Configure bolt profile

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

Now open Bolt from the browser to continue the installation: http://bolt.example.com/. You should get the following page. Meet the requirements to create users.

After submitting the user settings, you should go to the page as shown

How to set up Bolt CMS with MySQL on Ubuntu 20.04

You should complete the installation. To access the Bolt CMS administrator, please append Bolt to your URL: http://bolt.example.com/bolt. Enjoy the fun of working with Bolt CMS! Remember, here are more interesting guides!

  • Use Drush command line shell to manage Drupal CMS
  • Install and configure October CMS on CentOS
  • Install October CMS on Ubuntu/Debian
  • Install and configure Drupal CMS on CentOS
  • How to install Ghost CMS on Ubuntu

You can download this article in PDF format via the link below to support us.Download the guide in PDF formatClose

Sidebar