How to Ghost install on CentOS 6.5 with WHM/cPanel

In all cases, $DOMAIN is the domain name where you want to want to install Ghost and $USERNAME is the corresponding username of the domain owner.


Step 1. SSH into your server as root.

Step 2. Add the Enterprise Linux repositories.

$ yum install

Step 3. Install Node.js and the Node Package Manager

$ yum install nodejs
$ yum install npm

Step 4. For Atomic Secure Linux users only: Give Node.js the ability to remap memory.

$ paxctl -m /usr/bin/node

Step 7. Navigate to the user’s folder where you want to install Ghost and create a ‘ghost’ folder.

$ cd /home/$USERNAME/www/
$ mkdir ghost

Step 8. Download and unzip Ghost.

$ wget --no-check-certificate
$ unzip ghost

Step 9. Install Ghost.

$ cd ghost
$ npm install --production

Step 10. Start Ghost.

$ npm start

Step 11. Follow the onscreen instructions to verify that it works and to setup your login info.

Step 12. Stop Ghost.

$ npm stop

Step 13. Setup Ghost to run as a background service.

$ npm install forever -g
$ NODE_ENV=production forever start index.js

Step 14. Install and configure supervisord to manage Ghost as a background service.

$ yum install supervisor
$ vi /etc/supervisord.conf

Add the following to the end and save the file:

command = node /home/$DOMAIN/www/ghost/index.js
directory = /home/$DOMAIN/www/ghost
user = ghost
autostart = true
autorestart = true
stdout_logfile = /var/log/supervisor/ghost.log
stderr_logfile = /var/log/supervisor/ghost_err.log
environment = NODE_ENV="production"

Step 15. Edit the config file and enter your domain name in the appropriate location under Production.

$ vi config.js
production: {
url: 'http://$DOMAIN',

Step 20. Start Ghost.

$ supervisord

Step 21. Create a custom virtualhost configuration.

$ mkdir /usr/local/apache/conf/userdata/std/2/$USERNAME/$DOMAIN/
$ touch /usr/local/apache/conf/userdata/std/2/$USERNAME/$DOMAIN/ghost.conf

Step 22. Edit the custom virtualhost file.

$ vi /usr/local/apache/conf/userdata/std/2/$USERNAME/$DOMAIN/ghost.conf

Add the following text and save the file:

ProxyPreserveHost on
ProxyPass / http://$DOMAIN:2368/

Step 24. Verify the the virtualhost configuration is loading correctly.

$ /scripts/ensure_vhost_includes --user=$USERNAME

Step 25. Recompile httpd.conf.

$ /usr/local/cpanel/bin/apache_conf_distiller

Step 26. Restart Apache.

$ service httpd restart

Your site should now load at the specified domain.

Published by

Hadie Danker

Masih belajar tentang seluk beluk web design dan web apps. Setiap hari bercengkrama di localhost untuk memenuhi hasrat belajar dan mengembangkan pengetahuan.

Mulai Diskusinya di