To setup Ghost, you should be familiar with Linux and its common commands, such as Install Software via Apt-get under Ubuntu Environment.
This article uses the following software:
- Linux operating system. This article uses Ubuntu 18.04.
- Nginx 1.14.0 is used to provide web service.
- MySQL 5.7.27 is used for database.
- Node.js 10.17.0 is our runtime environment.
- Ghost 3.0.2
You should have a Linux CVM. If you have not purchased one yet, see Getting Started with Linux CVMs.
- A domain name that points to your CVM and already completed ICP filing.
Step 1 Logging in to a Linux instance
Step 2 Create a new user
- After logging in, switch to
root. Refer to this article for details.
- Run the following command to create a user named
Do not use
ghost as the username. It causes conflicts with Ghost-CLI.
- Input and confirm password as prompted. Password is not shown by default. Press Enter to continue.
- Input user information. Or press Enter to skip them and continue.
- Input Y to confirm and press Enter to complete the process, as shown below:
- Run the following command to add user privileges.
usermod -aG sudo user
- Run the following command to switch to user
Step 3 Update installed packages
Run the following commands to update installed packages.
Input the password for
user as prompted and press Enter to start.
sudo apt-get update
sudo apt-get upgrade -y
Step 4 Environment setup
Run the following command to install Nginx.
sudo apt-get install -y nginx
Install and configure MySQL
- Run the following command to install MySQL.
sudo apt-get install -y mysql-server
- Run the following command to connect to MySQL.
- Run the following command to create a database for Ghost named
CREATE DATABASE ghost_data;
- Run the following command to set a password for the database user
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'your_password';
- Run the following command to quit MySQL.
- Run the following command to set a default Node.js version to be used.
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash
- Run the following command to install Node.js.
sudo apt-get install -y nodejs
Run the following command to install Ghost-CLI which helps configuring Ghost.
sudo npm install ghost-cli@latest -g
Step 5 Install and configure Ghost
- Run the following commands.
sudo mkdir -p /var/www/ghost
sudo chown user:user /var/www/ghost
sudo chmod 775 /var/www/ghost
- Run the following command to install Ghost.
- Use the following image to complete the installation process.
- Enter your blog URL: input your domain name in the format of
- Enter your MySQL hostname: input your database address. Use
localhost in this case and press Enter.
- Enter your MySQL username: input the username you use to connect to MySQL. Use
root in this case and press Enter.
- Enter your MySQL password: input the corresponding password you set earlier and press Enter.
- Enter your database name: input the name of the database you created for Ghost in the previous step. Use
ghost_data and press Enter.
- Input Y or n to complete the configuration.
The admin URL appears on the bottom of the screen.
- Open a browser window on your local machine and visit the admin URL to start configuring your blog.
Click Create your account to create an admin account.
- Input desired information and click Last step, as shown below:
- You can invite others to create blogs, or skip this step.
- Go to the administration page to manage blogs, as shown below:
Once finished, use a browser to visit your domain name
www.xxxxxxxx.xx to see your blog, as shown below:
If you encounter a problem when using CVM, refer to the following documents for troubleshooting based on your actual situation.