.NetCore3.1 部署 Linux

1 点击进入注册账号https://www.aliyun.com/


2 实名认证

环境描述

宝塔 + NetCore3 + Redis + Mysql

1.1 Centos7 安装.Net SDK

在安装.NET之前,需要注册产品存储库并安装所需的依赖关系。

sudo rpm -Uvh https://packages.microsoft.com/config/rhel/7/packages-microsoft-prod.rpm

sudo yum update

sudo yum install dotnet-sdk-3.1

依照网速 大概40分钟

1.2 ubuntu 安装.Net SDK

在安装.NET之前,需要注册产品存储库并安装所需的依赖关系。

wget -q https://packages.microsoft.com/config/ubuntu/21.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb

sudo dpkg -i packages-microsoft-prod.deb

ubuntu@ip-10-0-0-92:~$ sudo dpkg -i packages-microsoft-prod.deb
Selecting previously unselected package packages-microsoft-prod.
(Reading database ... 103204 files and directories currently installed.)
Preparing to unpack packages-microsoft-prod.deb ...
Unpacking packages-microsoft-prod (1.0-ubuntu18.04.2) ...
Setting up packages-microsoft-prod (1.0-ubuntu18.04.2) ...
ubuntu@ip-10-0-0-92:~$ sudo add-apt-repository universe
'universe' distribution component is already enabled for all sources.
ubuntu@ip-10-0-0-92:~$ sudo apt-get install apt-transport-https
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  apt-transport-https
0 upgraded, 1 newly installed, 0 to remove and 35 not upgraded.
Need to get 4348 B of archives.
After this operation, 154 kB of additional disk space will be used.
Get:1 http://us-west-2.ec2.archive.ubuntu.com/ubuntu bionic-updates/universe amd64 apt-transport-https all 1.6.14 [4348 B]
Fetched 4348 B in 0s (397 kB/s)               
Selecting previously unselected package apt-transport-https.
(Reading database ... 103212 files and directories currently installed.)
Preparing to unpack .../apt-transport-https_1.6.14_all.deb ...
Unpacking apt-transport-https (1.6.14) ...
Setting up apt-transport-https (1.6.14) ...

sudo add-apt-repository universe

sudo apt-get install apt-transport-https

sudo apt-get update

sudo apt-get install dotnet-sdk-3.1

依照网速 大概10分钟

Setting up dotnet-sdk-3.1 (3.1.414-1) ...
This software may collect information about you and your use of the software, and send that to Microsoft.
Please visit http://aka.ms/dotnet-cli-eula for more information.
Welcome to .NET Core!
---------------------
Learn more about .NET Core: https://aka.ms/dotnet-docs
Use 'dotnet --help' to see available commands or visit: https://aka.ms/dotnet-cli-docs

Telemetry
---------
The .NET Core tools collect usage data in order to help us improve your experience. It is collected by Microsoft and shared with the community. You can opt-out of telemetry by setting the DOTNET_CLI_TELEMETRY_OPTOUT environment variable to '1' or 'true' using your favorite shell.

Read more about .NET Core CLI Tools telemetry: https://aka.ms/dotnet-cli-telemetry

Configuring...
--------------
A command is running to populate your local package cache to improve restore speed and enable offline access. This command takes up to one minute to complete and only runs once.

2 发布网站

3 添加网站.

这里是宝塔的后台. 以下均用这个创建网站.

4 上传代码

 创建的网站目录下

5 生成ssl 

如果不需要https访问,可以跳过

5.1免费证书就不多说了

5.2创建ssl

6 创建Nginx 

在创建的网站中 创建反向代理

7 启动网站

先在终端进入网站目录 . 然后 dotnet ****.dll 启动

没有报错 表示启动成功

访问正常

这个进程只是简单的测试模式. 如果要正式使用. 可以看我其他帖子 .守护.net进程

supervisor守护.netcore或redis等进程实现开机运行,故障自启的配置和卸载

supervisor守护.netcore或redis等进程实现开机运行,故障自启的配置和卸载_liutietuo的专栏-优快云博客

感谢支持

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值