setting up a site with ghost

last edited Fri, 05 Apr 2024 22:04:24 GMT
backlinks: null

Ghost is a headless content management system. I wanted to set up a independent alternative to medium or substack, but I didn't want to rely on for mail and hosting. I also wanted to minimize the overall cost for bulk email and other 3rd party services.

Dependencies direct link to this section

# Login via SSH

ssh root@your_server_ip

# Create a new user and follow prompts
adduser <user>

# Add user to superuser group to unlock admin privileges
usermod -aG sudo <user>

# Then log in as the new user
su - <user>

Debian Installation direct link to this section

Assuming that you already have a server to host the project on, with it's own respective domain, login via SSH. A script automates most of what needs to be setup so you will most likely not have to touch or edit any nginx configuration files. After the installation is finished the command line will output your domain if all has gone well. Then you can proceed to create an admin account via the portal

Install NGINX:

sudo apt-get install nginx

nginx version: nginx/1.18.0
MySQL: MySQL 8.22
Install NodeJs:

# as root
curl -fsSL | bash - &&\
apt-get install -y nodejs

Ghost requires a supported version of node and version 18.x is recommended.

Ghost CLI direct link to this section

Install with npm:

sudo npm install ghost-cli@latest -g
ghost help
# view command line tools

Customizing direct link to this section

If you're not using mailgun for newsletters, you'll need to find an alternative. If you're not using ghost's services then you'll also need to manually set up STMP for transactional emails. Most settings can be configured through the application layer.

In the path that ghost was installed, edit config.production.json or the development version of the file. Debugging can be done in var/www/YOURGHOSTDIRECTORY/content/logs.

Transactional Emails direct link to this section

This is the most important step to take after installation, especially if you plan to invite members to contribute. Google offers SMTP for free if you can't set up your own server. Make sure your host provider isn't blocking email ports, I had to submit a support ticket for mine after swearing my configuration files were correct. You can also use mailgun if you prefer but it is not a free service at the time of writing.

"mail": {
    "transport": "SMTP",
    "options": {
      "service": "Google",
      "host": "",
      "port": 587,
      "auth": {
        "user": "",
        "pass": "this password"
 "mail": {
    "from": "'MyDomain' <>",
    "transport": "SMTP",
    "options": {
      "service": "Mailgun",
      "host": "",
      "port": 465,
      "secureConnection": true,
      "auth": {
        "user": "",
        "pass": "7adsf7f8asd8f6as7asd7f-123sdf8-asdf87fa"

Theme direct link to this section

Using the Simply theme. All that was required was downloading the zip file and uploading through the admin panel.

There is some glitchiness on my end with uploading modified .yaml files, otherwise it's a very seamless experience so far.

Newsletters direct link to this section

I decide to disable native settings and use mailchimp with zapier instead. Ghost only has bulk email integrated with a non-free option. Mailchimp is a simple service that can be used alongside Zapier for bulk email.

CentOS Installation direct link to this section

To install dependencies:

sudo yum install epel-release

curl --silent --location | sudo bash -

then we can install node

yum install nodejs npm -y

References direct link to this section