In this chapter, we will discuss how to install Ghost manually on your computer or a VPS. Given installing on a VPS requires many of the same steps as a local installation, you'll also see what additional steps you need to take to install Ghost manually on a VPS, based on the two most popular operating systems VPS hosts tend to run: Ubuntu and CentOS.
If you are new to using the command line, you may want to look at one of the automated installs instead of installing manually, because it can get a little tricky. We are going to give you all the commands you will need, but it may get complicated for someone who has never used the tools before.
This chapter covers the following topics:
In this section, we will detail how to install Ghost locally on your personal computer and on your web hosting company's server. We will be covering Ubuntu, CentOS, Mac OS X, and Windows. The steps to install Ghost are largely the same whether installing locally on your personal computer or on a remote server. However, there are some key differences that we will highlight.
In order to install Ghost manually, a command-line tool and, if you are using a VPS, an application for Secure Shell (SSH) access is needed. If you are using Mac OS X or Linux, you can use the Terminal application. On Mac OS X, it is located in your Applications | Utilities folder. For Windows, you need to download an application in order to use SSH; however, if you're installing locally, you can use the command prompt by navigating to Accessories | Command Prompt. For SSH access, we suggest using Putty (http://www.putty.org/).
The majority of steps will be performed using the command line, and we provide the exact command that needs to be executed. Occasionally, you will need to type in part of a command. For example:
tar -xzf node-latest.tar.gz cd [name of expanded node directory]
In the first command, when we expand node-latest.tar.gz
, the name of the folder that will be created is unknown, but in our case, it is called node-v0.10.25
. Therefore, our change directory command would look like this:
cd node-v0.10.25/
You can see an example of this in the following screenshot:
For those new to using command-line interface, it's beyond the scope of this book to fully explore command-line operations—though we'll be demonstrating all the commands you need to execute specific steps throughout. If you want to learn more about this, see the following link (don't be put off by the title! It's a great way for beginners to learn how to leverage the power of the command line):
If you have a VPS but are unsure what operating system is installed, you can SSH into your VPS, and run uname -a
to determine if it is Ubuntu or CentOS, as shown in the following example:
[email protected]:~# uname -a Linux 192.168.0.13 3.2.0-54-virtual #82-Ubuntu SMP Tue Sep 10 20:31:18 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
On Ubuntu, running uname -a
will output something similar to the one shown in the following screenshot:
On CentOS, the output will look like this:
[email protected] [~]# uname -a Linux server 2.6.32-358.18.1.el6.x86_64 #1 SMP Wed Aug 28 17:19:38 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
Here's the screenshot as well:
We need to perform the following steps to install Ghost on Ubuntu OS. These steps will work on all versions of Ubuntu 12.04 and higher:
sudo apt-get update sudo apt-get upgrade
sudo apt-get install build-essential zip
cd /tmp/ wget http://nodejs.org/dist/node-latest.tar.gz tar -xzf node-latest.tar.gz cd [name of expanded node directory] ./configure make sudo make install
sudo adduser ghost
sudo mkdir -p /var/www/ cd /var/www/ sudo wget https://ghost.org/zip/ghost-latest.zip sudo unzip -d ghost ghost-latest.zip sudo chown -R ghost:ghost /var/www/ghost/ sudo rm ghost-latest.zip
su - ghost
cd /var/www/ghost npm install --production
vi config.example.js
host: '127.0.0.1',
to:host: '0.0.0.0',
npm start --production
After running the command in step 11, you should see an output that says Ghost is running…. You're now running Ghost!
This means that Ghost has started successfully and you can now browse to your Ghost website. If you installed Ghost locally and did not edit the config.js
file, type the 127.0.0.1:2368
URL into your browser, and you will see your Ghost blog. If you edited your config.js
file, head to the URL or the IP address where Ghost is set up to run it.
Now that you see your Ghost home page, add /ghost/
to the end of the URL to create your Ghost admin user (for example, 127.0.0.1:2368/ghost/
or <yourdomain>.com/ghost/
).
If you run into any errors with starting up Ghost, see our Troubleshooting section at the end of this chapter.
We will be using Nginx, a popular web server software, to run on port 80, which will then proxy requests to port 2368, the port that Ghost will be running on. This section assumes that you have already purchased a domain name from a registrar such as NameCheap and have configured the domain to point to your VPS. If you need assistance setting up your domain name, we would recommend contacting your domain registrar and they will assist with the configuration. To configure Ghost on Ubuntu, perform the following steps:
sudo apt-get install nginx
localhost:2368
by placing the following configuration in /etc/nginx/conf.d/ghost.conf
:server { listen 80; server_name example.com; location / { proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $http_host; proxy_pass http://127.0.0.1:2368; } }
sudo service nginx restart
sudo yum update
sudo yum groupinstall development
cd /tmp/ curl -O http://nodejs.org/dist/node-latest.tar.gz tar -xzf node-latest.tar.gz cd [name of expanded node directory] ./configure make sudo make install
sudo useradd ghost
sudo mkdir -p /var/www/ cd /var/www/ curl -L -O https://ghost.org/zip/ghost-latest.zip unzip -d ghost ghost-latest.zip sudo chown -R ghost:ghost /var/www/ghost/ sudo rm ghost-latest.zip
su - ghost
cd /var/www/ghost/ npm install --production
vi config.example.js
host: '127.0.0.1',
to:host: '0.0.0.0',
npm start --production
After running the command in step 11, you should see an output that says Ghost is running…. You're now running Ghost!
This means that Ghost has started successfully and you can now browse to the Ghost website. If you installed Ghost locally and did not edit the config.js file, type the URL 127.0.0.1:2368
into your browser, and you will see your Ghost blog. If you did edit your config.js file, head to the URL or IP address where Ghost is set up to run.
Now that you see your Ghost home page, add /ghost/
to the end of the URL to create your Ghost user (for example, 127.0.0.1:2368/ghost/
or example.com/ghost/
).
If you run into any errors with starting up Ghost, see our Troubleshooting section at the end of this chapter.
We will be using Nginx, a popular web server software, to run on port 80, which will then proxy requests to port 2368, the port that Ghost will be running on. This section assumes you have already purchased a domain name from a registrar such as NameCheap and have configured the domain to point to your VPS. If you need assistance setting up your domain name, we would recommend contacting your domain registrar and they will assist with the configuration.
sudo yum install nginx
/etc/nginx/conf.d/ghost.conf
:server { listen 80; server_name example.com; location / { proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $http_host; proxy_pass http://127.0.0.1:2368; } }
sudo service nginx restart
We need to perform the following steps to install Ghost on Mac OS X:
.pkg
Macintosh Installer. Double-click on the file that was downloaded and go through the installation process, selecting all of the default values./Applications/Utilities
):mkdir -p ~/ghost cd ~/ghost curl -L -O https://ghost.org/zip/ghost-latest.zip unzip ghost-latest.zip rm ghost-latest.zip npm install --production
To configure Ghost on OS X, perform the following steps:
To make the configuration file, we're going to use the vi text editor. For a list of vi commands visit http://www.lagmonster.org/docs/vi.html.
cp config.example.js config.js vi config.js
url: 'http://my-ghost-blog.com', and host: '127.0.0.1', port: '2368'
url: '[your Ghost URL or IP]', and host: '0.0.0.0', port: '80'
npm start --production
After running the command in step 4, you should see an output that says Ghost is running…. You're now running Ghost on OS X!
This means that Ghost has started successfully and you can now browse to the Ghost website. If you installed Ghost locally and did not edit the config.js
file, type the 127.0.0.1:2368
URL into your browser, and you will see your Ghost blog. If you edited your config.js
file, head to the URL or IP address where Ghost is set up to run it.
Now that you see your Ghost home page, add /ghost/
to the end of the URL to create your Ghost user (for example, 127.0.0.1:2368/ghost/
or <yourdomain>.com/ghost/
).
If you run into any errors with starting up Ghost, see the Troubleshooting section at the end of this chapter.
To install Ghost on a Windows OS, we need to perform the following steps:
.msi
installer. Once the download has completed, run the installer, selecting all of the default values.Ghost
and expand the contents of the ghost.zip
file into it.Ghost
folder you created:cd [ path to where you have created the Ghost folder ]
npm install --production
To configure Ghost, perform the following steps:
Ghost
folder, there is a file called config.example.js
. Open this file in any text editor and change the following sections:url: 'http://my-ghost-blog.com',
and
host: '127.0.0.1', port: '2368'
to:
url: '[your Ghost URL or IP]',
and
host: '0.0.0.0', port: '80'
config.js
and exit the text editor.npm start --production
After running the command in step 4, you should see an output that says Ghost is running….
This means that Ghost has started successfully and you can now browse to the Ghost website. If you installed Ghost locally and did not edit the config.js
file, type the 127.0.0.1:2368
URL into your browser, and you will see your Ghost blog. If you edited your config.js
file, head to the URL or IP address where Ghost is set up to run it.
Now that you see your Ghost home page, add /ghost/
to the end of the URL to create your Ghost user (for example, 127.0.0.1:2368/ghost/
or example.com/ghost/
).
If you run into any errors with starting up Ghost, refer to the Troubleshooting section at the end of this chapter.
3.145.57.254