1、下载.net core项目ubuntu系统运行容器dotnet
1、版本:dotnet-sdk-2.1.3-linux-x64.tar.gz
2、将下载好的包上传到ubuntu系统进行解压
3、解压命令:tar -zxvf dotnet-sdk-2.1.3-linux-x64.tar.gz(-zxvf详解:z表示tar包是被gzip压缩过的,所以解压是需要用gunzip解压;x表示从tar包中把文件提取出来;v表示显示详细信息;f指定被处理的文件是.tar.gz)
4、将压缩包解压到指定文件目录
tar -zxvf dotnet-sdk-2.1.3-linux-x64.tar.gz -C /home/zhangxinqi/dotnetsdk
2、安装supervisor(可视化界面管理车.net core服务,手动操作,不需要命令启动)
supervisor是一款很好用的进程管理工具,其命令也很简单,其安装过程如下:
1、首先保证本地的Python环境是OK的,并且已经安装supervisor包,如果没有安装可以用easy_install:
easy_install supervisor
2、安装supervisor
sudo apt-get install supervisor
3、查看默认配置
echo_supervisord_conf
4、导出默认配置到指定目录
echo_supervisord_conf > /etc/supervisor/supervisord.conf(如果提示权限不够,可以切换到root用户)
5、修改supervisord.conf配置文件(去掉最后该配置文件的最后一行注释符号)
[include]
files = /etc/supervisor/conf.d/*.ini
6、修改supervisord.conf配置文件为:这样就可以通过浏览器登录supervisor可视化操作界面了
[inet_http_server] ; inet (TCP) server disabled by default
port=*:9001 ; (ip_address:port specifier, *:port for all iface)
username=admin ; (default is no username (open server))
password=fujica0408 ; (default is no password (open server))
7、添加ini配置文件(文件名enginecore)
[program:EngineCore]
command=/home/zhangxinqi/dotnetsdk/dotnet OneCardSystem.EngineCore.dll ; 运行程序的命令
directory=/home/zhangxinqi/OneCardSystem.EngineCore/ ; 对应的你的项目的存放目录
autostart=true
autorestart=true ; 程序意外退出是否自动重启
stderr_logfile=/var/log/EngineCore.err.log ; 错误日志文件
stdout_logfile=/var/log/EngineCore.out.log ; 输出日志文件
environment=ASPNETCORE_ENVIRONMENT='Production',ASPNETCORE_URLS='http://*:60002' ; 进程环境变量
stopsignal=INT
8、启动supervisord
supervisord -c /etc/supervisor/supervisord.conf
(备注:如果修改了ini和supervisord.conf文件,则需要执行supervisorctl reload命令才能生效)