Learn How To Deploy Ghost on Fedora 25

March 5, 2020

Table of Contents

If you are using a different system, please check our other tutorials.

Ghost is an open source blogging platform that is gaining popularity among developers and ordinary users since its 2013 release. It puts focus on content and blogging. The most attractive thing about Ghost is its simple, clean, and responsive design. You can write your blog posts from a mobile phone. Content for Ghost is written using the Markdown language. Ghost is perfect fit for individuals or small groups of writers.

In this guide we are going to set up and deploy a secure Ghost blog on an Fedora 25 VPS using Let’s Encrypt, Certbot, Node.js, Nginx and PM2.


  • Fedora 25 server instance with minimum of 1GB RAM.
  • You will probably have to open port 2368 with semanage port -a -t http_port_t -p tcp 2368.

Let’s Encrypt

Before starting this step, ensure that you have set DNS records for your domain.

We are going to use Let’s Encrypt CA and EFF’s Certbot client to obtain TLS certificate for our Ghost blog.
Don’t forget to replace all instances of example.com with your domain name.

  1. Update system:

    dnf check-update || dnf upgrade -y
  2. Install needed tools:

    dnf install @development-tools -y
  3. Install Certbot (a.k.a Let’s Encrypt client):

    dnf install certbot -y
  4. Check Certbot version:

    certbot --version
    # certbot 0.12.0
  5. Obtain a certificate using standalone” mode:

    certbot certonly --standalone --domains example.com,www.example.com --email john.doe@example.com --agree-tos --rsa-key-size 2048

After going through previous steps, your certificate and private key will be in the /etc/letsencrypt/live/example.com directory.

Install NodeJS

Ghost currently supports Node versions 0.12.x, 4.2+, and 6.9+ only.

We are going to install supported version for Ghost which is v6 Boron LTS at the time of this writing.

  1. Download and install the latest LTS version of Node.js:

    dnf install nodejs -y
  2. Check Node and NPM version:

    node -v && npm -v
    # v6.10.2
    # 3.10.10

Install Nginx

  1. Download and install Nginx:

    dnf install nginx -y
  2. Check Nginx version:

    nginx -v
    # nginx version: nginx/1.10.2
  3. Start and Enable Nginx service:

    systemctl start nginx.service && systemctl enable nginx.service
  4. Configure Nginx as a reverse proxy:

    vi /etc/nginx/conf.d/ghost.conf
  5. Paste the following in /etc/nginx/conf.d/ghost.conf:

    server {
      listen 80;
      listen [::]:80;
      listen 443 ssl http2;
      listen [::]:443 ssl http2;
      server_name example.com www.example.com;
      ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
      ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
      ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
      location / {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_set_header X-Forwarded-Proto $scheme;
  6. Check Nginx syntax:

    nginx -t
  7. Reload Nginx configuration:

    systemctl reload nginx.service

Install Ghost

If you want to host multiple Ghost blogs on same VPS, each Ghost instance must be running on a separate port.

  1. Make webroot directory:

    mkdir -p /var/www/
  2. Create a new ghost user:

    useradd -c "Ghost Application" ghost 
  3. Download Ghost:

    curl -L https://github.com/TryGhost/Ghost/releases/download/0.11.8/Ghost-0.11.8.zip -o ghost.zip
  4. Unzip Ghost:

    unzip -uo ghost.zip -d /var/www/ghost
    rm -f ghost.zip
  5. Navigate to webroot:

    cd /var/www/ghost
  6. Change the ownership of webroot directory:

    chown -R ghost:ghost .
  7. Switch to new ghost user:

    su - ghost
  8. Navigate to webroot:

    cd /var/www/ghost
  9. Install Ghost:

    npm install --production
  10. Configure Ghost by changing url and mail property of production object inside of config.js file:

    cp config.example.js config.js
    vi config.js
    var path = require('path'),
    config = {
      // ### Production
      // When running Ghost in the wild, use the production environment.
      // Configure your URL and mail settings here
      production: {
        url: 'https://example.com',
        mail: {
          options: {
             service: '',
                auth: {
                  user: '',
                  pass: ''
            . . .
            . . .
    . . .
    . . .        

    NOTE: You should configure mail also. Consult the official Ghost documentation on how to do that.

  11. Start Ghost:

    npm start --production

    Ghost will now be running. Both blog front-end and admin interface are secured with HTTPS and HTTP/2 is working also. You can open your browser and visit site at https://example.com. Don’t forget to replace example.com with your domain name.

  12. Shut down Ghost process by pressing CTRL + C and exit from ghost user back to root user:


Install PM2

If you close your terminal session with your VPS, your blog will also go down. That’s not good. To avoid this, we are going to use the PM2 process manager. It will keep our blog up 24/7.

  1. Install latest stable version of PM2 process manager:

    npm install -g pm2@latest
  2. Check PM2 version:

    pm2 -v
    # 2.4.6
  3. Switch to ghost user again:

    su - ghost
  4. Set NODE_ENV environment variable to production:

    echo "export NODE_ENV=production" >> ~/.bashrc && source ~/.bashrc
  5. Start (daemonize) Ghost application with PM2:

    pm2 start /var/www/ghost/index.js --name "Ghost Blog"
  6. Navigate to https://example.com/ghost/ and create Ghost admin user. Do this as soon as possible.


That’s it. We now have a fully functional Ghost blog. If you want to change the default Ghost theme called Casper to a custom one, you can just download and unzip the theme into the /var/www/ghost/content/themes folder and select it via Ghost admin interface, located at https://example.com/ghost.

Need help?

Do you need help setting up this on your own service?
Please contact us and we’ll provide you the best possible quote!