Ghost is a lightweight open source blogging platform. It is fully customizable and has many themes available.
Using Tencent Cloud's one-click Ghost application, you can pre-install Tencent [CVM] (https://cloud.tencent.com/product/cvm?from=10680) with Ghost. There are some command lines to complete the installation, and then you can use a simple and powerful secure blog tool that allows you to manage your daily writing through its web interface. If you only want to set up from a web browser, you may prefer to start with an account with Ghost hosting.
To follow all the steps in this tutorial, you need:
When you set the domain name on Tencent Cloud, you can start.
Start with the creation of Ghost Tencent CVM. In the "Choose Image" section, click the "Click" Application tab and select the Ghost image on **16.04.
Next, choose the size, region and any other settings (such as private network, IPv6 support or backup). If you want, you can add any SSH keys and customize the hostname for CVM. When ready, click "Create Tencent CVM" to start the server.
After creating the CVM, please visit http://your_server_ip
in the web browser. You will see a placeholder page that says Please log in to your Tencent CVM via SSH to configure Ghost installation.
This security measure is in place to protect the initial configuration of Ghost, and anyone who visits the site can create administrative users.
Once you know the IP address of your Ghost Tencent CVM, you need to add an A name record for your blog. To do this, please use the "Network" link in the main navigation to find the domain name you want to use from the "Domains" list. You will reach the A name record creation page.
We plan to host our new blog at https://blog.digitalocean.love
, we will enter blog
as our hostname. The domain name will be attached automatically. Then we will select our new Ghost Tencent CVM from the list in the Will Direct To list. Finally, we will keep the default value of TTL (seconds) and click Create Record:
Now that we have established a connection between our domain name and Tencent CVM, we are ready to continue.
After creating Tencent CVM, you can connect to CVM as root via SSH to access it. This will enable Ghost installation on CVM.
Open the terminal on the computer and log in to Tencent CVM as root via SSH. Be sure to replace the IP address of Tencent CVM.
ssh root@your_server_ip
If you are prompted to enter a password, please enter the password sent to you via email when you created the Tencent CVM, and then follow the prompts on the screen to change the temporary password. If you use SSH keys to set up Tencent CVM, the keys will be used for authentication.
Before we start working in a web browser, we will get the latest version and secure the site with SSL from the terminal.
The Ghost project has developed rapidly, adding new features and ensuring the security of the software. In this step, we will ensure that we have the latest version.
To manage Ghost, we need to be a ghost-mgr
user, so we will switch to it with the following command:
sudo -i -u ghost-mgr
Next, we will switch to the directory where Ghost is installed:
cd /var/www/ghost
Once here, we will run its update command:
ghost update
If an update is required, we will receive output similar to the following:
✔ Checking for latest Ghost version
✔ Downloading and updating Ghost to v1.9.0
Running sudo command: systemctl stop ghost_203-0-113-0
✔ Stopping Ghost
✔ Linking latest Ghost and recording versions
Running sudo command:-E -u ghost /usr/lib/node_modules/ghost-cli/node_modules/.bin/knex-migrator-migrate --init --mgpath /var/www/ghost/current
[2017- 09- 2520:47:36] INFO Finished database migration!
✔ Running database migrations
✔ Validating config
Running sudo command: systemctl stop ghost_203-0-113-0
✔ Restarting Ghost
ℹ Removing old Ghost versions [skipped]
If Ghost is up to date, we will receive confirmation:
✔ Checking system Node.js version
✔ Checking current folder permissions
✔ Checking folder permissions
✔ Checking file permissions
✔ Checking content folder ownership
✔ Checking for available migrations
✔ Checking for latest Ghost version
All up to date!
In either case, when the script completes, we will return to the command prompt.
Next, we want to make sure to encrypt our username and password when logging in to the website, so we will run Ghost's installation script. Some of the output is quite technical, so we will step through the script and guide you through the choices you need to make.
We first start by issuing the setup
command in the /var/www/ghost
directory:
ghost setup
We will enter the URL of our blog when answering the first question. Please be sure to enter your domain name:
Output? Enter your blog URL: http://blog.digitalocean.love
After that, we will be asked a few questions about [MySQL] (https://cloud.tencent.com/product/cdb?from=10680) and the database. These settings have been configured on our Tencent CVM, so we can accept the given values:
Output? Enter your MySQL hostname: localhost
? Enter your MySQL username: ghost
? Enter your MySQL password(skip to keep current password):[hidden]? Enter your Ghost database name: ghost_production
✔ Configuring Ghost
✔ Setting up instance
Running sudo command: chown -R ghost:ghost /var/www/ghost/content
✔ Setting up "ghost" system user
When the script asks about setting up a mysql user, one has already been set up, so we will enter n
. :
ghost setup continuedDo you wish to set up "ghost" mysql user? n
Next, in order to make our website production-ready, when we are prompted to set up Nginx, we will accept the default value, Y
.
ghost setup continued? Do you wish to set up Nginx?(Y/n)Y
Once we say yes, the script will set up the configuration file:
Output✔ Creating nginx config file at /var/www/ghost/system/files/blog.digitalocean.love.conf
Running sudo command: ln -sf /var/www/ghost/system/files/blog.digitalocean.love.conf /etc/nginx/sites-available/blog.digitalocean.love.conf
Running sudo command: ln -sf /etc/nginx/sites-available/blog.digitalocean.love.conf /etc/nginx/sites-enabled/blog.digitalocean.love.conf
Running sudo command: nginx -s reload
✔ Setting up Nginx
The next choice we need to make is whether to set up SSL with Let's Encrypt.
Similarly, the default is "Yes". We can press ENTER
or Y
key to operate. After that, we will provide an email address to receive information about our security certificate.
? Do you wish to set up SSL? Y
? Enter your email(used for Let's Encrypt notifications)[email protected]
This script will provide feedback when our website is protected. It is normal for the certificate to be generated for a few minutes.
✔ Creating ssl security parameters file at /var/www/ghost/system/files/ssl-params.conf
✔ Creating ssl config file at /var/www/ghost/system/files/ghost.digitalocean.love-ssl.conf
Running sudo command: ln -sf /var/www/ghost/system/files/ghost.digitalocean.love-ssl.conf /etc/nginx/sites-available/ghost.digitalocean.love-ssl.conf
Running sudo command: ln -sf /etc/nginx/sites-available/ghost.digitalocean.love-ssl.conf /etc/nginx/sites-enabled/ghost.digitalocean.love-ssl.conf
Running sudo command: service nginx restart
✔ Setting up SSL
After setting up SSL, we will ask if we want to set up Systemd. This is already configured, so we will say No
:
? Do you wish to set up Systemd? No
ℹ Setting up Systemd [skipped]
Running sudo command:-E -u ghost /usr/lib/node_modules/ghost-cli/node_modules/.bin/knex-migrator-migrate --init --mgpath /var/www/ghost/current
[2017- 09- 2521:11:48] INFO Finished database migration!
✔ Running database migrations
Ghost is already running so we will say No
to start it because we received an error.
? Do you want to start Ghost? No
We really need to restart it, so we will use the following command:
sudo systemctl restart ghost\*
At this point, we have completed the command line work, and we will switch to the web browser.
In a web browser, we will visit the website to protect the administrative account of the website. No matter if the URL we enter starts with http://
or https://
, we will be redirected to https://
.
To enter the settings dialog box, please access the /ghost
page by entering https://your_server_domain/ghost
in the web browser:
From here, you can set up a management account in accordance with Ghost's workflow, after which you will have a fully working Ghost blog. You are ready to start using Ghost. In addition, we recommend that you follow our initial server setup guide to create a user with sudo
permissions, lock root login, and take other steps to make your Tencent CVM ready for production.
**Note: **Whether you are managing Tencent CVM itself as a root user or using a sudo user as suggested in the "Initial Server Setup" guide, you always need to be the person who manages the installation of Ghost by becoming ghost-mgr
:
sudo -i -u ghost-mgr
Tencent Cloud’s Ghost one-click application helps you start blogging with Ghost, and your Tencent CVM is set up to make it as easy as possible for you to take care of your blog for a long time.
There are many other options for customization with Ghost. See Ghost document for more information. Keep in mind that in some cases, such as when installing themes or upgrading, you may need to stop, start or restart Ghost.
For more Ubuntu tutorials, please go to [Tencent Cloud + Community] (https://cloud.tencent.com/developer?from=10680) to learn more.
Reference: "How To Set Up the DigitalOcean Ghost One-Click Application for Ubuntu 16.04"
Recommended Posts