Installing Ghost on Debian 10 (buster)
A friend of mine recently asked me if I could set up a blog for her. I agreed; I’ve got more than enough space on the VPS I’m using for this website, so cost wasn’t a factor.
I chose Ghost for her because, when I last used it, it was quite simple to use and relatively simple to install–at least, more simple than trying to set up PHP to work with Nginx nicely.
A large part of what I did comes from this Linode guide; I had to adapt minor things in my case.
The short version:
- Create a new system user (Ghost won’t run as root); give them /home and /var/www directories and a password
- Give the new user ownership of their /home and /var/www directories
- Install MySQL or MariaDB, create another SQL user so it’s not running as the root user
- Create a database for this user, give them all privileges to their database with
GRANT ALL PRIVILEGES ON database_name.* TO 'user'@'localhost';
(adapt to your naming scheme, in my case the SQL user is just namedghost
with the databaseblogname_prod
) - Using your new system user, cd into
/var/www/blogname
and runghost install
, following the prompts to set up for your domain, Nginx, SSL, etc. - Direct A and AAAA records for your domain at your IPv4 and IPv6 addresses
My adaptations:
- I kept getting errors running
ghost install
andghost setup
like this:
child_process.js:669
throw err;
^
Error: Command failed: service --status-all 2> /dev/null
at checkExecSyncError (child_process.js:629:11)
at execSync (child_process.js:666:13)
at process.nextTick (/usr/lib/node_modules/ghost-cli/node_modules/systeminformation/lib/processes.js:128:26)
at process._tickCallback (internal/process/next_tick.js:61:11)
- The fix for this, in my case, was to specify the PATH before the command:
PATH="$PATH:/usr/sbin" ghost install
- I decided to use certbot for the SSL certificate, so I opted not to generate it during setup. This caused an issue when I tried to connect to the website initially (before setting up the SSL certificate) where the domain name was directing me to another site on my VPS. This ended up fixing itself when I set up the SSL certificate.
Hopefully this helps someone if they’re stuck during their install.