An easy to follow guide to install Ghost blogging platform on your HostGator VPS or Dedicated hosting account.
Just like WordPress, Ghost blogging platform is also available to be installed self-hosted on a separate web hosting account. The thing that may bother people who wish to do so on their shared hosting account is Node.js.
Why Ghost can’t be installed on Shared Hosting?
Ghost runs on Node.js, and you’ll need root access with some base capabilities to install it and the other required sub-packages. With Shared Hosting, you do not get such facilities generally. The only way is to upgrade your hosting plan to VPS or Dedicated hosting, and then you’ll be able to install Ghost on it.
This guide is about installing Ghost on HostGator VPR or Dedicated hosting, both of them provide access to root shell, so the only thing needed is shell commands. Lets get started.
Launch Ghost on HostGator VPS
Before proceeding to the tutorial, you should also have a see at this deployment document where the installation for some hosting providers has been explained.
If you’re not sure how to use SSH, this guide may help you a lot.
Note: You should consult HostGator support or a VPS specialist if you don’t know anything about a VPS.
Assuming you have a VPS or dedicated HostGator hosting account, connect to the HostGator server via SSH with your username, password, and IP address. The following command is generally used in the SSH terminal to do so:
username to your VPS username, and
your.server.ip.address to your VPS IP address. Now, after typing the command in the terminal and hitting enter, it will ask you to input your password. Enter your password to log in.
Prepare the server for the new installation by using these commands:
sudo yum update sudo yum upgrade sudo yum groupinstall "Development Tools"
Installing Node.js via SSH
We’ll call the Node.js repository by making use of the below commands to install it on our server:
wget http://nodejs.org/dist/node-latest.tar.gz tar -zxvf [node-version.tar.gz] cd node-v0.10.18 ./configure make sudo make install
Below SSH commands will download Ghost in your VPS straight from the official repository of the platform:
sudo mkdir -p /var/www/ cd /var/www/ wget https://ghost.org/zip/ghost-latest.zip unzip -d ghost [Name-of-Ghost-zip].zip
There are chances of getting the error Unable to unzip file after the above step. The error reflected in the SSH terminal looks like below:
End-of-central-directory signature not found. Either this file is not a zipfile, or it constitutes one disk of a multi-part archive. In the latter case the central directory and zipfile comment will be found on the last disk(s) of this archive. …
The problem here is with the
wget command, which can’t be able to get or unzip the ZIP archive from the Ghost servers. In such a case, you need not to worry but download the Ghost on your computer locally, and then upload it to your VPS by using the below command:
scp /path/to/ghost-0.3.0.zip firstname.lastname@example.org:/path/to/place/the/zip
Now we are ready to install Ghost on our VPS. Use the below commands will install in the SSH terminal:
cd ghost sudo /usr/local/bin/npm install --production
Voila! You’ve successfully installed Ghost!
Now comes the configuring part
cp config.example.js config.js sudo vi config.js
Now head over to the Production section in Ghost, and look for the code:
host: '127.0.0.1', port: '2369'
We need to add our own server IP in place of the local IP (127.0.0.1) and port 80 in place of 2369 (or 2368). So the above code will now become:
host: 'your.server.ip.address', port: '80'
You won’t need Apache that comes as an already installed product with HostGator hosting. So better stop it and remove using below commands:
/usr/sbin/httpd -k stop rm -rf /usr/local/apache
Finally, use this command to start the Ghost platform:
sudo /usr/local/bin/npm start --production
That’s it! Set up a custom domain and you are ready to go blogging on Ghost.