I saw a Ghost!
Ghost is a blog engine I discovered a few days ago. It’s light, fast and very easy to configure and maintain. It’s totally content oriented and everything is done for a good readability on a phone, tablet or desktop computer.
In my opinion, it’s everything you could ask for in a blog.
Technically Ghost is based on NodeJS which means it’s incredibly fast. Forget all the heavy blog solutions like WordPress. Ghost has everything you need to display your content in simple and accurate ways.
As for the blog data, it’s stored in a sqlite3 database.
Here is the installation procedure is for Debian Wheezy. If you don’t know your Linux distribution, you can type this in a terminal to find out:
You can follow this installation guide for both production and development mode.
First things first: create a new user
If you have a user who can run Ghost (everybody except the root user), connect to your server terminal with it and jump to the next step.
If not, you have to create a new user. Type these lines in your command prompt:
useradd <username> -d /home/<username> -G sudo passwd <username>
The first line will create a new user (with its own home directory and add it to the group of sudo users) and the second will set its password.
Let’s connect with it. Type :
Go to your web root directory. By default, it’s
var/www/ but it’s not recommended to use this path for Ghost or any other website.
Installing nodeJs and sqlite 3
To find out if nodeJs is installed on your server, type this in the terminal:
If it’s installed, It’ll show you which version of nodeJs you have. Note that you can do the same thing for many other programs.
Your version of nodeJs must be higher than 0.10.*
If it’s not installed, use these commands to get it:
sudo apt-get install python g++ make checkinstall fakeroot src=$(mktemp -d) && cd $src wget -N http://nodejs.org/dist/node-latest.tar.gz tar xzvf node-latest.tar.gz && cd node-v* ./configure sudo fakeroot checkinstall -y --install=no --pkgversion $(echo $(pwd) |sed -n -re's/.+node-v(.+)$/\1/p') make -j$(($(nproc)+1)) install sudo dpkg -i node_*
Since we’re installing NodeJs from source, we have to compile it. This might take a few minutes.
node -v to make sure that everything is fine.
In order to install sqlite3, you have to get it via aptitude and then install the node module:
sudo apt-get sqlite3 sudo npm install -g sqlite3
Getting the last version of Ghost
Create a folder for your new blog and give the user permission to access it:
mkdir <foldername> sudo chown <username>:www-data <foldername> cd <foldername>
Now that you have your root folder for Ghost, we’ll use git to pull it.
Git is a very popular version control system. To find out if it’s installed on your server, you know now what you have to do :
In order to install it, you have to type this in the console:
sudo apt-get update sudo apt-get install git
Then, to get the latest version of Ghost, just type:
git clone https://github.com/TryGhost/Ghost.git .
You are now on the master branch of the Ghost project. Be careful: this is a version that’s still in development and is not the same as the stable version. Using the development version on a production server is out of the question. If you don’t plan to participate in the development of Ghost itself, you should use the last stable version even on a development server.
Let’s checkout the stable version of Ghost. To do so, use:
git checkout stable
To install all the NodeJs module’s dependencies, use this command:
Ok I’m grunting…
Ghost uses it so we have to install it. Type in your console:
sudo npm install -g grunt-cli
npm stands for Node Package Manager: it was installed with node. With this tool, we can install a node module like grunt. We have two different ways to do it: we can install the module locally or globally.
When you use
npm for a local install, it will be put in the project’s node_modules folder. Here we are performing a global install (the option
-g means globally).
When it’s done just type:
grunt init grunt prod
All right. If you haven’t gotten any error, let’s move forward.
Editing the config.js
Use nano or another text editor to edit the config.js file:
You have to change the example domain
http://my-ghost-blog.com with your domain name.
Change it for both development and production.
As you can see in this file, the output port for Ghost is 2368, and to put your blog online we need port 80.
Apache already uses port 80 and if you have it installed on your server, you have to add an apache vhost.
Note that you can use
nginx instead of apache.
Creating an apache vhost
/etc/apache2/sites-available to create a vhost (just create a text file) and enter the following:
<VirtualHost *:80> ServerName <blog_domain> ServerAlias www.<blog_domain> ProxyPass / http://127.0.0.1:2368/ ProxyPassReverse / http://127.0.0.1:2368/ ProxyPreserveHost On </VirtualHost>
Obviously, you have to replace < blog_domain > with the domain of your blog.
To activate the vhost (create a symbolic link) type:
sudo a2ensite <vhost_name>
Now edit the file
/etc/apache2/sites-available/default and add the following:
<DirectoryMatch <ghost_path> > Order allow,deny Deny from all </DirectoryMatch>
We have to restart apache by typing
sudo service apache2 restart
Now you’re all set to run Ghost… but the instance will shut down if you quit your console prompt and then your site won’t be online.
To deal with this, you have to install a process manager, like
pm2, which will manage nodeJs processes:
sudo npm install pm2 -g
With this tool, we can run Ghost. Type:
NODE_ENV=production pm2 start index.js --name "Ghost"
In order to stop, restart or reload (restart without downtime) the Ghost process, you can type:
pm2 stop Ghost pm2 restart Ghost pm2 reload Ghost
Go to your Ghost domain : your blog is online !
I want an admin user!
Now, we can create a user who will have access to the backend.
Go to the url
http://< ghost_domain >/ghost/signin/ and enter your information.
You are now ready to start using the clean Ghost admin and its nice WYSIWYG editor!
Ghost’s Markdown editor
Some other tricks
- To uninstall nodeJs you have to type :
sudo dpkg -r node
Be careful though : it won’t uninstall any modules that were installed via
bash npm (local or global).
- You can find free themes for Ghost at this address:
I want more!
You can go to the following website if you want to learn more about Ghost:
Ghost related websites:
Ghost on apache:
In a nutshell
Obviously if there are any errors, problems or if you have any advice, please leave a comment !