February 1, 2021

Installing Ghost

Once the pi has booted, we need to check everything is working. The first thing to check is that it has the IP address you expected. Use ping to check that it is alive. Bear in mind that it can take a minute or so for the pi to boot up so you may miss a few pings if you are too eager.

$ ping 192.168.0.250
PING 192.168.0.250 (192.168.0.250) 56(84) bytes of data. 
64 bytes from 192.168.0.250: icmp_seq=6 ttl=63 time=8.70 ms 
64 bytes from 192.168.0.250: icmp_seq=7 ttl=63 time=5.11 ms 
64 bytes from 192.168.0.250: icmp_seq=8 ttl=63 time=26.3 ms 
64 bytes from 192.168.0.250: icmp_seq=9 ttl=63 time=6.02 ms 
64 bytes from 192.168.0.250: icmp_seq=10 ttl=63 time=5.78 ms

If ping doesn't work then you'll need to go to the troubleshooting section for hints as to what to do.

Once ping has worked, ssh to it as user 'server' password 'server' (don't type the quotes) from your terminal or SSH utility.

$ ssh [email protected]
The authenticity of host '192.168.0.250 (192.168.0.250)' can't be established.
ECDSA key fingerprint is SHA256:ORkN03LOdHWi1V5r3/Lu/z0138vJcfWxaP0HyPBAcuE.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.0.250' (ECDSA) to the list of known hosts.
[email protected]'s password:
Linux micronetia 5.4.83-v7+ #1379 SMP Mon Dec 14 13:08:57 GMT 2020 armv7l

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.

Wi-Fi is currently blocked by rfkill.
Use raspi-config to set the country before use.

server@micronetia:~ $

change the password to something other than server with the passwd command:

server@micronetia:~ $ passwd
Changing password for server.
Current password:
New password:
Retype new password:
passwd: password updated successfully
server@micronetia:~ $

update the software with sudo apt update && sudo apt upgrade answer Y when you are asked to agree to the update. If you get messages about the LOCALE not being set you can ignore them.

server@micronetia:~ $ sudo apt update && sudo apt upgrade
Get:1 http://archive.raspberrypi.org/debian buster InRelease [32.6 kB]         
Get:2 http://raspbian.raspberrypi.org/raspbian buster InRelease [15.0 kB]      
Get:3 http://archive.raspberrypi.org/debian buster/main armhf Packages [351 kB]
Fetched 399 kB in 3s (139 kB/s)   
Reading package lists... Done
Building dependency tree       
Reading state information... Done
1 package can be upgraded. Run 'apt list --upgradable' to see it.
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
  rpi-eeprom
1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 418 kB of archives.
After this operation, 528 kB of additional disk space will be used.
Do you want to continue? [Y/n] y

If the update fails to connect to the raspbian repositories then you probably have the DNS set up wrong and you should refer to the troubleshooting section for more tips

Install Nodejs, Ghost and login to Ghost

Once updated you need to install nodejs, npm and ghost. There's a script to do all of this that you run with sudo installghost.sh

server@micronetia:~ $ sudo installghost.sh

## Installing the NodeSource Node.js 12.x repo...


## Populating apt-get cache...
...

/usr/bin/ghost -> /usr/lib/node_modules/ghost-cli/bin/ghost
+ [email protected]
added 420 packages from 208 contributors in 81.874s
----------------------------------
 Node.js and ghost cli installed

Now installing ghost itself into ~/blog


✔ Checking system Node.js version
✔ Checking current folder permissions
✔ Checking memory availability
✔ Checking free space
✔ Checking for latest Ghost version
✔ Setting up install directory
✔ Downloading and installing Ghost v3.41.2

The script gets the right version of node, installs it and then installs first the ghost-cli package and then ghost itself in the blog directory. The download and install of ghost takes a while. Eventually though you should see this

...
✔ Finishing install process
✔ Configuring Ghost
✔ Setting up instance
✔ Starting Ghost

Ghost uses direct mail by default. To set up an alternative email method read our docs at https://ghost.org/docs/concepts/config/#mail

------------------------------------------------------------------------------

Ghost was installed successfully! To complete setup of your publication, visit: 

    http://localhost:2368/ghost/

checking ghost worked

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <title>Ghost</title>
    <meta name="HandheldFriendly" content="True" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <link rel="stylesheet" type="text/css" href="/assets/built/screen.css?v=03cf02f054" />
</head>
<body>
    <div class="site-wrapper">

        <header class="site-header no-image">
            <div class="site-nav-main outer">
                <div class="inner">
                    <nav class="site-nav-center">
                        <a class="site-nav-logo" href="http://localhost:2368"><img src="https://static.ghost.org/v1.0.0/images/ghost-logo.svg"
                                alt="Ghost" /></a>
                    </nav>
                </div>
            </div>
        </header>

        <main id="site-main" class="site-main outer error-content">
            <div class="inner">

                <section class="error-message">
                    <h1 class="error-code">503</h1>
                    <p class="error-description">Site is starting up, please wait a moment then retry.</p>
                    <a class="error-link" href="http://localhost:2368">Go to the front page →</a>
                </section>


            </div>
        </main>
    </div>
</body>
</html>
Did you get a load of HTML? (Y/N):

Assuming you got a load of HTML answer Y (if not go to troubleshooting section). The script finishes up and you should do a local ghost setup by pasteing the http link (http://192.168.0.250/ghost/ in the example) into your browser.

Did you get a load of HTML? (Y/N): y
server {
	listen 80;
	listen [::]:80;

	server_name 192.168.0.250;

	location / {
        proxy_pass      http://localhost:2368/;
	}
}
Now go to http://192.168.0.250/ghost/ in your browser to create a ghost user etc.
server@micronetia:~ $

Note you can technically skip the setting up of ghost until later, but I don't recommend it because it's a security hole. Right now ghost is only accessible to computers on your local network so the fact that anyone can be the first person to sign up as the admin user is perfectly safe. Once you make it public though anyone could do that and that means anyone could be putting stuff on your blog (and locking you out at the same time). So at the very least create the admin user locally before you do anything else.

Troubleshooting

Section TBD sorry