How To Install Ghost on CentOS

In this short how-to I will explain how to get the Ghost publising platform up and running on CentOS 7.

First make sure CentOS is up to date

To check if you are up to date run:

sudo yum update -y

Install Node.js

Run the following commands to install Node.js from the EPEL repo:

sudo yum install -y epel-release
sudo yum install -y nodejs npm

Or if you prefer installing Node.js from source:

curl -sL | bash -
sudo yum install -y nodejs
sudo npm -g install npm@latest

Download and install the latest version of Ghost

Download and unzip Ghost with the following commands:

mkdir -p /var/www/
cd /var/www/  
curl -L -O  
unzip -d ghost  
cd ghost
sudo npm install --production

Create Ghost User

Run the following commands to add the ghost user:

sudo useradd -r ghost
sudo chown -R ghost:ghost /var/www/ghost/

Install and configure the Apache HTTP server

We are going to use Apache to proxy to port 80. Run the following commands to install the Apache HTTP server:

sudo yum install -y httpd

Create your virtual host config file /etc/httpd/conf.d/your-site.conf, add the following content and replace with your domain name :

<VirtualHost *:80>
    ProxyPreserveHost on
    ProxyPass /

Make Ghost start at boot

Many guides instruct to use forever or pm2. But you can also do this with systemd. Simply create the systemd service file /etc/systemd/system/ghost.service with the following content:

ExecStart=/usr/bin/node /var/www/ghost/index.js  


Now you will be able to manage Ghost via systemd:

systemctl start ghost  
systemctl stop ghost  
systemctl restart ghost  
systemctl status ghost 


Time to enable Apache and Ghost and start them. Run the following command to accomplish this:

systemctl enable ghost
systemctl enable httpd
systemctl start ghost
systemctl start httpd

And done!

Uco Mesdag

Read more posts by this author.

The Netherlands