We hope you find this tutorial helpful. In addition to guides like this one, we provide simple cloud infrastructure for developers. Learn more →

How To Install Bolt on a VPS Running Ubuntu 12.04

PostedOctober 24, 2013 10.8k views CMS Ubuntu

Status: Deprecated

This article covers a version of Ubuntu that is no longer supported. If you are currently operate a server running Ubuntu 12.04, we highly recommend upgrading or migrating to a supported version of Ubuntu:

Reason: Ubuntu 12.04 reached end of life (EOL) on April 28, 2017 and no longer receives security patches or updates. This guide is no longer maintained.

See Instead:
This guide might still be useful as a reference, but may not work on other Ubuntu releases. If available, we strongly recommend using a guide written for the version of Ubuntu you are using. You can use the search functionality at the top of the page to find a more recent version.

About Bolt

Bolt is an open source Content Management System (CMS) built in PHP that uses modern markup and libraries for outputting its pages. It is easy to configure and use and its target users are content editors, frontend designers and backend developers.

In this tutorial, we will see how to install Bolt on a VPS running Ubuntu 12.04 with the LAMP stack (Linux, Apache, MySQL and PHP) installed. If you need help setting up LAMP, check out this tutorial.

To work properly, Bolt requires PHP 5.3.2 or higher, a MySQL, SQLite or PostgreSQL database, and Apache or Nginx as a web server (these are the only two currently supported web servers Bolt can run on at the moment). There are also a couple of other settings and extensions that we will see during the installation and configuration phases.

Installation

There are a few ways you can install Bolt; however, since we have access to our server through the command line, this will be the utilized method. First, create a folder where you’d like Bolt installed and navigate in it:

cd /var/www
mkdir bolt
cd bolt

Now download the latest distribution of Bolt:

wget http://bolt.cm/distribution/bolt_latest.tgz

Then use the following command to untar the downloaded archive file:

tar -xzf bolt_latest.tgz

You can then go ahead and delete the archive file:

rm bolt_latest.tgz

Finally, you’ll need to set some permissions to some of the folders. Run the following command to take care of all of them in one big swoop:

chmod -R 777 files/ app/database/ app/cache/ app/config/ theme/

Configuration

By default, Bolt is set up to use an SQLite database. Let’s see how we can change this and have it use MySQL. First, create a database-- quickly jump into your MySQL command line and run the following command:

create database bolt;

For more information about using MySQL from your command line you can read this tutorial.

Now that we have our database (bolt), we need to configure our Bolt to use it. But right before that, navigate in your browser to where you installed the Bolt files: your-ip/bolt. Depending on whether or not you have the sqlite pdo extension, you should get an error.

Note: You have to make this browser request so that the configuration files get renamed properly. Now, we can edit the config file to specify our database and credentials:

nano app/config/config.yml

And replace the SQLite configuration with this one:

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

Save the file and exit. Now if you refresh the page in the browser, you should be directed to a page to set up your first user account. If you get an Apache error (404) it means that your .htaccess file directives are not overriding the Apache instructions and/or mod_rewrite is not enabled. So let’s quickly take care of that.

First, to check if mod_rewrite is already enabled, use the following command:

apache2ctl -M

If you see "rewrite_module" in the list, you are fine. If not, use the following command to enable the module:

a2enmod rewrite

Then edit the Apache default virtual host file and make sure that Allow Overrides is set to All under the /var/www directory. Edit the file with the following command:

nano /etc/apache2/sites-available/default

And where you see this block, make the changes to correspond to the following:

Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all

This will make sure that .htaccess files can override the default Apache instructions.

In order for any of these two changes to take effect, you’ll need to restart your Apache server. But for the sake of efficiency, let’s also install a couple of required PHP extensions that Bolt makes use of prior to restarting. Run the following commands for this:

sudo apt-get update
sudo apt-get install php5-gd
sudo apt-get install php5-curl

And now we can restart Apache:

sudo service apache2 restart

Accessing Bolt

If you refresh your browser again, you should be able to see the form for creating the first user account. You can go ahead and do so and then login with that information.

To access the site's home page, you have to go directly to its folder in the browser (your-ip/bolt) as that's where it resides. Some of the sample links may not work, as there hasn't been any content created to fill them.

If you were following this tutorial, you should be able to access the bolt dashboard at your-ip/bolt/bolt.

But what if you want the site to be available directly at your IP address which is set to point to your web server's root folder (/var/www)? You have three choices, One: you can move all the Bolt related files to this folder; Two: you can change the webserver's root directory to point to the /var/www/bolt folder instead of the default one; or Three: you can create a new virtual host with a specific domain name with that directory as its document root. The choice depends on your setup.

If you want to create a virtual host for a domain name, follow the instructions in this tutorial. But if you want to quickly change the default web server document root, open up again the file you edited before to allow the .htaccess overrides:

nano /etc/apache2/sites-available/default

And change this line from this:

DocumentRoot /var/www/

To this:

DocumentRoot /var/www/bolt/

Restart Apache:

sudo service apache2 restart

And you'll see that if you point your browser to the the IP, it should bring up your Bolt site directly.

Once these changes are in place, you can access the dashboard at your-ip/bolt.

Good luck building your site with Bolt.

Creative Commons License