When Ghost first started showing up as a new Node.js-based blogging platform, a lot of people were excited to try it, but the install process was not as obvious as a typical blogging system upload.
The biggest issue I kept seeing was that people would get partway through the Ghost install and then run into missing package problems, especially because Git was not installed before running npm.
Quick Answer
The short version is this: install Ubuntu Server, install Git first, add a current Node.js repository, install Node.js, upload or place the Ghost files in a directory, run npm install from inside that Ghost folder, update config.js so Ghost listens on the server’s IP address, and then start Ghost on port 2368.
In my testing, installing Git before running the Ghost npm install step was the key fix. Without Git, Ghost could not pull down everything it needed during installation.
What This Setup Covers
In the walkthrough, I used Ubuntu Server 13.04 inside a virtual machine. That was current for the time of the video, but it is important to say this clearly now: Ubuntu 13.04 is very old and no longer something I would use for a modern public server.
The process is still useful as a historical and practical reference because it shows the moving parts Ghost needed at the time: Ubuntu Server, Git, Node.js, npm, the Ghost application files, a small config change, and a process manager to keep it running.
Ghost was still very early at this point. I described it as a first-release beta, useful for seeing the direction of the platform, but not something I considered ready for serious production use yet.
Install Ubuntu Server
I started with a clean Ubuntu Server install in a virtual machine. The installer itself was straightforward: choose a hostname, create a user, set the password, choose the time zone, and use guided partitioning for the whole disk.
Because this was a VM, I also installed OpenSSH during setup. That let me work from my regular terminal and editor instead of staying inside the virtual machine console.
I skipped automatic updates because I prefer to control when updates happen, especially in a testing environment.
Create the Ghost Folder
After the server finished installing and rebooted, I connected over SSH and worked from my home directory.
I created a folder named ghost inside my user directory, then uploaded the Ghost weekly release files into that folder. At the time, Ghost was available to developer users through weekly or daily builds.
The important part is that the terminal needs to be inside the folder that contains the Ghost files before running the npm install command later.
- Create a ghost directory in your home folder.
- Upload or extract the Ghost files into that directory.
- Run the installation commands from inside that Ghost folder.
Install Git First
The first package I installed was Git. This was the step I saw people miss most often.
Ghost’s npm install process needed Git to pull down some of the required files and packages. If Git was missing, the installation could fail later in a way that was not always obvious.
- Run apt-get install git before running npm install.
- Do this early, before installing Ghost dependencies.
- If Ghost fails while pulling dependencies, missing Git is one of the first things to check.
Update Packages and Add Node.js
After installing Git, I ran an apt-get update on the fresh Ubuntu install.
Then I installed the Python software properties package so I could add a PPA for Node.js. In the video, I used Chris Lea’s Node.js repository because it had current Node.js builds at the time.
After adding the repository, I ran apt-get update again so Ubuntu could see the new package list, then installed Node.js. One small detail that mattered: the package name was nodejs, not node.
- Run an update after the fresh Ubuntu install.
- Install the software properties package needed to add a PPA.
- Add the Node.js repository.
- Run apt-get update again.
- Install nodejs.
Install Ghost Dependencies
Once Node.js was installed, I moved into the Ghost directory and ran npm install.
That command reads the Ghost project files and installs the packages Ghost needs. At the time, one of the common problem areas was sqlite3. In my testing, having Git installed first allowed that dependency step to complete properly.
This is one of those setup steps where the order matters. If you skip Git and go straight to npm install, you may end up chasing errors that could have been avoided.
Install Forever
I also installed a Node package called Forever. The idea was simple: if the Ghost process stopped or crashed, Forever could bring it back up.
For a test VM or early Ghost install, that was useful because it kept the site running without manually restarting Node every time something went wrong.
I installed Forever globally so it could be used from the command line.
Edit the Ghost Config
Before starting Ghost, I edited config.js. By default, Ghost was set to use localhost. Since I was running it inside a VM and accessing it from another machine on the network, localhost was not enough.
I replaced the localhost address with the VM’s network IP address. The Ghost documentation focused on the development section, but in my testing I replaced the matching localhost values throughout the config file and saved it.
The practical point is this: if Ghost starts but you cannot reach it from another computer, check the host setting in config.js and make sure it matches the address you are trying to use.
Start Ghost
The basic way to start Ghost was npm start from inside the Ghost directory. When it started correctly, Ghost served the site on port 2368.
To run it with Forever, I used the main Ghost file, index.js. The syntax was forever start index.js from inside the Ghost folder.
One issue I ran into during the demo was stopping the process the wrong way. I used Control-Z out of habit, but that only suspended the process. Ghost was still running in the background, which prevented it from starting again cleanly.
The better way to stop npm start is Control-C. If you do suspend it accidentally, you may need to find the running Node processes and kill them before starting Ghost again.
Open Ghost in the Browser
Once Ghost was running, I opened the VM’s IP address in the browser with port 2368.
The format was the server IP followed by :2368. That loaded the first Ghost page.
To get to the admin area, the path was /ghost. From there, Ghost showed the registration and login flow for creating the first user.
- Frontend site: use the server IP with port 2368.
- Admin area: add /ghost to the end of the address.
- If the page does not load, check the config.js host value and whether the Node process is actually running.
The Main Thing That Went Wrong
The most important troubleshooting point from this install was Git.
A lot of people were trying to install Ghost without first installing the Git package. Then, when npm tried to pull dependencies during the Ghost install, things failed.
So if you are working through an old Ghost install guide or testing an early Ghost build, do not skip Git. Install it before running npm install inside the Ghost folder.
Key Takeaways
- Install Git before running npm install for Ghost.
- Use the nodejs package name when installing Node.js on Ubuntu in this setup.
- Run npm install from inside the folder that contains the Ghost files.
- Edit config.js if you need to access Ghost from another machine instead of localhost.
- Ghost runs on port 2368 by default in this walkthrough.
- Use Control-C to stop npm start cleanly; Control-Z can leave the Node process running.
Watch the Video
The video above above for the full terminal walkthrough, including the Ubuntu Server install, SSH setup, Ghost config edit, and the quick process cleanup when Ghost was already running in the background.