How To Install Ghost on CentOS
There is a script that will automatically do the entire installation of Ghost for you which you can find in our One-Click Ghost Install Script for Ubuntu and CentOS article. If you would like to use that, great! If not, this page will describe how to go from a clean CentOS basic server install, to having a Ghost blog running on Node.js
First make sure CentOS is up to date and install some additional packages that will be needed to compile Node.js. To check run
yum update -y yum install -y wget
Installing Node.js From Source
Run the following commands to install Node.js:
curl -sL https://rpm.nodesource.com/setup | bash - yum install -y nodejs
Download and Installing Ghost
Download and unpack Ghost with 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 cd ghost sudo npm install --production
Configure Ghost
sudo vi config.example.js
In the "Production" section, change the following:
host: '127.0.0.1',
to
host: '0.0.0.0',
Create Ghost User
useradd ghost chown -R ghost:ghost /var/www/ghost/
Now to start Ghost, you will need to log into your "ghost" user.
su - ghost cd /var/www/ghost/
Now that you are logged in with your "ghost" user you can start Ghost:
npm start --production
Browse to http://url_where_ghost_is_installed.com:2368
Proxy to Port 80 and Keep Ghost Running
There you have it, Node.js is installed, Ghost files are located in /var/www/ghost
, and Ghost has been started. You can keep Ghost the way it is currently setup if using for a development environment and do not mind adding :2368 to the end of your url. If you are looking for more of a production setup, we would highly recommend you check out the following two articles to help get your Ghost blog ready: