This guide will demonstrate how to Install Ghost CMS on Ubuntu 20.04 (Focal Fossa) Linux distribution. I talked about a lot of other stuff and now let’s get to the fun part…
Setup Requirements:
- FQDN – I.e. domain.com
- Ubuntu 20.04 / 18.04 / Ubuntu 16.04 Server
- Nginx Web Server
- Node.js
- MariaDB Database Server
- A non-root user to manage Ghost
Install MariaDB 10.5:
To install MariaDB 10.5 on Ubuntu 20.04, you need to add MariaDB repository on to the system. Then the installation of MariaDB 10.5 on Ubuntu 20.04 will be done from the APT repo…
- Let’s update the system first and install software-properties-common package…
sudo apt update && sudo apt upgradesudo apt -y install software-properties-common
- Now, we add add the MariaDB Repository Key to the system…
sudo apt-key adv --fetch-keys 'https://mariadb.org/mariadb_release_signing_key.asc'
- After importing the repository GPG key, we must add the APT repository…
sudo add-apt-repository 'deb [arch=amd64] http://mariadb.mirror.globo.tech/repo/10.5/ubuntu focal main'
- Finally, we install MariaDB Server…
sudo apt updatesudo apt install mariadb-server mariadb-client
- Now, we create a database for Ghost…
mysql -u root -pCREATE USER [email protected] IDENTIFIED BY "StrongPassword";CREATE DATABASE ghost; GRANT ALL ON ghost.* TO [email protected];FLUSH PRIVILEGES;QUIT
Install Nginx:
- Lets install Nginx now…
sudo apt updatesudo apt -y install nginx
- Now, we add an user named, ‘ghostadmin’…
sudo adduser ghostadminsudo usermod -aG sudo ghostadmin
Install Node.js:
The recommended way to install Node.js on Ubuntu 20.04 LTS is by using the apt
command to install the stable default Node.js version from the standard Ubuntu repository:
sudo apt install nodejs
Then we check the Node.js version:
node --versionv10.15.2
But, that’s not the latest Node.js version. So, now we install the latest version from source…
- Firstlty, we need to install NVM manager…
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash
- Then, we update the shell environment…
source ~/.profile
- Now we check the NVM version…
nvm --version0.33.8
- Next, list all available Node.js versions…
nvm ls-remote... v14.14.0 v14.15.0 (LTS: Fermium) v14.15.1 (LTS: Fermium) v14.15.2 (LTS: Fermium) v14.15.3 (Latest LTS: Fermium) v15.0.0-> v15.0.1
- let’s install the latest version…
nvm install 14.15.3
- Now, we can check for our installed Node.js version…
node -vv14.15.3
Install Ghost-CLI:
- We now need to install the package ghost-cli which provides the ghost command…
sudo npm i -g ghost-cli npm WARN deprecated [email protected]: cross-spawn no longer requires a build toolchain, use it instead /usr/bin/ghost -> /usr/lib/node_modules/ghost-cli/bin/ghost [email protected] added 377 packages from 182 contributors in 9.281s
- Now, we have to create a new directory for Ghost data…
sudo mkdir -p /var/www/ghostsudo chown ghostadmin:ghostadmin /var/www/ghostsudo chmod 775 /var/www/ghost
Install Ghost:
- First, we need to create a directory for our website…
su - ghostadmincd /var/www/ghostmkdir example.comcd example.com
- Lastly, we install Ghost…
ghost install
We have to answer a lot of questions to finish the setup process, but they’re easy peasy…
Nginx configuration files will be placed under: /etc/nginx/sites-enabled/…
- If you want to check service status…
systemctl status ghost_example-com
Accessing Ghost Admin:
Ghost is now installed. This means our blog is live as well. You just need to go to example.com/ghost and create your first Ghost administrator/publisher account.
Login and start publishing…
Now create a high traffic site, big enough to crash Nginx and Node.js both!