摘 聊天服务器搭建-使用snap+Nginx快速安装RocketChat(2022年6月最新版)
一键安装命令(测试了不好用 20240107)
bash -c "$(curl https://install.rocket.chat)"
操作系统是 Ubuntu|这里说明下,安装的前提是主机不是OpenVZ的,否则用snap安装不了
root@box:~# snap install core
error: system does not fully support snapd: cannot mount squashfs image using "squashfs": mount:
/tmp/sanity-mountpoint-075600353: mount failed: Operation not permitted.
root@box:~#
网上的解释
https://askubuntu.com/questions/1340831/20-04-snapd-issue-system-does-not-fully-support-snapd-cannot-mount-squashfs-i
snaps rely on certain Linux kernel features which are not available under containerized servers like those running under openvz.
提示:由于官方建议的最低内存1G,所以512M或更小的建议加点虚拟内存,可以使用Swap
原作者:有几个朋友问我那个ohshit是怎么搭建的,我之前写过用CentOS7手动安装的方法,那个太麻烦了,现在RocketChat支持用snap部署,而且还自带Caddy,方便很多,当然snap目前只能用在Debian/Ubuntu系统上。下面是我在Debian9上参照官方文档的安装过程,只有两个小坑,注意一下就好。(我重新整理发现现在至少3个坑了 2022年6月)
首先更新下系统:
apt -y update apt -y dist-upgrade
添加环境变量免得提示
echo $PATH export PATH="$PATH:/snap/bin"
然后一条命令即可安装snap:
apt -y install snapd
需要先使用snap安装这个运行环境,这步官方没提到,导致很多人卡在这里:
snap install core
然后就可以安装RocketChat了:
snap install rocketchat-server
安装成功之后会弹出一个警告的提示,大致意思是说某些snap的管理命令可能不能使用,这时候我们只要退出shell重新登录一次就好了。(指下面的rocketchat-server.initcaddy命令)(如果没有提示就不用tui)
exit
#查看RC状态 sudo systemctl status snap.rocketchat-server.rocketchat-server #设置开机启动 sudo systemctl enable snap.rocketchat-server.rocketchat-server #重启RC sudo systemctl restart snap.rocketchat-server.rocketchat-server
重新登录上来之后就可以使用Caddy配置反向代理和自动申请SSL证书(前提是你要先把域名解析到你的服务器)
snap set rocketchat-server caddy-url=https://chat.ohshit.fun snap set rocketchat-server caddy=enable snap set rocketchat-server https=enable #下面的命令有问题,无法执行,网上找了办法都不行。 rocketchat-server.initcaddy
这些配置和命令的目的就是要配置反向代理和申请SSL证书,那用Nginx也可以完成
如果服务器上没有安装Nginx的话
sudo apt install -y nginx
启动nginx
sudo systemctl start nginx # 设置开机自启 sudo systemctl enable nginx
设置反向代理
默认的欢迎页面的文件位置
在 /etc/nginx/sites-available/
删除default软链接,删除default 并移到另外位置,降低default配置文件被读取的优先级 ...
|-原 在OnpenVZ 上安装Rocket Chat 实测中
先是运行
snap install core
报了下面的错误
error: system does not fully support snapd: cannot mount squashfs image using "squashfs": mount:/tmp/sanity-mountpoint-922578650: mount failed: Operation not permitted.
这个错误要找主机的技术在他们那边解决,无法自行解决,可能跟权限有关。
解决这个问题之后,再运行
snap install core
又报错
root@box:~# snap install core error: system does not fully support snapd: The "fuse" filesystem is required on this system but not available. Please try to install the fuse package.
之后再尝试安装fuse
root@box:~# sudo apt-get install fuse -y Reading package lists... Done Building dependency tree Reading state information... Done The following NEW packages will be installed: fuse 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. Need to get 24.5 kB of archives. After this operation, 106 kB of additional disk space will be used. Err:1 http://archive.ubuntu.com/ubuntu bionic/main amd64 fuse amd64 2.9.7-1ubuntu1 Temporary failure resolving 'archive.ubuntu.com' E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/f/fuse/fuse_2.9.7-1ubuntu1_amd64.deb Temporary failure resolving 'archive.ubuntu.com' E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
结果又报错,运行 ...