In the past few days, I tried to install Ghost on my server, which is operated by Ubuntu OS. I considered using Hugo, WordPress, and Hexo before, but none of them attract me like Ghost, since Ghost can provide me with a powerful and beautiful private background, which offers me a more convenient way to manage my posts.
I had a very hard time figuring this out because all the online tutorials can not fit my situation. I understand that's probably due to the differences between my server and those tutorial writers. Fortunately, I didn't give up and finally figured this out. I was so pleased when I saw everything is working well on my terminal.
Then I want to share what did I do, this may help a few people who want to use Ghost to set up their website, but suffering similar difficulties.
Introduction of Ghost
Ghost is an open-source, professional publishing platform built on a modern Node.js technology stack — designed for teams who need power, flexibility, and performance.
Procedure
For my first tutorial, I'm assuming you can connect to your server, and know some basic command language of Linux operations.
Prerequisites:
- Ubuntu 16.04, Ubuntu 18.04, or Ubuntu 20.04
- A server with at least 1GB of memory
- A registered domain name
- Open the terminal of your server.
- Create a new user for your website.
Type in
sudo adduser <username> //replace <username> by your user name
!!!Caution: Do NOT use "ghost" as your username, this may cause some conflict in software!!!
3. Type in the password of this user.
4. Fill in the basic information about yourself.
5. Type "Y".
If nothing happened, then you are doing great so far.
6. Assign permissions to this new user.
sudo usermod -aG sudo <username> //replace <username> by your user name
If nothing happened, then you are doing great so far.
7. Log in as the new user.
su - <username>
Then type in your password. If there's no error reported, you are now operating as your new user account.
8. Update the list of software in apt.
sudo apt-get update
Then type in your password. Waiting for it to finish running.
9. Upgrade the list of software in apt.
sudo apt-get upgrade
10. Install Nginx
sudo apt-get install nginx
11. Configure the firewall.
sudo dfw allow 'Nginx Full'
12. Install MySQL.
sudo apt-get install mysql-server
13. Enter MySQL.
sudo mysql
14. Create a new user in MySQL.
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password'
//Replace the word, password, by the password you want to use.
//Keep the apostrophes.
15. Quit MySQL.
quit
16. Log in to your new user again.
su - <username>
Enter your password.
17. Download Node.js.
sudo curl -fsSL https://deb.nodesource.com/setup_14.x | sudo -E bash -
18. Install Node.js.
sudo apt-get install -y nodejs
19. Install the latest Ghost client.
sudo npm install ghost-cli -g
20. Check if Ghost is installed successfully.
ghost help
If it shows a lot of command lines, you are doing great right now.
If not, try to retype step 19 again.
21. Create a new folder to store the files of the website.
sudo mkdir -p /var/www/<your folder name>
22. Change the owner of the specified file to the specified user.
sudo chown <username>:<username> /var/www/<your folder name>
23. Modify the executions of your file.
sudo chmod 755 /var/www/<your folder name>/
24. Enter your new folder.
cd /var/www/<your folder name>/
25. Install Ghost in your new folder.
ghost install
26. Enter the URL of your blog.
27. Enter your MySQL hostname, username, and password.
If you follow my previous steps, your MySQL hostname should be "localhost", and your username should be "root".
28. Name your Ghost database.
29. Answer a few setting questions.
After entering your database name, a series of questions will pop up.
Do you wish to set up "ghost" mysql user?
Do you wish to set up Nginx?
Do you wish to set up SSL?
For these questions, you should type "Y" referring "Yes" to accept.
Then Enter your Email.
There come more questions:
Do you wish to set up systemed?
Do you want to start ghost?
As usual, we type in "Y" expressing agree.
30. Register your Ghost account.
After finishing all of the above, you can see a website. Click that, and you will see a ghost sign-up interface. Fill in the blank with your information.
Then you can see the background of your website. If you access your site now, you'll see something new.
If you follow the steps above, you will get a background interface like this.
Good luck! And you are very welcome to contact me via the button at the bottom of this page if you have any questions.
Comments