Ghost 是基于 Node.js 构建的开源博客平台,由前 WordPress UI 部门主管 John O’Nolan 和 WordPress 高级工程师(女) Hannah Wolfe 创立。Ghost 具有易用的书写界面和体验,博客内容默认采用Markdown 语法书写。Ghost 的目标是取代臃肿的 Wordpress。目的是为了给用户提供一种更加纯粹的内容写作与发布平台。
开始搭建Ghost博客系统1、本机测试环境
[linuxidc@localhost ~]$ cat /etc/RedHat-release
CentOS Linux release 7.5.1804 (Core)
[linuxidc@localhost ~]$ uname -r
3.10.0-862.el7.x86_64
2、 安装Node.js
#更新yum源
[root@mingc ~]# sudo yum update -y
#安装软件组包Development Tools
[linuxidc@localhost ~]$ sudo yum groupinstall -y "Development Tools"
#安装NodeSource Node.js 6.x repo
[root@localhost ~]# curl --silent --location https://rpm.nodesource.com/setup_6.x | bash -
#yum安装 nodejs
[root@localhost ~]# yum -y install nodejs
#npm国内镜像(npm是随同NodeJS一起安装的包管理工具)
[root@localhost ~]# npm config set registry https://registry.npm.taobao.org
#安装cnpm模块(因为国内网络的关系,也同时安装了 cnpm 模块,后续将使用该命令代替 npm 命令。)
[root@localhost ~]# npm i -g cnpm
#通过node -v 和npm -v命令查看是否安装成功。
[root@localhost ~]# node -v
v6.14.4
[root@localhost ~]# npm -v
3.10.10
[root@localhost ~]#
①安装 Ghost Client (ghost-cli)
[root@localhost ~]# cnpm i -g ghost-cli
#安装成功后通过运行 ghost -v,出现版本号即可表示安装成功。
[root@localhost ~]# ghost -v
Ghost-CLI version: 1.9.6
[root@localhost ~]#
②添加 Ghost 运行用户并创建目录
[root@localhost ~]# adduser ghost
[root@localhost ~]# mkdir /var/www
[root@localhost ~]# mkdir /var/www/ghost
[root@localhost ~]# chown ghost /var/www/ghost
③安装SQLite3 数据库
#新版本不允许root用户安装,需要切换普通用户进行安装。
[root@localhost ~]# su - ghost
[ghost@localhost ~]$ cd /var/www/ghost
[ghost@localhost ghost]$ ghost install local --db=sqlite3
✔ Checking system Node.js version
✔ Checking current folder permissions
✔ Checking memory availability
✔ Checking for latest Ghost version
✔ Setting up install directory
✔ Downloading and installing Ghost v2.3.0
✔ Finishing install process
✔ Configuring Ghost
✔ Setting up instance
ℹ Ensuring user is not logged in as ghost user [skipped]
ℹ Checking if logged in user is directory owner [skipped]
✔ Checking current folder permissions
✔ Validating config
✔ Checking memory availability
✔ Starting Ghost
Ghost uses direct mail by default. To set up an alternative email method read our docs at https://ghost.org/mail
------------------------------------------------------------------------------
Ghost was installed successfully! To complete setup of your publication, visit:
④启动 ghost
安装成功后 Ghost 默认就已经启动的
# 停止host
[ghost@localhost ghost]$ ghost stop
✔ Stopping Ghost
# 启动ghost
[ghost@localhost ghost]$ ghost start
#重启ghos
[ghost@localhost ghost]$ ghost restart
安装成功后默认是运行在:2368/
可使用如下方式访问:
[ghost@localhost ghost]$ curl :2368/