> ## Content Index
> Fetch the complete content index at: https://ghost.skillshub.info/llms.txt
> Use this file to discover other available public pages before exploring further.

# How To Startup Ghost On Ubuntu 16.04 and Ubuntu 14.04 And Keep It Running
- URL: https://ghost.skillshub.info/how-to-startup-ghost-on-ubuntu-16-04-and-ubuntu-14-04-and-keep-it-running/
- Published: 2017-01-26T03:00:00.000Z
- Updated: 2017-01-26T03:00:00.000Z
- Author: Francis
- Tags: How Do I?, #Import 2026-11-23 14:49

## What is this article about?

This article talks about two different ways to start ghost and make it persistent on ubuntu using startup scripts. Ubuntu being a linux distribution belonging to the Debian family has gone a through a recent change between distributions 14.04 and 16.04 in terms of how startup scripts are implemented.

## What to understand

In recent years, Linux distributions have increasingly transitioned from other init systems to systemd. The systemd suite of tools provides a fast and flexible init model for managing an entire machine from boot onwards.

Ghost used to be started at system boot with Ubuntus **Upstart** init system (14.04 and earlier)  
Now Ghost is started using **Systemd** (15.04 and later)

## How to start Ghost & have it start itself after a server reboot

#### Using the Startup method (Ubuntu 14.04 and earlier)

**Starting Ghost** \- The command `npm start --production` only starts ghost from command line. It doesn't run Ghost persistently nor restart it after reboots. Follow these instructions to fix that:

 NOTE: you have to make sure you run everything as the root user

```
a) cd /etc/init
b) nano NAME.conf (where NAME is the name of your ghost blog)
I use the prefix gh- for all my ghost blogs e.g. gh-heap.conf
c) paste below into the file:

# Ghost Blog Startup script - ghost.skillshub.info
start on startup
script
cd /PATH/TO/YOUR/GHOST/BLOG
npm start --production
end script

d) now start ghost by using this command: service NAME start

```

 Here are some PATH EXAMPLES - substitute /PATH/TO/YOUR/GHOST/BLOG with e.g. "/srv/users/serverpilot/apps/APPNAME/public/" or "/var/www/heap.skillshub.info/ghost" or wherever your Ghost files are located on the server

#### Using the Systemd method (Ubuntu 15.04 and later)

**Starting Ghost** \- Is done slightly differently with Systemd. You need to create a file NAME.service in /etc/systemd/system/ (where NAME is the name of your ghost blog) I use the prefix gh- for all my ghost blogs e.g. gh-heap.service.)

 NOTE: Make sure you run everything as the root user and then follow below instructions.

```
a) cd /etc/systemd/system/   
b) nano NAME.service 
c) paste below into the file:

# Place in /etc/systemd/system/NAME.service
[Unit]
Description=Ghost Blog Startup script - ghost.skillshub.info 
After=network.target

[Service]
Type=simple  
PIDFile=/run/NAME.pid  

# WorkingDirectory is the directory you installed Ghost to
WorkingDirectory=/PATH/TO/YOUR/GHOST/BLOG
User=ghost  
Group=ghost  
ExecStart=/usr/bin/npm start --production  
ExecStop=/usr/bin/npm stop /PATH/TO/YOUR/GHOST/BLOG  
StandardOutput=syslog  
StandardError=syslog

[Install]
WantedBy=multi-user.target  

d) now start ghost by using this command: service NAME start

```

 PATH EXAMPLES - substitute /PATH/TO/YOUR/GHOST/BLOG with e.g. "/srv/users/serverpilot/apps/APPNAME/public/" or "/var/www/heap.skillshub.info/ghost" or wherever your Ghost files are located on the server

To make it start after a reboot **we need to register the service** you created so that it will start whenever the server gets rebooted.  
Use this command: `systemctl enable NAME.service`

 NOTE: You can always check the status of the service by running the following command: service NAME status e.g. service gh-heap status 

## THE GOTCHA'S

**User & Group** \- for standard installs of ghost, the user and group is usually 'ghost' but if you are using [Serverpilot](https://www.serverpilot.io/?refcode=ffd835b5a302&ref=ghost.skillshub.info) , the user and group is probably 'serverpilot' - The NAME.service file needs the user and group **that owns your ghost directory**. Use these commands to quickly find out:

`cd /PATH/TO/YOUR/GHOST/BLOG`   
  
`ls -lah`

According to this image the permissions of the folder containing all my ghost files belong to 'serverpilot'  
![](https://ghost.skillshub.info/content/images/2017/01/francis_-_root_purple-u16-sp___srv_users_serverpilot_apps_heap-skillshub-info_public_-_ssh_root_138_197_84_66_-_Homebrew_-_131-24_-_-1.png)

But if you would need to change the permissions, just use the chown command in the folder that contains all your ghost files. Example: `chown -R serverpilot:serverpilot *`

**Reference Links:**  
[https://chrisebert.net/installing-ghost-and-nginx-on-ubuntu-server-16-04-lts/#step10 ](https://chrisebert.net/installing-ghost-and-nginx-on-ubuntu-server-16-04-lts/?ref=ghost.skillshub.info#step10)  
[https://wiki.debian.org/systemd ](https://wiki.debian.org/systemd?ref=ghost.skillshub.info)  
[Systemd Essentials: Working with Services, Units, and the Journal ](https://www.digitalocean.com/community/tutorials/systemd-essentials-working-with-services-units-and-the-journal?ref=ghost.skillshub.info)  
[http://docs.ghost.org/pl/installation/deploy/ ](http://docs.ghost.org/pl/installation/deploy/?ref=ghost.skillshub.info)  
[https://www.howtoforge.com/tutorial/how-to-install-ghost-blog-on-ubuntu/ ](https://www.howtoforge.com/tutorial/how-to-install-ghost-blog-on-ubuntu/?ref=ghost.skillshub.info)