美文网首页
GHOST博客部署记录

GHOST博客部署记录

作者: prik丶 | 来源:发表于2021-01-08 09:56 被阅读0次

    记录一下捣鼓Ghost的过程。坑很多,好不容易捣鼓好了,却找不到一个好用的主题。还是Hexo香。

    原文链接: https://trzoey.github.io/blog-prik/java-blog/156964/

    准备一台云服务器

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

    安装node

    yum install -y nodejs
    node -v
    
    image
    npm cache clean -f
    npm install n -g
    n stable
    
    image

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

    vim /etc/profile
    
    image

    保存后刷新

    source /etc/profile
    node -v
    
    image

    安装nginx

    yum install -y nginx
    
    image

    安装yarn

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

    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
    

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

    image

    安装 ghost-cli

    yarn global add ghost-cli@latest
    

    创建新用户

    ghost 不能用root用户启动

    adduser user_ghost
    passwd user_ghost
    su user_ghost
    

    安装 ghost

    # 创建目录
    sudo mkdir /var/www/ghost
    # 修改用户/用户组为刚才创建的用户
    sudo chown user_ghost:user_ghost /usr/local/ghost
    # 进入目录
    cd /var/www/ghost
    # 执行安装指令
    ghost install
    
    image

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

    image

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

    # 启动:
    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报错问题及解决方法

    相关文章

      网友评论

          本文标题:GHOST博客部署记录

          本文链接:https://www.haomeiwen.com/subject/unmxaktx.html