博主很久之前发过一篇在VPS上安装resilio sync的文章
那个文章写的不是很清楚,也比较简略,这次重新更新一下,这个教程在debian系的linux中均适用
对于懒人来说,博主还是推荐直接从网站上下载直接运行的方式,方便直接
- 首先下载resilio的证书,并导入
wget http://linux-packages.resilio.com/resilio-sync/key.asc sudo apt-key add key.asc sudo apt install software-properties-common sudo add-apt-repository "deb http://linux-packages.resilio.com/resilio-sync/deb resilio-sync non-free"
- 安装
sudo apt install resilio-sync
检查后台运行情况并设置开机自启(status时按q可以退出)
systemctl status resilio-sync sudo systemctl enable resilio-sync
- 配置权限
这里出现了与直接使用官网程序包不同的地方,使用apt安装的需要进行权限设置,不然会出现无法打开文件夹等错误
sudo setfacl -R -m "u:rslsync:rwx" /home/username
这里/home/username是你想要设置同步文件夹的位置,如果在本地使用可以设置为你的主目录,如果在服务器上使用建议设置成/root 或类似文件夹
如果出现
sudo: setfacl: command not found
则
sudo apt install acl
- 配置程序
如果是本地安装,在程序启动后打开浏览器
127.0.0.1:8888
就可以进行设置了
如果是在服务器上安装,需要首先安装网络服务比如nginx或apache,这里不详细展开。在安装完成后进行conf配置(nginx),打开
sudo nano /etc/nginx/conf.d/resilio-sync.conf
server { listen 80; server_name resilio.example.com; access_log /var/log/nginx/resilio_access.log; error_log /var/log/nginx/resilio_error.log; location / { proxy_pass http://127.0.0.1:8888; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } }
其中resilio.example.com改成你自己的网址(注意提前配置好dns)
检查并重载nginx
sudo nginx -t sudo service nginx reload
或apache,类似的,打开
sudo nano /etc/apache2/sites-available/resilio-sync.conf
<VirtualHost *:80> ServerName resilio.example.com ErrorDocument 404 /404.html ProxyPass / http://localhost:8888/ ProxyPassReverse / http://localhost:8888/ ErrorLog ${APACHE_LOG_DIR}/resilio_error.log CustomLog ${APACHE_LOG_DIR}/resilio_access.log combined </VirtualHost>
重载apache使其生效
sudo a2ensite resilio-sync.conf sudo service apache2 reload
如果服务器有防火墙的话,请自行打开对应的端口!
如果想设置https协议,请参考
本文转载修改自https://www.linuxbabe.com/ubuntu/install-resilio-sync-btsync-ubuntu-18-04-18-10
感谢原作者!