Easy installation of Ghost Blog
By Fahad Ahammed
- 4 minutes read - 737 words“Ghost Blog” is a blogging platform. Just blog. If you are into blogging and sharing your thoughts and nothing else, then you will definitely looking for this one. Very lightweight and super stylish with simplicity look. It is a platform where you will be motivated to write. But it is tricky to install. I will make it simple here.
Ubuntu 12.04.4 LTS is my VPS which i am using to show you how to install easily. We will do install nodejs , nginx , mysql etc.
Step:1 NodeJS
Add nodejs repository and install it.
Now check if it is really installed or not.
Step:02 Installation of Ghost
Check or install Curl
Now use below code to download the ghost archive file to install.
We need to extract to a folder which is familiar to you. I will use /var/www/
Then go into the ghost folder
To install Ghost type: (Note 2 Dashes before production)
Above command is very very important when you transfer ghost blog to another vps.
Now we need to check if it starts or not.
If starts , you can now just ctrl+c to terminate. Terminate it.
You can start ghost as production too.
Now we need to edit config file. That file should be in /var/www/ghost/
Now find // ### Production. This is the start of Production based configuration. Also find // Developers only need to edit below here and above this line end of Production based configuration. I am helping you what to keep there and add too.
Above is a good configuration. First red marked domain is the domain by which you want to use your ghost blog. Change it to yours. Second red marked text is for mysql database. You have to create it by terminal or phpmyadmin. Use localhost if you are in same machine where your ghost is. change mysql database user , password , database according to yours. Then the red marked IP , you have to edit it to your VPS/server IP address. and change the red marked port as your wish.
Save it.
Step:03 Init Script (One Way)
Linux systems use init scripts to run on system boot. These scripts exist in /etc/init.d. To make Ghost run forever and even survive a reboot you could set up an init script to accomplish that task. The following example will work on Ubuntu and was tested on Ubuntu 12.04.
Create the file /etc/init.d/ghost with the following command:
Open the file with nano /etc/init.d/ghost
and check the following:
Change the GHOST_ROOT
variable to the path where you installed Ghost
Check if the DAEMON
variable is the same as the output of which node
The Init script runs with it’s own Ghost user and group on your system, let’s create them with the following:
Let’s also make sure the Ghost user can access the installation:
Change the execution permission for the init script by typing
Now you can control Ghost with the following commands:
To start Ghost on system start the newly created init script has to be registered for start up. Type the following two commands in command line:
Let’s make sure your user can change files, config.js for example in the Ghost directory, by assigning you to the ghost group: sudo adduser USERNAME ghost
If you now restart your server Ghost should already be running for you.
Step:03 Init Script (Another Way)
Create a blank file as ghost.conf in /etc/init/ folder.
Now edit that file by nano and put below code.
And save that file. Now you can start and stop the service by simply running below command.
This will also act as an auto start configuration file when reboot the server.
Step:04 Run With Apache Virtual Host
Let you want to use Ghost blog by http://domain.com , you need to create a vhost file in /etc/apache2/sites-available/
Paste below codes.
Change your server/vps ip and port according to your ghost config. Also change the domain name. This is a reverse proxy config. We need to ensure if it is enabled or not.
Now enable the vhost file.
Restart apache.
Start Ghost
and you are good to go.
External Post:
I have showed you how to install ghost with Apache server. But Apache is heavy and you can’t just rely on it for huge traffic and if you rely it will be very costly. You can run a ghost blog and handle almost huge traffic by a 128mb vps.