Linux使用.net core
Linux使用.net core
安装nginx
1
1
yum install nginx
查看nginx是否安装成功
1
1
nginx -t
查看nginx版本
1
1
nginx -v
查看nginx安装目录
1
1
rpm -ql nginx
启动nginx
8
1
// 查看安装目录
2
rpm -ql nginx
3
4
// 得到nginx目录
5
6
cd /usr/sbin
7
8
./nginx
配置开机自启
5
1
vim /etc/rc.d/rc.local
2
3
添加
4
#开机自启
5
/usr/sbin/nginx
安装.net core runtime
4
1
sudo rpm -Uvh https://packages.microsoft.com/config/centos/7/packages-microsoft-prod.rpm
2
3
// 安装包含asp net core的运行时
4
sudo yum install aspnetcore-runtime-5.0
安装sqlserver
4
1
// 下载微软yum源
2
wget -O /etc/yum.repos.d/mssql-server.repo https://packages.microsoft.com/config/rhel/7/mssql-server-2017.repo
3
// 安装 sqlserver
4
yum install -y mssql-server
服务器可用内存小于2g
17
1
// 破解限制
2
//首先切换到 /opt/mssql/bin 目录下
3
cd /opt/mssql/bin/
4
// 然后保存备份文件
5
mv sqlservr sqlservr.old
6
7
//使用python修改二进制文件,把里面的2G内存限制改为512M
8
9
python
10
11
oldfile = open("sqlservr.old", "rb").read()
12
13
newfile = oldfile.replace("\x00\x94\x35\x77", "\x00\x80\x84\x1e")
14
15
open("sqlservr", "wb").write(newfile)
16
17
exit()
选择sqlserver版本,并设置sa账号密码
15
1
// 终端内输入
2
/opt/mssql/bin/mssql-conf setup
3
4
// 显示以下内容
5
Choose an edition of SQL Server:
6
1) Evaluation (free, no production use rights, 180-day limit)
7
2) Developer (free, no production use rights)
8
3) Express (free)
9
4) Web (PAID)
10
5) Standard (PAID)
11
6) Enterprise (PAID)
12
7) Enterprise Core (PAID)
13
8) I bought a license through a retail sales channel and have a product key to enter.
14
15
//输入3(免费版本)
检测sql server是否安装成功
1
1
systemctl status mssql-server
sql server在Centos安装centos7.x中安装SQL Server - 吕小不 - 博客园 (cnblogs.com)
配置Nginx
3
1
// Nginx目录
2
3
/usr/local/nginx
给程序权限否则无法运行
3
1
chmod 777 文件名称
2
3
./程序名
linux需要安装libgdiplus否则qrcode(二维码)无法使用
1
1
yum install libgdiplus
监视应用,进程守护
39
1
// 创建服务文件
2
sudo nano /etc/systemd/system/kestrel-NetWebGta.service
3
4
5
// 输入
6
[Unit]
7
Description=Example .NET Web API App running on Ubuntu
8
9
[Service]
10
WorkingDirectory=/var/www/你的目录
11
ExecStart=/usr/bin/dotnet /var/www/你的目录/你的网站.dll
12
Restart=always
13
# Restart service after 10 seconds if the dotnet service crashes:
14
RestartSec=10
15
KillSignal=SIGINT
16
SyslogIdentifier=dotnet-example
17
User=root
18
Environment=ASPNETCORE_ENVIRONMENT=Production
19
Environment=DOTNET_PRINT_TELEMETRY_MESSAGE=false
20
21
[Install]
22
WantedBy=multi-user.target
23
// 按ctrl+x退出
24
25
// 启动服务
26
sudo systemctl start kestrel-NetWebGta.service
27
28
// 查看服务状态
29
sudo systemctl status kestrel-NetWebGta.service
30
31
# 立即启动一个服务
32
$ sudo systemctl start kestrel-NetWebGta.service
33
34
# 立即停止一个服务
35
$ sudo systemctl stop kestrel-NetWebGta.service
36
37
# 重启一个服务
38
$ sudo systemctl restart kestrel-NetWebGta.service
39
本文来自博客园,作者:Entity110,转载请注明原文链接:https://www.cnblogs.com/rdr2/p/15232079.html

浙公网安备 33010602011771号