ghost64怎么装linux,CentOS 7.5上安装Node.js搭建Ghost个人博客

Ghost简介

Ghost 是基于 Node.js 构建的开源博客平台,由前 WordPress UI 部门主管 John O’Nolan 和 WordPress 高级工程师(女) Hannah Wolfe 创立。Ghost 具有易用的书写界面和体验,博客内容默认采用Markdown 语法书写。Ghost 的目标是取代臃肿的 Wordpress。目的是为了给用户提供一种更加纯粹的内容写作与发布平台。

488a7c3bc8e09f40380c0e73c9b0f4a0.png

开始搭建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

067d4639c0971f74757e429beb4118f5.png

2、 安装Node.js

#更新yum源

[root@mingc ~]# sudo yum update -y

2d1a57f887486ddbd30641f97147488e.png

#安装软件组包Development Tools

[linuxidc@localhost ~]$ sudo yum groupinstall -y "Development Tools"

973637b9c237003efe9b4cca25b5df69.png

#安装NodeSource Node.js 6.x repo

[root@localhost ~]# curl --silent --location https://rpm.nodesource.com/setup_6.x | bash -

61b61ab2f90f90dbf155be0fca6b0ae6.png

#yum安装 nodejs

[root@localhost ~]# yum -y install nodejs

f3d60a46ab6bb2ed28f5ec45aa0fe299.png

#npm国内镜像(npm是随同NodeJS一起安装的包管理工具)

[root@localhost ~]# npm config set registry https://registry.npm.taobao.org

#安装cnpm模块(因为国内网络的关系,也同时安装了 cnpm 模块,后续将使用该命令代替 npm 命令。)

[root@localhost ~]# npm i -g cnpm

c61e2f08d8509d3b8594557c68d32b8e.png

#通过node -v 和npm -v命令查看是否安装成功。

[root@localhost ~]# node -v

v6.14.4

[root@localhost ~]# npm -v

3.10.10

[root@localhost ~]#

ed93b83adbaaa0a7ae72cc5b41231cc5.png

3.、安装 Ghost

①安装 Ghost Client (ghost-cli)

[root@localhost ~]# cnpm i -g ghost-cli

#安装成功后通过运行 ghost -v,出现版本号即可表示安装成功。

b8b88f276ad86331c26487d23b417c4a.png

[root@localhost ~]# ghost -v

Ghost-CLI version: 1.9.6

[root@localhost ~]#

8b01938e92b0801f7e8e9bec9da908f7.png

②添加 Ghost 运行用户并创建目录

[root@localhost ~]# adduser ghost

[root@localhost ~]# mkdir /var/www

[root@localhost ~]# mkdir /var/www/ghost

[root@localhost ~]# chown ghost /var/www/ghost

692ef0686d1f5fda7b678c6a4aa6088e.png

③安装SQLite3 数据库

#新版本不允许root用户安装,需要切换普通用户进行安装。

[root@localhost ~]# su - ghost

[ghost@localhost ~]$ cd /var/www/ghost

7bf52b9f5c64186ae1eb17da141d4470.png

[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:

ed15b096df55930f873f74b757874515.png

④启动 ghost

安装成功后 Ghost 默认就已经启动的

# 停止host

[ghost@localhost ghost]$ ghost stop

✔ Stopping Ghost

# 启动ghost

[ghost@localhost ghost]$ ghost start

#重启ghos

[ghost@localhost ghost]$ ghost restart

安装成功后默认是运行在http://localhost:2368/

可使用如下方式访问:

[ghost@localhost ghost]$ curl http://localhost:2368/

3b1fbaae19464e273b1d6458295fa958.png

4. 安装 Nginx和整合nodejs

[ghost@localhost ghost]$ su - root

[root@localhost ~]# yum install -y nginx

#启动 Nginx

[root@localhost ~]# systemctl start nginx.service

#查看nginx是否运行

[root@localhost ~]# ps -ef|grep nginx

f5a1297a628a7be54b2be2677822e6d7.png

#查看是否启动成功 http://你的ip

491727b1c6929bdf2cc5ade65aaefa2a.png

#设置开机自启动

[root@localhost ~]# systemctl enable nginx.service

#整合nodejs

[root@localhost ~]# 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@localhost ~]# nginx -s reload

5. 访问搭建的ghost博客

前台页面:http://你的ip/

20992c92fffe18b5c53a42bbb6a33426.png

host博客

后台登录页面:http://你的ip/ghost

c70b74e31e5a51563e8f57daebab0fa1.png

后台管理页面:

f7b9e6a5f51fb5821cb6e41964fc0e61.png

Ghost作为一个新兴的博客系统肯定会有一些不足,但是我们相信它会越来越好的,希望大家都能用它来记录生活中一些美好的时刻,分享自己的精彩的创意,共同建立并且维护这样一个和谐的互联网大家庭。

以上搭建过程本人亲自操作可用,有问题可留言评论。

0b1331709591d260c1c78e86d0c51c18.png

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值