Issue
Your hosting is up for renewal.
You have a spare Raspberry Pi and a fibre connection with a static IP address.
You are bored.
Hmmm...
Solution
Build a secure and surprisingly fast platform to blog from the comfort of your own home, with the following components:
- Raspberry Pi 2 (or 3+ if you one).
- Uncomplicated Firewall, adds a layer of security and comfort.
- Nginx, free, open-source, high-performance HTTP server and reverse proxy.
- MariaDB, popular database server.
- Ghost, lightweight and simple blogging platform - RECOMMENDED!
High Level Steps
- Update the system.
- Install the necessary software components.
- Configure the UFW firewall.
- Configure and secure MariaDB.
- Install Ghost.
- Configure Ghost.
- Start blogging.
Setup:
# Update the system.
sudo apt-get update && sudo apt-get dist-upgrade -y
# Install the necessary software components.
sudo apt-get install ufw, nginx, mariadb-server -y
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash
sudo apt-get install -y nodejs
# Configure the firewall.
sudo ufw allow from 10.10.1.110 to any port 22
sudo ufw allow 'Nginx Full'
sudo ufw enable
# Prepare for Ghost Install
# Make a new directory for Ghost and grant permissions.
sudo mkdir /var/www/ghost
sudo chown pi:pi /var/www/ghost
# Install Ghost-CLI.
sudo npm i -g [email protected]
Secure MariaDB Server:
# Configure and secure MariaDB.
sudo mysql_secure_installation
Follow the wizard and answer 'Yes' to the questions.
# Grant user root privileges so that Ghost CLI can create the databases automatically.
sudo mysql -u root -p
USE mysql
UPDATE user SET plugin='mysql_native_password' WHERE User='root';
FLUSH PRIVILEGES;
exit;
Configure Ghost:
# Create production Ghost instance.
cd /var/www/ghost
ghost install
Answer the section prompts as appropriate.
For details, check out the CLI reference cli-install#section-prompts
Ghost is now installed. Happy blogging!
Next Steps
Some things you should do,
- Secure your blog with SSL encryption.
- Cloudflare.
- Let's Encrypt.
- High Availability (Docker Swarm).
- Backup.