CentOS安装NodeBB

更新环境
yum -y update
yum -y install epel-release
安装基础软件
yum -y groupinstall “Development Tools”
yum -y install git redis ImageMagick npm
装NodeJS
yum remove nodejs
curl https://raw.githubusercontent.com/creationix/nvm/v0.13.1/install.sh | bash
source ~/.bash_profile
export NVM_NODEJS_ORG_MIRROR=http://npm.taobao.org/mirrors/node
export NVM_IOJS_ORG_MIRROR=http://npm.taobao.org/mirrors/iojs
nvm list-remote
nvm install v12.3.1
nvm use 12.3.1
nvm alias default 12.3.1
使用cnpm代替npmnpm
install -g cnpm --registry=https://registry.npm.taobao.org
启动Redis并设置开机自启
systemctl start redis
systemctl enable redis
安装NodeBB
cd /home/jiazhang/
git clone -b v1.12.2 https://github.com/NodeBB/NodeBB nodebb
cd nodebb
cnpm install
./nodebb setup # 一路配置 数据库改为Redis
firewall-cmd --zone=public --add-port=4567/tcp --permanent
firewall-cmd --reload
vim config.json

  • “url”: “http://ip:4567”,

./nodebb start
开机启动NodeBB
vim /usr/lib/systemd/system/nodebb.service
[Unit]
Description=NodeBB
Documentation=https://docs.nodebb.org
After=system.slice multi-user.target

[Service]
Type=forking
User=root
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=nodebb
WorkingDirectory=/home/jiazhang/nodebb
PIDFile=/home/jiazhang/nodebb/pidfile
ExecStart=/usr/bin/env node loader.js
Restart=always

[Install]
WantedBy=multi-user.target

env | grep NVM
ln -s /root/.nvm/v12.3.1/bin/node /usr/bin/node

systemctl daemon-reload
systemctl start nodebb
systemctl status nodebb
systemctl enable nodebb

相关推荐
©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页