To install Ghost as my blogging platform, I had to go through a number of hoops and one of them was to get the nodejs working and what not. I figured this might as well be worth documenting in case I have to do this all over again. It might also be helpful for some other inquisitive minds.
The most useful reference I found was the post on rosehosting website specific to CentOS 7.
It would have all gone well too; had it not been for the nodejs related issues which resulted in me finding the other helpful pointers from various forums.
Anyway, the steps I took to get this all working are detailed in my notes below - keeping it, where I can, true to the post I have referred above:
On Fedora 24 node.js package already includes npm and if you try installing npm separately it will throw an error so just install node.js and npm will be installed along with it.
sudodnfinstallphpphp-fpmphp-cliphp-mysqlphp-curlphp-gd
#Create a directory for the website:mkdir/var/www/html/[sitefolder.eg:blog,myblog,banana]#Change to the newly created directory:cd/var/www/html/[sitefolder.eg:blog,myblog,banana]#Set access permissions for this directorychown-R/var/www/html/[sitefolder.eg:blog,myblog,banana]#Download latest version of Ghost:curl-Lhttps://ghost.org/zip/ghost-latest.zip-oghost.zip
#Unzip the downloaded fileunzipghost.zip
#Finally check the directory structuretree-L2#OUTPUT of above command should look like as shown below:.
├──config.example.js
├──config.js
├──content
│  ├──apps
│  ├──data
│  ├──images
│  └──themes
├──core
│  ├──built
│  ├──index.js
│  ├──server
│  └──shared
├──ghost.zip
├──Gruntfile.js
├──index.js
├──LICENSE
├──npm-shrinkwrap.json
├──package.json
├──PRIVACY.md
└──README.md
#install required dependencies:npminstall-gnode-gyp
sudodnfinstallgccgcc-c++`</pre>
Onceabovedependenciesareinstalledfollowingcodeshouldjustwork.
<divclass="boxed">NOTE:Makesureyouareinthedirectoryyoucreatedinstep2.</div>
<preclass="line-numbers language-bash">`#Install PM2 a process manager to control Node.js applications #It will help in keeping specified Node.js applications alive forever:npminstallpm2-g
#Install npminstall--production
#Start Ghost with pm2 and create a name for the pm2NODE_ENV=productionpm2startindex.js--name"Ghost"
// ## Ghost Configuration// Setup your Ghost install for various environments.// Ghost runs in `development` mode by default. Full documentation can be found at https://support.ghost.orgvarpath=require('path'),config;config={// #### Production// When running Ghost in the wild, use the production environment.// Configure your URL and mail settings hereproduction:{url:'http://your.blog.com',
It's the line number 14 in above code block where you need to replace http://your.blog.com with actual url of your blog.
NGINX install and configuration is something I covered in my post for installing Seafile on Fedora 24. So I already had a running nginx. I just needed to create a reverse proxy for Ghost on the existing nginx server.
Open the hostfile using following command:
sudonano/etc/hosts
Now, in the hosts file add the localhost alias for blog - in this example it is your.localhost.com.