本文最后编辑于 前,其中的内容可能需要更新。
影子屋参考
nodejs-centos安装参考
nodejs-debian/ubuntu安装参考
rpm,deb包github仓库
npm 安装yarn
RSShub官方文档
1.环境配置
1.nodejs
编译安装容易报错,所以采用rpm,deb包安装
Centos
1 2 3 4 5 6 7 8 9
| sudo yum -y install curl #安装curl
curl -fsSL https://rpm.nodesource.com/setup_16.x | sudo bash - #下载rpm包,v16为稳定版
sudo yum install -y nodejs #安装nodejs
node -v #查看版本
npm -v #查看npm版本
|
装不上请更新epel仓库,参见华为云epel镜像
Debian/Ubuntu
1 2 3 4 5 6 7 8 9 10 11
| sudo apt update #更新apt包管理器
curl -sL https://deb.nodesource.com/setup_16.x | sudo bash - #下载deb包
cat /etc/apt/sources.list.d/nodesource.list #验证nodejs存储库是否添加
sudo apt -y install nodejs #安装nodejs
node -v #查看nodejs版本
npm -v #查看npm版本
|
2.yarn
npm也是经常报错,所以我选yarn
1 2 3 4 5 6 7
| npm install -g yarn --registry=https://registry.npm.taobao.org #npm使用淘宝源安装yarn
yarn config set registry https://registry.npm.taobao.org -g #更换淘宝源镜像
yarn config set sass_binary_site http://cdn.npm.taobao.org/dist/node-sass -g
yarn -v #查看yarn版本
|
1.安装git
1 2 3
| apt install -y git #debian/ubuntu
yum install -y git #centos
|
2.克隆仓库
网站运行目录克隆
1 2 3 4 5
| git clone https://github.com/DIYgod/RSSHub.git #官方github仓库
#其他的github镜像 git clone https://gitclone.com/github.com/DIYgod/RSSHub.git git clone https://github.com.cnpmjs.org/DIYgod/RSSHub.git
|
3.服务部署
1 2 3
| npm ci --production #npm
yarn install --production #yarn
|
1 2 3 4 5 6
| npm start #npm
yarn start #yarn
#或使用 PM2(opens new window) pm2 start lib/index.js --name rsshub
|
4.访问
访问
即可
5.反向代理
ip:端口而且不带https总归是不好看不好用不安全的所以使用宝塔来Nginx反向代理
配置好你的域名>>设置>>反向代理

6.使用方法
将rsshub.app域名替换为你自己的即可
3.开机自启动
1
| vim /etc/systemd/system/rsshub.service
|
没有vim就把vim换成vi或者使用SFTP到/etc/systemd/system/创建rsshub.service文件并编辑
vim使用方法
i键进入编辑模式
ESC键+:+wq:保存并退出
ESC键+:+q!:强制退出(不保存)
Shift+insert:粘贴
insert一般在退格键的右边
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| [Unit] Description=Rsshub After=network.target Wants=network.target
[Service] Type=simple WorkingDirectory=/www/wwwroot/rsshub.goojoe.cc #你的rsshub运行目录 ExecStart=/bin/bash -c 'yarn start' #启动命令,npm是npm start Restart=on-failure #User=rsshub #User和Group可以忽略,配置需要权限问题,删掉#号注释即可开启 #Group=rsshub
[Install] WantedBy=multi-user.target
|
- 执行命令
1 2 3
| systemctl daemon-reload #重载Systemd脚本 systemctl enable rsshub.service #开机自启动 systemctl status rsshub.service #查看状态
|
2.常用systemd命令
1 2 3 4 5 6
| systemctl daemon-reload #重载Systemd脚本 systemctl enable rsshub.service #开机自启动 systemctl disable rsshub.service #关闭开机自启动 systemctl start rsshub.service #启动 systemctl stop rsshub.service #停止 systemctl status rsshub.service #查看状态
|
4.其他
配置文件在lib/config.js
配置文档
完成以上安装后,可以生成大多数网站的RSS,但部分RSS需要单独配置后方可生成,如 pixiv、disqus、twitter、youtube、telegram、github
下面将以 pixiv 为例介绍相应的配置方法。
手动部署直接修改 systemd service 文件,在 Environment 中加入所需环境变量即可。可添加多个变量,变量之间使用空格分隔开来。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| [Unit] Description=Rsshub After=network.target Wants=network.target
[Service] Type=simple WorkingDirectory=/www/wwwroot/rsshub.goojoe.cc #你的rsshub运行目录 ExecStart=/bin/bash -c 'yarn start' #启动命令,npm是npm start Environment=PORT=1200 CACHE_TYPE=memory CACHE_EXPIRE=600 LISTEN_INADDR_ANY=0 PIXIV_USERNAME=user PIXIV_PASSWORD=password #在此加入环境变量,具体请看上面的配置文档 Restart=on-failure #User=rsshub #User和Group可以忽略,配置需要注意权限问题,删掉#号注释即可开启 #Group=rsshub
[Install] WantedBy=multi-user.target
|
协议
CC BY-SA 4.0
署名-相同方式共享(BY-SA):使用者可以对本创作进行转载、节选、混编、二次创作,可以将其运用于商业用途,唯须署名作者,并且采用本创作的内容必须同样采用本协议进行授权