In this post, we’ll be covering off how to install the Ghost blogging platform on CentOS Linux.
Ghost is minimalist, open-source blogging platform that was recently released. It is very simple to author content and is written in NodeJS.
We’ll also be installing Apache with a basic reverse proxy configuration to access Ghost on port 80, being served from demo.centosblog.com
1. Installing the Prequisites
Install unzip, Apache, NodeJS and NPM:
yum install unzip httpd nodejs npm
2. Create a Ghost directory
In this example, we’ll create it in /var/www/nodejs/ghost:
mkdir -p /var/www/nodejs/ghost
3. Download and Extract Ghost
Change directory to your Ghost directory, and download the Ghost zip file:
cd /var/www/nodejs/ghost wget --no-check-cert 'https://en.ghost.org/zip/ghost-0.3.2.zip' unzip ghost-0.3.2.zip
4. Use NPM to download additional requirements for Ghost
npm install --production
5. Change Ghost URL and Start Ghost with NPM
Edit config.js and change the url: to your URL.
Now start Ghost with NPM. We’ll use nohup to put this process in the background, which will stay alive even after logging out (a better way to do this would be with an init script):
nohup npm start > /tmp/ghost.log &
Ghost should now be running from 127.0.0.1:2368
6. Configure Simple Apache reverse proxy for Ghost
We’ll create a simple reverse proxy configuration to make Ghost accessible on port 80 via Apache.
a. Uncomment the following from /etc/httpd/conf/httpd.conf:
#NameVirtualHost *:80
b. Create a reverse proxy configuration for Ghost with the following contents (remember to change demo.centosblog.com to your own virtualhost):
vim /etc/httpd/conf.d/ghost.conf
<VirtualHost *:80> ServerName demo.centosblog.com ProxyRequests Off ProxyPreserveHost On <Proxy *> AddDefaultCharset Off Order deny,allow Allow from all </Proxy> ProxyPass / http://127.0.0.1:2368/ ProxyPassReverse / http://127.0.0.1:2368/ </VirtualHost>
c. Start Apache:
/etc/init.d/httpd start
Go to the URL that you’ve configured and you should see Ghost (if you haven’t set up DNS, use your hosts file to test!).
For more information on Ghost, and how to use Ghost, please see the official site.