Description of Ghost
Ghost 是基于 Node.js 构建的开源博客平台。Ghost 具有易用的书写界面和体验,博客内容默认采用Markdown 语法
书写。Ghost 的目标是取代臃肿的 Wordpress。
Build Ghost Blog System
1. Local test environment
[root@mingc ~]# cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)
[root@mingc ~]# uname -r
3.10.0-514.26.2.el7.x86_64
2. Install Node.js
#更新yum源
[root@mingc ~]# yum update -y
#安装软件组包Development Tools
[root@mingc ~]# yum groupinstall -y "Development Tools"
#安装NodeSource Node.js 6.x repo
[root@mingc ~]# curl --silent --location https://rpm.nodesource.com/setup_6.x | bash -
#yum安装 nodejs
[root@mingc ~]# yum -y install nodejs
#npm国内镜像(npm是随同NodeJS一起安装的包管理工具)
[root@mingc ~]# npm config set registry https://registry.npm.taobao.org
#安装cnpm模块(因为国内网络的关系,也同时安装了 cnpm 模块,后续将使用该命令代替 npm 命令。)
[root@mingc ~]# npm i -g cnpm
#Check whether the installation is successful through the node -v and npm -v commands.
3. Install ghost
① Install Ghost Client (ghost-cli)
[root@mingc ~]# cnpm i -g ghost-cli
#安装成功后通过运行 ghost -v,出现版本号即可表示安装成功。
[root@mingc ~]# ghost -v
Ghost-CLI version: 1.7.1
②Add Ghost running user and create a directory
[root@mingc ~]# adduser ghost
[root@mingc ~]# mkdir /var/www
[root@mingc ~]# mkdir /var/www/ghost
[root@mingc ~]# chown ghost /var/www/ghost
③ Install SQLite3 database
#新版本不允许root用户安装,需要切换普通用户进行安装。
[root@mingc ~]# su - ghost
[ghost@mingc ~]$ cd /var/www/ghost
[ghost@mingc ~]$ ghost install local --db=sqlite3
④Start Ghost
After the installation is successful, Ghost has been started by default
# 停止host
[ghost@mingc ghost]$ ghost stop
# 启动ghost
[ghost@mingc ghost]$ ghost start
#重启ghos
[ghost@mingc ghost]$ ghost restart
After successful installation, the default is to run at http://localhost:2368/,
which can be accessed as follows:
[ghost@mingc ghost]$ curl http://localhost:2368/
4. Install Nginx and integrate nodejs
[ghost@mingc ghost]$ su - root
[root@mingc ~]# yum install -y nginx
#启动 Nginx
[root@mingc ~]# systemctl start nginx.service
#查看nginx是否运行
[root@mingc ~]# ps -ef|grep nginx
#查看是否启动成功 http://你的ip
#设置开机自启动
[root@mingc ~]# systemctl enable nginx.service
#整合nodejs
[root@mingc ~]#cp /etc/nginx/nginx.conf /etc/nginx/nginx.conf.ori
[root@mingc nginx]# vi /etc/nginx/nginx.conf +47
server {
···
location / {
proxy_pass http://127.0.0.1:2368;
proxy_redirect default;
root /usr/share/nginx/html;
index index.html index.htm;
}
···
[root@mingc nginx]# nginx -s reload
4. Visit the front page of the ghost blog built : http://your ip/
background login page: http://your ip/ghost
background management page:
The above construction process can be operated by myself. If you have any questions, you can leave a comment and take the time to answer it. If you think it is useful, give it a like and support the author!