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|18.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
Step 1: Update Ubuntu System
First update and upgrade your server before installations
sudo apt -y update
sudo apt -y upgrade
Also Set your timezone with the below command
sudo dpkg-reconfigure tzdata
Reboot your system after updates
sudo reboot
Step 2: 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.x and some of the required modules.
sudo apt install -y php php-cli php-fpm php-common php-mbstring php-zip php-pgsql php-sqlite3 php-curl php-gd php-mysql php-intl php-json php-opcache php-xml
Install Nginx on Ubuntu
Run the below command to install Nginx on Ubuntu 20.04 server machine.
sudo apt 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
Run the commands below to install MySQL database server:
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
Step 3: 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/php-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
Step 4: Download Bolt CMS on Ubuntu
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!!