To install Ghost CMS you need a supported version of Node.js. Check the supported Node versions by Ghost.
With Node.js installed we get npm which is a package manager. So, let's start.
Install Ghost-CLI
Ghost CLI is a commandline tool provided by the Ghost team to help with installing and configuring Ghost. To install the CLI run the following command:
npm install ghost-cli@latest -g
Now we can use ghost
command. Some ghost commands that are available:
- ghost install
- ghost update
- ghost setup
- ghost config
- ghost start
- ghost stop
You can run ghost help
to see all available commands.
Install Ghost locally
To install Ghost locally just create a new directory and navigate to it. Then run the following command:
ghost install local
This will setup a Ghost instance in development mode (which is good for developing or changing a theme as it uses less caching)
When the install is finished the Ghost instance should automatically be started.
You can access it by this url: http://localhost:2368
To access the ghost admin go to this url http://localhost:2368/ghost
Useful commands to manage your local ghost instance
ghost start
- To start Ghostghost stop
- To stop Ghostghost restart
- To restart Ghost
The database is automatically setup during the install and can be found in the
content/data
folder. While themes are in the content/themes
folder.
Install Ghost on server
To install Ghost on a server there is a recommended way to do it. You should create a directory for it:
# create directory
sudo mkdir -p /var/www/ghost_site
Your user has to own this directory and have the correct permissions for it.
Run these commands and replace <user>
with your actual user:
#set ownership
sudo chown <user>:<user> /var/www/ghost_site
#set permissions
sudo chmod 775 /var/www/ghost_site
Now you can install Ghost:
# move to the directory
cd /var/www/ghost_site
# run the install command
ghost install
Install Configuration
During the install you will be prompted to complete some information needed by the CLI to configure your site:
- Blog URL - your site url
- MySQL hostname - localhost by default
- MySQL user & password
- Database name - how you want to name the db
- Ghost MySQL user - yes/no (recommended)
- nginx setup - yes/no (recommended)
- SSL setup - yes/no (recommended) to have
https
- systemd setup - yes/no (recommended)
That's it, all done.