说明:PyOne
最近凭着离线下载(完成并自动上传至Onedrive
)和绑定多网盘的功能被越来越多的人使用,如果你还不知道PyOne
是何物的可以查看该教程→点击查看。作者更新也勤奋,所以得支持一下,之前博主发过基于宝塔的手动安装教程和Docker
安装教程,查看:手动安装、Docker安装。不过由于宝塔的Mongodb
很容易出错,有些小白也不会解决,而Docker
也不支持OpenVZ
,所以博主写了个一键脚本,这里分享下。
脚本说明
#脚本会一键安装PyOne所需要的Mongodb、Redis、Aria2等环境,域名使用Caddy反代,自动配置SSL证书。
#本脚本使用的Aria2为某大佬编译的多线程版本,其特点可以将下载速度最大化优化,博主已配置完毕,如服务器性能不足,可将线程自行调整。
方法:修改配置文件/root/.aria2/aria2.conf,线程参数split=64,请自行调整。
#Aria2已添加了BT-Trackers服务器,并定时自动更新服务器地址。
#脚本使用systemctl替换了程序所使用的supervisord进程守护,所以程序的重启等命令会和官方文档上的不一样,详细的使用命令可以看文章后面。
#选择域名访问的,需要提前让解析生效,不然脚本会自动断开,因为后面需要签发SSL证书,ip必须为服务器ip。
更新
【2020.05.21】
修复安装问题,重新支持CentOS 7系统,安装有问题可以留言。
【2020.02.14】
由于程序模块改动,手动改了下,不过只限于Debian 9、10,Ubuntu 18.04、18.10、19.04系统安装使用
【2019.9.28】
新增Debian 10,升级MongoDB版本到4.0,有问题可以留言。
【2019.6.27】
修复部分CentOS 7安装出错的问题,并新增Ubuntu系统,已在Vultr的Ubuntu 16.04、18.04、18.10、19.04上测试通过
【2019.2.23】
鉴于有人需要3.0版本,现已增加安装3.0版本选项,多个选择,并使用的3.0最后一个版本。
【2019.2.16】
修改脚本部分安装步骤,使其支持PyOne4.0
【2019.1.31】
修复部分系统安装启动pyone失败的问题
【2018.11.30】
修复PyOne刷新不出文件夹/文件的问题。
安装
系统要求:CentOS 7
、Debian 8+
、Ubuntu 16+
,建议Debian 9
,且为刚安装好的系统,尽量不要用精简版系统。
使用命令:
wget -N --no-check-certificate https://www.moerats.com/usr/shell/PyOne/PyOne.sh
bash PyOne.sh
根据需求选择是否使用域名访问,然后输入域名和Aria2
密匙即可。
安装完成后,如果打不开网站的,可以使用命令一起查看下各程序状态。
#使用域名访问的
systemctl status aria2 mongod redis-server pyone caddy
#使用IP访问的
systemctl status aria2 mongod redis-server pyone
如果有显示Active:inactive
的,可以留言说下具体程序和系统。反之如果都为running
,可以检查下防火墙端口,比如阿里云,谷歌云等,还需要在服务器管理面板上开放34567
端口才行。
相关命令
#以下程序均已配置开机自启,所以就不说开机自启命令了。
#Redis使用命令
启动:systemctl start redis-server
重启:systemctl restart redis-server
停止:systemctl stop redis-server
状态:systemctl status redis-server
#Mongodb使用命令
启动:systemctl start mongod
重启:systemctl restart mongod
停止:systemctl stop mongod
状态:systemctl status mongod
#Aria2使用命令
启动:systemctl start aria2
重启:systemctl restart aria2
停止:systemctl stop aria2
状态:systemctl status aria2
#Caddy使用命令(使用域名的才会安装Caddy)
启动:systemctl start caddy
重启:systemctl restart caddy
停止:systemctl stop caddy
状态:systemctl status caddy
#PyOne使用命令
启动:systemctl start pyone
重启:systemctl restart pyone
停止:systemctl stop pyone
状态:systemctl status pyone
相关目录
PyOne程序目录:/root/PyOne
Caddy配置文件目录:/root/.caddy
Aria2配置文件目录:/root/.aria2
相关说明
#关于操作说明
由于更换了原程序进程守护,所以网站右上角的重启网站按钮已失效,请在SSH客户端使用systemctl restart pyone命令重启程序。
#关于离线下载
Aria2配置文件的下载路径为/root/Download,但该程序自带的离线下载不调用配置文件,所以使用本程序离线下载的目录为/root/PyOne/upload。
由于本程序离线下载不调用配置文件,所以Aria2多线程可能会发挥不出来,BT服务器也无效,不过会玩的,可以通过修改根目录的aria2.py文件某些参数达到目的,或者直接研究该教程:https://www.moerats.com/archives/697/,使用Aria2面板来离线下载更好,毕竟后者用的脚本比自带离线下载更稳定。
#刷新缓存问题
如果你在后台执行缓存刷新操作,可能短时间不会生效,建议直接在SSH客户端使用python /root/PyOne/function.py UpdateFile命令刷新
最后更多的使用方法(包括程序更新)可以查看该教程→点击查看,除了PyOne
启动命令不一样以外,其它都一样,包括上传等命令。
问下这是什么原因呢?我试了作者的宝塔一键脚本,也试了您的,但是都是拒绝访问,
无法访问此网站198.211.9.198 拒绝了我们的连接请求。
请试试以下办法:
检查网络连接
检查代理服务器和防火墙
我确认防火墙是打开了的。能帮我看下吗?
● pyone.service - pyone
Loaded: loaded (/etc/systemd/system/pyone.service; enabled; vendor preset: disabled)
Active: failed (Result: start-limit) since Tue 2020-02-11 11:30:42 CST; 31s ago
Process: 31233 ExecStart=/bin/gunicorn -w4 -b 0.0.0.0:34567 run:app (code=exited, status=1/FAILURE)
Main PID: 31233 (code=exited, status=1/FAILURE)
Feb 11 11:30:42 racknerd-9d5f60 systemd[1]: Unit pyone.service entered failed state.
Feb 11 11:30:42 racknerd-9d5f60 systemd[1]: pyone.service failed.
Feb 11 11:30:42 racknerd-9d5f60 systemd[1]: pyone.service holdoff time over, scheduling restart.
Feb 11 11:30:42 racknerd-9d5f60 systemd[1]: Stopped pyone.
Feb 11 11:30:42 racknerd-9d5f60 systemd[1]: start request repeated too quickly for pyone.service
Feb 11 11:30:42 racknerd-9d5f60 systemd[1]: Failed to start pyone.
Feb 11 11:30:42 racknerd-9d5f60 systemd[1]: Unit pyone.service entered failed state.
Feb 11 11:30:42 racknerd-9d5f60 systemd[1]: pyone.service failed.
Hint: Some lines were ellipsized, use -l to show in full.
好像是有个模块出了问题,我手动改了下,目前debian和ubuntu安装正常。
额,咋这么多出问题的,我先测试下。
● pyone.service - pyone
Tasks: 5 (limit: 4915)Loaded: loaded (/etc/systemd/system/pyone.service; enabled; vendor preset: enabled)
Active: active (running) since Mon 2020-02-10 11:48:06 UTC; 887ms ago
Main PID: 11211 (gunicorn)
CGroup: /system.slice/pyone.service
├─11211 /usr/bin/python /usr/local/bin/gunicorn -w4 -b 0.0.0.0:34567 run:app ├─11215 /usr/bin/python /usr/local/bin/gunicorn -w4 -b 0.0.0.0:34567 run:app ├─11217 /usr/bin/python /usr/local/bin/gunicorn -w4 -b 0.0.0.0:34567 run:app ├─11219 /usr/bin/python /usr/local/bin/gunicorn -w4 -b 0.0.0.0:34567 run:app └─11221 /usr/bin/python /usr/local/bin/gunicorn -w4 -b 0.0.0.0:34567 run:appFeb 10 11:48:06 web gunicorn[11211]: File "/usr/local/lib/python2.7/dist-packages/gunicorn/app/wsgiapp.py", line
Feb 10 11:48:06 web gunicorn[11211]: return util.import_app(self.app_uri)
Feb 10 11:48:06 web gunicorn[11211]: File "/usr/local/lib/python2.7/dist-packages/gunicorn/util.py", line 355, in
Feb 10 11:48:06 web gunicorn[11211]: __import__(module)
Feb 10 11:48:06 web gunicorn[11211]: File "/root/PyOne/run.py", line 7, in <module>
Feb 10 11:48:06 web gunicorn[11211]: from app import create_app
Feb 10 11:48:06 web gunicorn[11211]: File "/root/PyOne/app/__init__.py", line 3, in <module>
Feb 10 11:48:06 web gunicorn[11211]: from werkzeug.contrib.fixers import ProxyFix
Feb 10 11:48:06 web gunicorn[11211]: ImportError: No module named contrib.fixers
Feb 10 11:48:06 web gunicorn[11211]: [2020-02-10 11:48:06 +0000] [11215] [INFO] Worker exiting (pid: 11215)
这是pyone的日志
好像是有个模块出了问题,我手动改了下,目前debian和ubuntu安装正常。
使用域名搭建后访问域名报502,查看日志所有的服务全部都是running,单独附上caddy日志给大佬看看,不知道啥问题
Tasks: 7 (limit: 4915)root@web:~/.caddy# systemctl status caddy
● caddy.service - Caddy server
Loaded: loaded (/etc/systemd/system/caddy.service; enabled; vendor preset: enabled)
Active: active (running) since Mon 2020-02-10 11:43:07 UTC; 42s ago
Main PID: 11104 (caddy)
CGroup: /system.slice/caddy.service
└─11104 /usr/local/bin/caddy --conf=/root/.caddy/caddy.conf -agreeFeb 10 11:43:07 web caddy[11104]: Activating privacy features... done.
Feb 10 11:43:07 web caddy[11104]: Serving HTTPS on port 443
Feb 10 11:43:07 web caddy[11104]: https://od.xtboke.cn
Feb 10 11:43:07 web caddy[11104]: Serving HTTP on port 80
Feb 10 11:43:07 web caddy[11104]: http://od.xtboke.cn
Feb 10 11:43:07 web caddy[11104]: WARNING: File descriptor limit 1024 is too low for production servers. At least 8
Feb 10 11:43:36 web caddy[11104]: 2020/02/10 11:43:36 [ERROR 502 /admin] dial tcp 127.0.0.1:34567: connect: connect
Feb 10 11:43:37 web caddy[11104]: 2020/02/10 11:43:37 [ERROR 502 /favicon.ico] dial tcp 127.0.0.1:34567: connect: c
Feb 10 11:43:41 web caddy[11104]: 2020/02/10 11:43:41 [ERROR 502 /admin] dial tcp 127.0.0.1:34567: connect: connect
Feb 10 11:43:42 web caddy[11104]: 2020/02/10 11:43:42 [ERROR 502 /favicon.ico] dial tcp 127.0.0.1:34567: connect: c
lines 1-18/18 (END)
好像是有个模块出了问题,我手动改了下,目前debian和ubuntu安装正常。
换debian和ubuntu吧,centos还有点问题,我有空多看看
谷歌云debian9还是不行,能帮我远程看下吗?留了微信
● pyone.service - pyone
Loaded: error (Reason: Invalid argument)
Active: inactive (dead)
Feb 13 12:02:45 pyonel systemd[1]: [/etc/systemd/system/pyone.service:10] Executable path is not absolute,
ignoring: -w4 -b 0.0.0.0:34567 run:app
Feb 13 12:02:45 pyonel systemd[1]: pyone.service: Service lacks both ExecStart= and ExecStop= setting. Refu
sing.
Feb 13 12:02:54 pyonel systemd[1]: [/etc/systemd/system/pyone.service:10] Executable path is not absolute,
ignoring: -w4 -b 0.0.0.0:34567 run:app
Feb 13 12:02:54 pyonel systemd[1]: pyone.service: Service lacks both ExecStart= and ExecStop= setting. Refu
sing.
Feb 13 12:03:12 pyonel systemd[1]: [/etc/systemd/system/pyone.service:10] Executable path is not absolute,
ignoring: -w4 -b 0.0.0.0:34567 run:app
Feb 13 12:03:12 pyonel systemd[1]: pyone.service: Service lacks both ExecStart= and ExecStop= setting. Refu
sing.
把服务器信息发到moerats@live.com,我到时候看看。
对,可能有点小瑕疵,你先看下gunicorn的绝对路径,command -v gunicorn这个命令就可以看到,然后改成Execstart= /usr/bin/gunicorn -w4 -b 0.0.0.0:34567 run:app,在前面加一个绝对路径,然后重启服务器就行了。
使用域名打不开的话,看是不是caddy签发证书失败等问题,caddy运行正常吗?
journalctl -u caddy这个可以看详细日志
这个是申请SSL失败了,你先把ssl下掉看看,修改/root/.caddy/caddy.conf,把tle那行代码删掉,重启就好了
额,你还是选择ip安装,然后自己绑定下域名看看
这里的没运行,Ubuntu 16.04 64位的
pyone.service - pyone
Loaded: loaded (/etc/systemd/system/pyone.service; enabled; vendor preset: enabled)
Active: failed (Result: start-limit-hit) since Sun 2020-02-09 10:33:15 CST; 10s ago
Process: 7369 ExecStart=/usr/local/bin/gunicorn -w4 -b 0.0.0.0:34567 run:app (code=exited, status=1/FAILURE)
Main PID: 7369 (code=exited, status=1/FAILURE)
Feb 09 10:33:14 iZ2ze4zttul0nh8oopew8bZ systemd[1]: pyone.service: Unit entered failed state.
Feb 09 10:33:14 iZ2ze4zttul0nh8oopew8bZ systemd[1]: pyone.service: Failed with result 'exit-code'.
Feb 09 10:33:15 iZ2ze4zttul0nh8oopew8bZ systemd[1]: pyone.service: Service hold-off time over, scheduling restart.
Feb 09 10:33:15 iZ2ze4zttul0nh8oopew8bZ systemd[1]: Stopped pyone.
Feb 09 10:33:15 iZ2ze4zttul0nh8oopew8bZ systemd[1]: pyone.service: Start request repeated too quickly.
Feb 09 10:33:15 iZ2ze4zttul0nh8oopew8bZ systemd[1]: Failed to start pyone.
Feb 09 10:33:15 iZ2ze4zttul0nh8oopew8bZ systemd[1]: pyone.service: Unit entered failed state.
Feb 09 10:33:15 iZ2ze4zttul0nh8oopew8bZ systemd[1]: pyone.service: Failed with result 'start-limit-hit'.
给的信息看不出啥来,换个系统看看。
我的天,我装了redis,mongoDB和nginx,结果运行之后又装了一遍,然后全出错了,redis,mongodb启动失败,nginx工作不正常还好我之前有快照,要不然真的麻烦,建议设置先检查环境再安装
对,只建议新装的系统运行。重复会出问题
ubuntu@ip-172-31-36-168:~$ systemctl status pyone
● pyone.service
Loaded: error (Reason: Invalid argument)
Active: inactive (dead)
Jan 04 09:38:38 ip-172-31-36-168 systemd[1]: /etc/systemd/system/pyone.service:1:
Jan 04 09:38:38 ip-172-31-36-168 systemd[1]: /etc/systemd/system/pyone.service:2:
Jan 04 09:38:38 ip-172-31-36-168 systemd[1]: pyone.service: Service lacks both Exe
Jan 04 09:39:15 ip-172-31-36-168 systemd[1]: /etc/systemd/system/pyone.service:1:
Jan 04 09:39:15 ip-172-31-36-168 systemd[1]: /etc/systemd/system/pyone.service:2:
Jan 04 09:39:15 ip-172-31-36-168 systemd[1]: pyone.service: Service lacks both Exe
像是配置文件有问题,看下配置文件,查看命令:systemctl cat pyone
caddy限制证书了,怎么办。。
https://i.loli.net/2020/01/01/O1AGsw7nZYC5zFN.png
换域名,或者等几天
Aria2报错能怎么搞,视频不能播放用oneindex可以
aria2.service - Aria2 server
Loaded: loaded (/etc/systemd/system/aria2.service; enabled; vendor preset: disabled)
Active: failed (Result: start-limit) since Tue 2019-12-10 01:25:02 CST; 3min 40s ago
Process: 16843 ExecStart=/usr/bin/aria2c --conf-path=/root/.aria2/aria2.conf (code=exited, status=28)
Main PID: 16843 (code=exited, status=28)
Dec 10 01:25:02 izuf64hr99wsn7sel216t2z aria2c[16843]: -x, --max-connection-per-ser...e
Dec 10 01:25:02 izuf64hr99wsn7sel216t2z aria2c[16843]: server for each download.
Dec 10 01:25:02 izuf64hr99wsn7sel216t2z systemd[1]: Unit aria2.service entered fail....
Dec 10 01:25:02 izuf64hr99wsn7sel216t2z systemd[1]: aria2.service failed.
Dec 10 01:25:02 izuf64hr99wsn7sel216t2z systemd[1]: aria2.service holdoff time over....
Dec 10 01:25:02 izuf64hr99wsn7sel216t2z systemd[1]: Stopped Aria2 server.
Dec 10 01:25:02 izuf64hr99wsn7sel216t2z systemd[1]: start request repeated too quic...e
Dec 10 01:25:02 izuf64hr99wsn7sel216t2z systemd[1]: Failed to start Aria2 server.
Dec 10 01:25:02 izuf64hr99wsn7sel216t2z systemd[1]: Unit aria2.service entered fail....
Dec 10 01:25:02 izuf64hr99wsn7sel216t2z systemd[1]: aria2.service failed.
手动运行下,/usr/bin/aria2c --conf-path=/root/.aria2/aria2.conf,看报错日志
重新安装下好了
哦还有大佬,修改后台密码在哪,我看说明也没看到翻了个底朝天也没看到
应该是self_config.py文件里面,修改后记得重启
上传文件到onedrive出错 create upload session fail!Service unavailable
大佬,如果不用的话删除哪些文件?
卸载吗?
是的,还是上传文件onedrive出错能搞不说服务出错
Mongodb等依赖安装成功!
开始安装Aria2...
--2019-11-24 10:22:59-- https://www.moerats.com/usr/shell/PyOne/aria2-1.34.0-linux-64.tar.gz
Resolving www.moerats.com (www.moerats.com)... failed: Temporary failure in name resolution.
wget: unable to resolve host address ‘www.moerats.com’
tar (child): aria2-1.34.0-linux-64.tar.gz: Cannot open: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
PyOne.sh: line 147: cd: aria2-1.34.0-linux-64: No such file or directory
make: * No rule to make target 'install'. Stop.
Aria2安装失败!
貌似服务器连不上你这地址
感觉是dns的原因