What is Ghost?
Ghost is an open source blogging platform that helps you easily create a professional-looking online blog. Ghost is a robust content management system (CMS) with a Markdown editor, an easy-to-use user interface, and beautiful themes. It is easy to install and update with Ghost-CLI.
We will be using Ubuntu 18.04 in this guide. Any Ubuntu version should work with no issues.
So, let’s start!
Ghost CLI is a command line tool provided by the Ghost team to help with installing and configuring Ghost. To install the CLI run the following command:
npm install [email protected] -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
Useful commands to manage your local ghost instance
ghost start– To start Ghost
ghost stop– To stop Ghost
ghost 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
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
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
- systemd setup – yes/no (recommended)
Once all of the above has been configured you are good to go. All setup and ready to start publishing!