添加包存储库

wget https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb

安装 SDK

sudo apt-get update
sudo apt-get install -y apt-transport-https
sudo apt-get update
sudo apt-get install -y dotnet-sdk-3.1

测试(查看版本)

dotnet --version

安装GDI+库:

apt-get update
apt-get install libgdiplus -y
ln -s /usr/lib/libgdiplus.so /usr/lib/gdiplus.dll

添加服务

sudo nano /etc/systemd/system/hbweb.service

[Unit]
Description=HbWeb


[Service]
Type=simple
PermissionsStartOnly=true
ExecStart=/usr/bin/dotnet /www/wwwroot/mall.ccfuns.com/www/Hb.Web.dll
StandardOutput=journal+console


[Install]
WantedBy=multi-user.target

创建服务后,通知systemd更新:
sudo systemctl daemon-reload
启动Odoo服务,并在系统开机后启动:
sudo systemctl enable --now hbweb

常用服务命令

查看服务状态:
sudo systemctl status hbweb
重启服务:
sudo systemctl restart hbweb
停止服务:
sudo systemctl stop hbweb
启动服务:
sudo systemctl start hbweb
查看服务日志:
sudo journalctl -u hbweb

在宝塔中添加反向代理