About the deployment of Node.js environment and build Ghost blog system detailed tutorial: [cloud computing 1024 kinds of gameplay] seventh recruit: deployment of Node.js environment and build Ghost blog system

preface

Ghost 1.0 is a strong update, bringing a new editor, a new background UI, a new default theme, night mode, and more. Also Ghost 1.0. Supporting Ghost- CLI a very powerful and convenient tool, can be more convenient through the command line to set up Nginx, Mysql, SQlite3 or boot and so on. However, the installation of Ghost 1.0 also brings a major update, which is different from previous versions.

The tutorial

Student users can purchase ECS with certain configuration after student authentication on aliyun official website, only 9.9 yuan per month, student users do not need to worry about spending too much on the server.

Student users can purchase at the relevant website after passing the student certification: You can go to https://promotion.aliyun.com/ntms/campus2017.html, bought the server just registered good account management in the management console to check the server and some of its configuration.

2. Prepare control software

Next, we need to install a software called PuTTY on our computer for remote connection and management of our servers on Aliyun ECS.

PuTTY is a remote login terminal tool. It can run on different platforms and simulate xterm terminals in Both Win32 and Unix systems.

Here attach the download address: https://github.com/larryli/PuTTY/releases note: the host name or IP address fill in the column ali cloud server on ECS public IP address.

Then install FileZilla, a great cross-platform FTP software. Just declare the SFTP :// protocol in the host bar, and you can connect and see the directory on the remote Linux.

This tutorial is suitable for: Ubuntu 16.04/14.04 and Debian 8/9, using the database engine SQLite3 as an example.

Update the system and install dependencies

Update the system first and install the required dependencies:

apt-get update && apt-get upgrade apt-get install apt-transport-https lsb-release ca-certificates unzip wget curl sudo Sqlite3 nginx installs Node.js

Here is an example of installing Node.js V6 LTS. Currently V8 is not supported by Ghost because it has not entered the TLS cycle.

curl -sL https://deb.nodesource.com/setup_6.x | bash –

apt-get install nodejs image

Installation of Yarn

Yarn, like NPM, is a dependent installation software of Node. js, but it is faster, safer and more reliable.

curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add – echo “deb https://dl.yarnpkg.com/debian/ stable main” | tee /etc/apt/sources.list.d/yarn.list apt-get update && apt-get install yarn image

Use Taobao Source

Both yarn and NPM software sources are foreign, so the download speed is slow or not moving at all. Fortunately, Taobao provides acceleration, so that domestic servers can also accelerate the experience. Npm uses Taobao source:

npm –registry https://registry.npm.taobao.org info underscore image

Yarn Use Taobao source:

yarn config set registry https://registry.npm.taobao.org image

Add ghost Account

To avoid permission issues and security Settings for ghost later, create a Ghost account

adduser ghost image

Then give ghost user sudo permission:

Usermod -AG Sudo Ghost then switch to ghost account:

su ghost Ghost-cli

Use Taobao source to install Ghost- CLI:

sudo npm install -g ghost-cli –registry=https://registry.npm.taobao.org image

Create the /data/wwwroot/ghost directory to hold ghost files and give permissions to ghost users and groups

/data/wwwroot/ghost sudo chown ghost:ghost /data/wwwroot/ghost CD /data/wwwroot/ghost

Install Ghost with SQLite3 as database:

sudo ghost install –db=sqlite3 image

If you want to install Ghost with MySQL as database:

Sudo ghost install will then install the dependency package, and finally the command line will do some setup questions: fill in your domain name or IP: image Let’s Encrypt will be used to issue the certificate: image will be enabled for Ghost, image will be enabled for Ghost

Then our Ghost installation is complete, open the domain name to have a look! You can use the following command to manage:

Ghost systemctl restart nginx # restart nginx systemctl start Nginx # start nginx systemctl stop nginx # start nginx systemctl stop nginx # start nginx systemctl stop nginx # start nginx systemctl stop nginx # stop nginx

Go to the background http://ecs public IP address /admin and set it

image

image

After entering the background, click On New Story to start blogging! image

Click Publish with the top corner of the edit page to Publish the image

Go back to the homepage, and you’ll see the new post.

Official website of Ali Yun University (Official website of Ali Yun University, Innovative Talent Workshop under cloud Ecology)