Welcome to this step-by-step tutorial on how to install and set up a Ghost blog on AWS Lightsail. Ghost is a popular open-source publishing platform that is simple, lightweight, and designed specifically for bloggers. With AWS Lightsail, you can easily deploy your own Ghost blog in just a few simple steps.
Feel free to checkout the below video I made for this tutorial as well.
In this tutorial, we will walk you through the complete process of installing and configuring Ghost on an AWS Lightsail instance. By the end of this guide, you will have your own fully functional Ghost blog up and running.
Prerequisites
Before we begin, make sure you have the following:
- An AWS Lightsail account
- Basic knowledge of AWS Lightsail and its services
- A registered domain name (Optional)
Step 1: Create an AWS Lightsail Instance
The first step is to create an AWS Lightsail instance. Here's how you can do it:
1.Log in to your AWS Lightsail account and Click on the Create instance button.
2.Select your preferred instance location, operating system, and instance plan.
3.Click on the "Create" button to create the instance.
Once the instance is created, note down the public IP address of your instance. We will need it later.
Step 2: Connect to Your Lightsail Instance
To connect to your Lightsail instance, follow these instructions:
Open your terminal or SSH client. Use the following command to connect to your instance:
ssh -i path/to/your/key.pem ubuntu@your_instance_ip
Replace path/to/your/key.pem
with the path to your private key file, and your_instance_ip
with the public IP address of your instance.
Step 3: Update Packages and Install Dependencies
Once you are connected to your Lightsail instance, update the packages and install the necessary dependencies using the following commands:
sudo su
sudo apt update && apt upgrade -y
sudo apt-get install nginx mysql-server -y
sudo ufw allow 'Nginx Full'
Step 4: Install Nodejs, NPM and Ghost-CLI
Next steps is to install nodejs and npm which we'll doing using nodesource github repository:
sudo apt-get install ca-certificates curl gnupg -y
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
sudo apt-get update && sudo apt-get install nodejs -y
Next up, let's install Ghost-CLI package globally.
sudo npm install ghost-cli@latest -g
Step 5: Install and Configure Ghost
Now it's time to install and configure Ghost on your Lightsail instance. Follow these steps:
Create a new user with required permissions
adduser <user>
usermod -aG sudo <user>
su - <user>
Note: Using the user name ghost causes conflicts with the Ghost-CLI, so itβs important to use an alternative name.
Note: replace <user>
with the username of the username you want to add
Create a new directory, set correct permissions and navigate to it for your Ghost blog:
sudo mkdir -p /var/www/sitename
sudo chown <user>:<user> /var/www/sitename
sudo chmod 775 /var/www/sitename
cd /var/www/sitename
Install and Start Ghost:
ghost install
During the installation, Ghost-CLI will ask you a series of questions. Provide the following answers:
- Blog URL: Enter your domain name (e.g.,
https://your_domain.com
). - MySQL hostname: Press Enter to use the default value (
localhost
). - MySQL username / password: Enter the MySQL username and password you want to use for your Ghost blog.
- Ghost database name: Enter the name for your Ghost database. You can use the default value.
- Set up a Ghost MySQL user? (Recommended): Choose "Yes" to create a custom MySQL user for Ghost.
- Set up NGINX? (Recommended): Choose "Yes" to automatically set up NGINX for your Ghost blog.
- Set up SSL? (Recommended): Choose "Yes" if you have an SSL certificate for your domain. Otherwise, choose "No".
- Set up systemd? (Recommended): Choose "Yes" to use systemd as the process manager for Ghost.
Step 6: Access Your Ghost Blog
To access your Ghost blog, open a web browser and enter your domain name (e.g., https://your_domain.com
). You should see the Ghost setup page, where you can create your admin account and customize your blog.
Conclusion
Congratulations! Your Ghost blog is now up and running on your AWS Lightsail instance.
Feel free to checkout the below video I made for this tutorial as well.
Now it's time to start creating and publishing your own content on your brand new Ghost blog. Happy blogging!
Thank you for reading! If you found this blog post helpful, please consider sharing it with others who might benefit. Feel free to check out my other blog posts and visit my socials!
Top comments (0)