GHOST博客部署记录

准备一台云服务器

我使用的是CentOS系统,官方建议Ubuntu,最好根据官方的来,CentOS确实有非常多坑。

安装node

1
2
yum install -y nodejs
node -v

1
2
3
npm cache clean -f
npm install n -g
n stable

安装成功,发现版本没有变化。需要将安装目录添加到环境变量

1
vim /etc/profile

保存后刷新

1
2
source /etc/profile
node -v

安装nginx

1
yum install -y nginx

安装yarn

官方的Yarn存储库会得到持续维护,并提供最新版本。要启用Yarn存储库并导入存储库的GPG密钥:

1
2
3
curl --silent --location https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo`
sudo rpm --import https://dl.yarnpkg.com/rpm/pubkey.gpg
yum install yarn

注意需要保证在公共目录下

安装 ghost-cli

1
yarn global add ghost-cli@latest

创建新用户

ghost 不能用root用户启动

1
2
3
adduser user_ghost
passwd user_ghost
su user_ghost

安装 ghost

1
2
3
4
5
6
7
8
# 创建目录
sudo mkdir /var/www/ghost
# 修改用户/用户组为刚才创建的用户
sudo chown user_ghost:user_ghost /usr/local/ghost
# 进入目录
cd /var/www/ghost
# 执行安装指令
ghost install

安装好后会要求输入一些配置,随后可以在配置文件中修改。注意还需要安装mysql,这里省略。

CentOS下启动会报错,使用下边指令启动。服务名称看安装时生成的,如上图红框,格式为ghost_[blogUrl].service

1
2
3
4
# 启动:
sudo systemctl start ghost_118.190.55.152.service
# 查看状态:
sudo systemctl status ghost_118.190.55.152.service
  1. CentOS 7 安装配置 Ghost
  2. Ghost 搭建博客笔记
  3. ghost报错问题及解决方法

作者:prik
永久链接: https://trzoey.github.io/blog-prik/java-blog/GHOST博客部署记录/
转载请注明出处,谢谢合作💓。