Instructions for installing Ghost on an Orange Pi 5
Prior to switching my blog over to Hugo, I was running a Ghost install on an OrangePi. This tutorial might be helpful to you should you try to do the same.
This tutorial is an amalgamation of instructions found at https://ghost.org/docs/install/ubuntu/, other sources online, a lot of trial and error, tons of hours, but eventually this is what worked for me.
- Install the Orange Pi Ubuntu server release from http://www.orangepi.org/html/hardWare/computerAndMicrocontrollers/service-and-support/Orange-pi-5.html. I’m using Orange Pi 1.2.0 Jammy server. Username and password are orangepi by default. After burning the image to a microSD using Balena Etcher, boot off the card, find the ip address in the router, and then log in with Termius (that’s the program I’m most familiar with). Do the following to install to the NVME drive, remove the card, and off you go!
sudo orangepi-config
Then choose System->Install->Boot from SPI and install the new updated boot loader to the SPI flash.
- Change the IP address to static using the orangepi-config command.
sudo orangepi-config
Select Network, then IP, then static, and then configure to a static IP of your choosing.
- Install and set up a Cloudflare Tunnel on your Orange Pi. I recommend watching this tutorial: https://www.youtube.com/watch?v=ey4u7OUAF3c
Then, point your domain to the IP address of your Orange Pi.
- Install MySQL by following steps 3-5 from https://www.linode.com/docs/guides/install-and-configure-mysql-on-ubuntu-22-04/
sudo apt install mysql-server
sudo service mysql status
sudo cat /etc/mysql/debian.cnf
- Configure MySQL (ghost_database can be named anything). Take note of the user and password from the last step, you’ll need it next
mysql -u USERFROMABOVE -p
PASSWORDFROMABOVE
CREATE DATABASE ghost_database;
USE database_name;
CREATE USER 'PUT USERNAME HERE'@'localhost' IDENTIFIED BY 'PUT A PASSWORD HERE';
GRANT ALL PRIVILEGES ON ghost_database.* TO 'PUT USERNAME HERE'@'localhost';
flush privileges;
quit;
- Install NGINX
sudo apt-get install nginx
- Download and import the Nodesource GPG key
sudo apt-get update
sudo apt-get install -y ca-certificates curl gnupg
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
NODE_MAJOR=18
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list
sudo apt-get update
sudo apt-get install nodejs -y
- Install Ghost-CLI per https://ghost.org/docs/install/ubuntu/
sudo npm install ghost-cli@latest -g
- Install Ghost per Install Ghost-CLI per https://ghost.org/docs/install/ubuntu/
# Create directory: Change `sitename` to whatever you like
sudo mkdir -p /var/www/sitename
# Set directory owner: Replace <user> with the name of your user
sudo chown <user>:<user> /var/www/sitename
# Set the correct permissions
sudo chmod 775 /var/www/sitename
# Then navigate into it
cd /var/www/sitename
- Run the install process per https://ghost.org/docs/install/ubuntu/:
ghost install
- Enter the URL.
- Keep MySQL hostname as localhost.
- MySQL username / password / Ghost database name should be the same as created in #4 above.
- Set up NGINX? No, we’ll do this manually.
- Set up SSL? No, because Cloudflare does that for us.
- Set up systemd? Yes
- Start Ghost? Yes
- Configure NGINX Manually per https://vexxhost.com/resources/tutorials/how-to-install-host-ghost-with-nginx-on-ubuntu/ (this might not be exact, I had to mess around a bit to figure it out, but I think this will work)
cd /etc/nginx/
cd sites-available
sudo rm default
sudo touch ghost
cd ..
cd sites-enabled
sudo rm default
- Edit NGINX per https://vexxhost.com/resources/tutorials/how-to-install-host-ghost-with-nginx-on-ubuntu/ by using
sudo nano /etc/nginx/sites-available/ghost
- Paste the following and exit save:
server {
listen 0.0.0.0:80;
server_name bershatsky.net;
access_log /var/log/nginx/ghost.log;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://127.0.0.1:2368;
proxy_redirect off;
}
}
- Create a symbolic link to activate the configuration.
sudo ln -s /etc/nginx/sites-available/ghost /etc/nginx/sites-enabled/ghost
- Increase upload size for NGINX by editing /etc/nginx/nginx.conf
sudo nano /etc/nginx/nginx.conf
then add the following line under http. More info here: https://nginx.org/en/docs/http/ngx_http_core_module.html#client_max_body_size
client_max_body_size 1000m;
- Restart NGINX
sudo systemctl restart nginx
- Install vsftpd per https://ubuntu.com/server/docs/service-ftp
sudo apt install vsftpd
- Edit /etc/vsftpd.conf to enable writes (delete the # before write_enable).
write_enable=YES
- Allow root access by editing /etc/ftpusers then remove root from the list.
- Enable root user by creating a password per https://linuxize.com/post/how-to-enable-and-disable-root-user-account-in-ubuntu/ You’ll log into FTP as root then th password that you’ll create.
sudo passwd root
- Restart vsftpd
systemctl restart vsftpd
- Reboot / Backup / Whatever
Read other posts