[学习笔记] Rocket.Chat 安装与设置启动项
?安装Rocket.Chat
下载对应的Release版本,这里以2.4.14为例
根据文档安装和配置
配置Service
在/etc/systemd/system/目录下新建名称为rocketchat.service的文件,填写如下内容
[Unit]
Description=The Rocket.Chat server running on Linux
After=network.target remote-fs.target nss-lookup.target nginx.service mongod.service
[Service]
WorkingDirectory=/home/xamarin/web/Rocket.Chat-2.4.14/
ExecStart=/usr/local/bin/meteor npm start
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=rocketchat
User=xamarin
Environment=ROOT_URL=http://localhost:3000/ PORT=3000
[Install]
WantedBy=multi-user.target
保存文件后执行:
sudo systemctl daemon-reload
接下来测试服务:
sudo systemctl start rocketchat.service
如果服务启动Ok没有问题 ,我们把这个服务设置成自启动
sudo systemctl enable rocketchat.service
.Net5 的后台接口程序也设置成自动启动
在/etc/systemd/system/目录下新建名称为kestrel-cah.service的文件,填写如下内容
[Unit]
Description=CAH Web API App running on Linux
[Service]
WorkingDirectory=/home/xamarin/web/[dll所在地址]
ExecStart=/usr/local/dotnet/dotnet XXX.Web.Host.dll
Restart=always
# Restart service after 10 seconds if the dotnet service crashes:
RestartSec=10
KillSignal=SIGINT
SyslogIdentifier=dotnet-cah
User=xamarin
Environment=DOTNET_PRINT_TELEMETRY_MESSAGE=false
[Install]
WantedBy=multi-user.target
用同样的方法执行systemctl 的几个步骤
完成!
Troubleshooting:
如果systemd有报错,可以通过如下命令查看
sudo systemctl status kestrel-cah.service
sudo journalctl -fu kestrel-cah.service
默认情况下日志记录在syslog,如果看报错详细,可以通过如下命令查看
sudo cat /var/log/messages