How To Install Bolt CMS on Centos 7

Install Bolt CMS on Centos 7

In this tutorial, we will show you how to install Bolt CMS on your CentOS 7 server. For those of you who didn’t know, Bolt CMS is a lightweight open source Content Management Tool, written in PHP and it’s built upon the Silex frame.

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 accge of Linount, 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 Bolt CMS on a CentOS 7 server.

Install Bolt CMS on Centos 7

Step 1. First, let’s start by ensuring your system is up-to-date.

yum clean all
yum -y update

Step 2. Install LEMP server.

A CentOS 7 LEMP stack server is required. If you do not have LEMP installed, you can follow our guide here. Also, install the required PHP modules:

yum install php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-mssql php-snmp php-soap php-tidy curl curl-devel

Step 3. Installing Composer.

Download and install Composer by executing the following command:

curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer

Step 4. Installing Bolt CMS.

Install Bolt CMS using the “composer create-project” command:

composer create-project bolt/composer-install:^3.3 /var/www/boltchedelics --prefer-dist

The installer will ask you if you want to use Bolt’s standard folder structure. Choose “yes” and proceed with the installation.

By default, Bolt is configured to use an SQLite database, since we will be using a MySQL database we need to change the settings in app/config/config.yml file and enter the details of the database we created previously:

nano /var/www/boltchedelics/app/config/config.yml
# database:
# driver: sqlite
# databasename: bolt

database:
 driver: mysql
 username: bolt
 password: your_bolt_passwd
 databasename: bolt

We will need to change some folders permissions:

chown -R nginx: /var/www/boltchedelics
find /var/www/boltchedelics -type d -exec chmod 755 {} \;
find /var/www/boltchedelics -type f -exec chmod 644 {} \;

Step 5. Configure Nginx Web Server for Bolt CMS.

Create a new Nginx virtual host:

nano /etc/nginx/conf.d/boltchedelics.conf

Add the following lines:

server {
 listen 80;
 server_name boltchedelics;

root /var/www/boltchedelics/public;
 index index.php;

access_log /var/log/nginx/boltchedelics.access.log;
 error_log /var/log/nginx/boltchedelics.error.log;

location / {
 try_files $uri $uri/ /index.php?$query_string;
 }

location = /bolt {
 try_files $uri /index.php?$query_string;
 }

location ^~ /bolt/ {
 try_files $uri /index.php?$query_string;
 }
 
 location ^~ /thumbs {
 try_files $uri /index.php; #?$query_string;
 
 access_log off;
 log_not_found off;
 expires max;
 add_header Pragma public;
 add_header Cache-Control "public, mustrevalidate, proxy-revalidate";
 add_header X-Koala-Status sleeping;
 }
 
 location ~* ^.+\.(?:atom|bmp|bz2|css|doc|eot|exe|gif|gz|ico|jpe?g|jpeg|jpg|js|map|mid|midi|mp4|ogg|ogv|otf|png|ppt|rar|rtf|svg|svgz|tar|tgz|ttf|wav|woff|xls|zip)$ {
 access_log off;
 log_not_found off;
 expires max;
 add_header Pragma public;
 add_header Cache-Control "public, mustrevalidate, proxy-revalidate";
 add_header X-Koala-Status eating;
 }
 
 location = /(?:favicon.ico|robots.txt) {
 log_not_found off;
 access_log off;
 }

 location ~ /index.php/(.*) {
 rewrite ^/index.php/(.*) /$1 permanent;
 }

location ~ /\. {
 deny all;
 }
 
 location ~ /\.(htaccess|htpasswd)$ {
 deny all;
 }
 
 location ~ /\.(?:db)$ {
 deny all;
 }
 
 location ~* /(.*)\.(?:markdown|md|twig|yaml|yml)$ {
 deny all;
 }

location ~ [^/]\.php(/|$) {
 try_files /index.php =404;
 
 fastcgi_split_path_info ^(.+?\.php)(/.*)$;
 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
 fastcgi_param HTTP_PROXY "";
 fastcgi_param HTTPS $https if_not_empty;
 fastcgi_pass 127.0.0.1:9000;
 include fastcgi_params;
 }

}

Save and close the file. Restart the Apache service for the changes to take effects:

nginx -t
systemctl restart nginx

Step 6. Accessing Bolt CMS.

Bolt CMS will be available on HTTP port 80 by default. Open your favorite browser and navigate to http://your-domain.com/ or http://server-ip and register your first user. Administrative access is automatically granted to the first registered user.

Congratulations! You have successfully installed Bolt CMS. Thanks for using this tutorial for installing Bolt CMS on CentOS 7 systems. For additional help or useful information, we recommend you to check the official Bolt CMS website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!