Ghost - A Small Orange Installation Tutorial

HOSTING

Ghost - A Small Orange Installation Tutorial

A Small Orange is one of the few web hosting providers we know that support the Ghost Blogging Platform, due to its more demanding requirements (Node.js).

A Small Orange is the only host we know that supports Ghost in a Shared environment.  This allows you to setup a Ghost Blogging site for as little as $35, well less if you use our coupon

You can see a video of Ghost in action here. We also recommend you check out our full Review of the Ghost.org hosted platform here. Update:  A Small Orange now features a One Click Softaculous install.  We have left our detailed instructions below to demonstrate how retarded the installation process "used to be".  It demonstrates how the technology behind this new platform is evolving fast, and why now is the perfect opportunity to try out this "bad boy".

Step 1:  Log into cPanel and click the Ghost Installer

Ghost one click installer

Step 2: Click Install

Step 3: Fill out the details and click install

Note:  At the moment the install must be in the root directory, and there must not be an .htaccess file present (which there won't be if you just purchased a hosting plan).  Apart from that you will be setup in a few minutes for just $35 (or less with our coupon) 

Ghost installer

Our old article is set out below for your amusement

This article is intended to be a detailed step by step tutorial on how to setup the Ghost blogging platform within A Small Orange's shared hosting platform.  The tutorial looks more complex that it is, simply because we have documented each step with screenshots to make it very easy to follow. NB.  We have included instructions to setup Ghost using either the Command line, or the File Manager within cPanel.  Regardless of which you choose, you will still need to setup the SSH command line client for Step 7 of this tutorial.  We recommend people unfamiliar with the command line use the File Manager instructions.

1. Sign up to A Small Orange

There are step by step instructions on how to sign up to A Small Orange with the latest discount offer here.  Activation is usually instant, except if your account has been selected for manual review (which is rare).

2.  Activate SSH on your hosting account

The process to setup NodeJS and Ghost requires SSH access, and an SSH command line client.  Before you can use SSH it needs to be activated by A Small Orange Support. You can get SSH activated by opening a livechat at asmallorange.com (there is a tab at the left hand side of the screen to open live chat). All you need to do is ask for SSH to be activated.  They will most likely ask you to log into your A Small Orange Client area, and visit https://customers.asmallorange.com/requestsupportcode.php to request a support code to verify your identity.  A couple of minutes later support will have set everything up for you.

3. Configure Database

During the course of the tutorial you will need the settings for your database, so we will start by setting that up.

3.1 Log into cPanel

Your welcome mail will have the location of your control panel url (under Login Details).  It will be something like (although not necessarily the same):

  • Control Panel URL: https://trevor.asmallorange.com:2083/
  • Once your domain has propagated, you may also use https://www.yourdomain.com:2083/

Your User ID will also be show here, but there will be a message about your password as follows:

Password: We do not email cPanel passwords for security reasons. To set your cPanel password, please log in to the Client Area at https://customers.asmallorange.com/clientarea.php Once logged in, click on "Your Services - Manage your hosting packages" link. From here, click on "View Details" beside your new account, or the account you want to (re)set the password on. From this screen, select "Change Password" on the top menu, enter your preferred new password, and click "Save Changes." Your cPanel password is now set!

Make sure you follow those instructions to reset your password, so you can login to cPanel.

3.2 Create Database

The easiest way to create the database is to use the MySQL Database Wizard which will be in the Databases section of cPanel.  Click on the Wizard icon: 

cPanel database wizard

3.2.1 Create a Database:

Simply add the database suffix of your choice, and click "Next Step". 

create database

3.2.2 Create Database Users:

Complete the username suffix, and choose a password. 

Create user

3.3.3  Add User to the Database:

Simply tick "All Privileges" and click "next step" 

Add user to database

3.3.4 Complete the task:

That is it.  The database is all setup.  Make sure you make a note of the database name, user name, and password as they will be needed later.

4. Download and setup your SSH client

We asked A Small Orange Support for a recommended SSH terminal emulator, and was recommended Netsarang (for Windows).   To download this program go to http://www.netsarang.com/download/free_license.html.

xshell4

Select Xshell 4 above, and you will see instructions to install Xshell 4 on the following page.  Choose the appropriate licence.

4.1 Launch Xshell:

launch xshell

4.2 Click "New" in the toolbar (located under the File menu button)

download

4.3 Enter your Host Name

You will need to complete the "Host:" box.  This information will be located within your welcome email that you received after signing up with A Small Orange and will  be the Server name referred to in the email.  It will be something like "trevor.asmallorange.com".  Click OK, and you will get a Sessions box open: 

enter hostname

4.4 Create Session

Click on the New Session, and select "Connect".

4.5 Input username

Add your cPanel Username.  This will also be in your welcome email under the section "login details".

input username

 4.6 Input password

You should have already reset your password above.  You can enter it in Xshell 4 as per the screenshot below: 

Input password

4.7 Check you are logged in

What you should see is something like:

check logged in

Sometimes if you take to long, or input the wrong password you will get the following message in the session window "Connection closed by foreign host.".  If this occurs just go to "file" -> "reconnect" and re-enter your username and password as per above.  When we first did it we had a few problems as we forgot to reset the password as above.

5. Install Ghost

You can install Ghost onto your A Small Orange Server either by using the Command Line, or by using File Manager.  The instructions for both are set out below.

Using the Command Line

You will need to get a link to the latest version of Ghost, and you can find that here: https://ghost.org/download.  Simply right click the "Download Now" button and copy link location.  Make sure you update the link of the zip file (shown red) below with the latest version you just copied.  You will need to update "user" (shown red) with your cpanel user ID. With the terminal window open type the following commands:

cd home/user

mkdir ghost

cd ghost

wget --no-check-certificate https://ghost.org/zip/ghost-0.3.3.zip

unzip ghost-0.3.3.zip

rm -f ghost-0.3.3.zip

You may find that the first command in the list above provides an error, as you are already in the home directory.  The first 4 commands will look something like this (although in that screenshot we already had the ghost directory).

install ghost

Using File Manager

5.1 Log into File Manager

To do this task you will need to log into the cPanel.  Instructions for this are as per section 3.1 above.

5.2 Load "File Manager"

Click the File Manager option.

file manager

This will then load up a new dialogue box.  Make sure the "Web Root" is selected, as well as "Show Hidden Files" (you may need this later in the tutorial).

choose web root

Then click Go.

5.3 Install the Ghost files

5.3.1 Firstly, you need to go to https://ghost.org/download and download the latest version of Ghost.  You will see the download link as a big green button.  Right click this and save to your chosen location. 5.3.2 Navigate to your "home/user" directory in File Manager by clicking on that location in the left sidebar.  See screenshot below:

install ghost files

5.3.2 Make the "ghost" directory by clicking the "New Folder Link" in the top left. 

create new folder

Enter the new folder name "ghost" in the box that pops up as per the screenshot below.  Click "Create New Folder".

create ghost folder

5.3.2 You should then see the "ghost" Folder appear in the side menu.  Click the "ghost folder", and then select the Upload Button to upload the Ghost Zip file you downloaded previously.
upload

5.3.3 Click the Browse button on the next screen, and select the Ghost zip file you downloaded in step 5.3.1.

upload ghost files

The status of the upload will show in the bottom right hand corner after you select the file.  Once complete you can close that window, and return to the File Manager window (it should have opened in a new tab). 5.3.4 Click the "ghost" folder in the sidebar to see the uploaded file (see step 5.3.2 image pointing out the folder).  Then right click the ghost file, and select "Extract"

extract ghost files

5.3.5 Delete the ghost zip file.  As per the image above just right click the ghost zip file and select delete.

6. Configure Ghost with the Database settings

Using the command line can be a little daunting, so we have included two different ways of doing this.  One using the command line, the other using File Manager within cPanel.  The different instructions below:

Using the Command Line

With the terminal window open type the following commands:

cp config.example.js config.js

vi config.js

This will create the config.js, and open it.   Your screen should look something like this:

config.sys

You need to scroll down (using the arrow buttons on your keyboard) to find the following text:

production: {
url: 'http://my-ghost-blog.com',
mail: {},
database: {
client: 'sqlite3',
connection: {
filename: path.join(__dirname, '/content/data/ghost.db')
},
debug: false
},

Replace the red above with (NB. you should add your own database details as well as your intended blog web URL): p

production: {
url: 'http://my-ghost-blog.com',
mail: {},
database: {
client: 'mysql',
connection: {host: '127.0.0.1',
user: 'user_dbuser',
password: 'dbpassword',
database: 'user_dbname',
charset: 'utf8'
},
debug: false
},

Instructions on how to edit the config.js file

Using the command line can be a little daunting, but with just a few commands you can easily make the changes outlined above.  Once you have found the relevant details you can use the following commands

  • "i" - (press [i]) to allow you to insert edit the text

You can make the changes by doing normal editing, but to save the changes you should use:

  • "[esc] [esc] : w q" - (essentially you hit escape twice, then "colon", then "w", then" q")  This saves your changes, and then quits the editor.

If for some reason you make a mistake before saving, and you want to restart, simply do "[esc] [esc] : q !".  You can then do vi config.js to open the file again.  If for whatever reason you are completely stuck with this, simply open up a live chat with A Small Orange and they will be happy to help.  You may want to link this tutorial and tell them where abouts you are (their support helped troubleshoot the tutorial when we wrote it).

Using File Manager

This section assumes you are still logged into the File Manager, as per the earlier parts of this tutorial (see section 5.3 earlier) 6.1 Select the "Ghost" directory 6.2 Right click the "config.example.js" file and select rename. 

rename config.sys

6.3 Rename the file to config.js as per the screenshot below, and click "Rename File" 

rename config files

6.4 Open the "config.js" file by right clicking on it, and then select "code edit":

code edit file manager

6.5 Edit the config.sys file, like you would in say notepad.  Firstly find the information set out below.  You will need to alter the items highlighted in red: production:

production: {
url: 'http://my-ghost-blog.com',
mail: {},
database: {
client: 'sqlite3',
connection: {
filename: path.join(__dirname, '/content/data/ghost.db')
},
debug: false
},

Replace the red above with (NB. you should add your own database details as well as your intended blog web URL):

production: {
url: 'http://my-ghost-blog.com',
mail: {},
database: {
client: 'mysql',
connection: {host: '127.0.0.1',
user: 'user_dbuser',
password: 'dbpassword',
database: 'user_dbname',
charset: 'utf8'
},
debug: false
},

6.6 Save your changes by clicking the save changes button in the top right hand corner.  You can then close the window.

7. Install Ghost's Dependancies

This is the only place which you "have to" use the command line.  Luckily there are just a few commands that you will need to enter here if you have been using the File Manager method.

npm install mysql

Double check you are in the ghost directory by typing:

cd ghost

Install Ghost into production:

npm install --production

(note - you will see an error once it scrolls through the command.  Just ignore, as Sqlite is already available globally)

ln -s core/server.js app.js
mkdir tmp

You need to create a new file called .htaccess in the public directory and configure the .htaccess file.  There are two ways of doing this, through the command line, or via File Manager.  We have included instructions for both methods below:

Using the Command Line

You need to go to the home root directory by using the command  (make sure you replace the "user" part of the url (shown in red) with your cPanel user ID)

cd /home/user/public_html

You should now be in the main public directory.

vi .htaccess

Enter editor mode by pressing "i", then add the following content:

PassengerEnabled on
PassengerAppRoot /home/user/ghost
SetEnv NODE_ENV production
SetEnv NODE_PATH /usr/lib/node_modules 

Then press "[esc] [esc] :wq" (Escape key twice, then colon, w, q) to save the file, and quit the editor.  Make sure you replace "user" above (shown in red) with your cPanel ID.

Using File Manager

7.1 Make sure you are logged into File Manager. 7.2 Click the public_html folder, and you should see a .htaccess file. If you do not see it make sure you have selected to view hidden files when you first load up File Manager. If you still do not see it, simple click "New File" and create the file. Remember to add the "dot" at the beginning. You should see something like this:

htaccess

7.3 Right click the ".htacess" file and select "code edit" 7.4 Insert the following code below, and click "Save Changes" in the top right of the screen.  Then you are done.

PassengerEnabled on
PassengerAppRoot /home/user/ghost
SetEnv NODE_ENV production
SetEnv NODE_PATH /usr/lib/node_modules

8. Create Admin User

8.1 Visit http://yourdomain.com/admin - you should see a page as follows:

setup admin user

8.2 Create an admin account by entering your details and choice of password. You will then be logged in, and the installation is complete.  Congratulations!

Check out our top user-rated host: SiteGround
Need help choosing a hosting provider?
Check out our top user-rated host: SiteGround