Updated on Jul 13, 2018
In this tutorial, we will follow the steps required to install Ghost. While the Ghost installation is a pretty straight forward process, you will still need to obtain and install Node.js first in order to start your Ghost blog platform.
In order to complete the steps below, please log in your server as root using SSH.
To install Ghost and Node.js on CentOS/Ubuntu, you need to complete the following steps:
First, make sure that you have your OS updated and all required packages are installed. You can perform this following the instructions below depending on your server operation system.
Instructions for CentOS using yum:
yum -y update yum -y groupinstall "Development Tools"
Instructions for Ubuntu using apt-get:
apt-get -y update aptitude -y install build-essential zip
When your OS is updated, please process with the Node.js installation:
cd /root/ wget http://nodejs.org/dist/node-latest.tar.gz tar -xzf node-latest.tar.gz
Enter the node folder which you have just extracted from the archive and execute:
./configure make -s make install
When the installation is completed you should be able to see node on your server by executing:
[root@ghost ~]# whereis node node: /usr/local/bin/node
Now we can proceed with the Ghost installation. For this tutorial we will use /var/www directory but you can install Ghost in any folder suitable for your needs. Please execute the following commands:
mkdir -p /var/www cd /var/www curl -L -O https://ghost.org/zip/ghost-latest.zip unzip -d ghost ghost-latest.zip rm ghost.zip cd ghost/ /usr/local/bin/npm install --production
Now that we have Ghost downloaded and installed, we need to apply some final tweaks to configure our Ghost blog with the correct port and domain. There are two important settings to configure -- the IP address for which the Ghost process will listen for new connections and the port on which it will be accessible. As the standard HTTP port is 80 we will reconfigure the config.js to work for any IP on the server on port 80. This can be done using the following command:
sed -e 's/127.0.0.1/0.0.0.0/' -e 's/2368/80/' <config.example.js >config.js
The next step is to configure the domain name of your Ghost blog. This can be done using:
replace my-ghost-blog.com example.com -- config.js
Please make sure to change 'example.com' to your actual domain name.
Ghost uses sqlite3 by default. If you would like to have your Ghost blog configured with a MySQL database, please check our tutorial on How to configure Ghost with MySQL.
Now you are ready to start your Ghost blog. This can be done by simply executing:
node index.js Ghost is running in development... Listening on 0.0.0.0:80 Url configured as: http://my-ghost-blog.com