Install Netcore 2.0 SDK
Installing Netcore 2.0 on CentOS is not the same as window above, note that Linux is not supported to install two versions of the. Netcore SDK, as I have previously developed Netcore 1.04, now need to upgrade to the 2.0 SDK
How to upgrade it.
1. Locate the current installation path:
2. Install. Netcore 2.0
Here, find the package you want to install: Https://www.microsoft.com/net/download/linux
Open the Yum Instructions link:
I chose not to upgrade the kernel and install the SDK directly, so I just need to execute the two lines in the box.
After installation, we will find: Netcore 2.0 SDK installed in Usr/share/dotnet/dotnet
To create a soft link:
If it existed before, then you can execute Ln-s-F souredir lindir
Check the dotnet version again:
OK, the version is the version we want.
Two Test native Publishing
Upload dotnet publish post files to CentOS, you can use
Test the native release: Dotnet UIclub.Web.dll
I'm here because the program has been released into Docker and ran up and occupied the port for the reason
Three-install Docker
#安装Docker
yum
install
docker
#启动docker服务
systemctl start docker.service
#配置开机启动
systemctl
enable
docker.service
Configure Docker acceleration
The fastest way to configure Docker acceleration is to directly modify/etc/docker/daemon
.json下的配置信息
/etc/docker/daemon
.json
{
"registry-mirrors"
: [
"https://d8b3zdiw.mirror.aliyuncs.com"
]
}
然后在终端重启docker服务
sudo
systemctl daemon-reload
sudo
systemctl restart docker
Four release programs into Docker
1. Pull the basic image of the publication
Docker pull Docker.io/microsoft/dotnet:[tag] pulls the latest image, if you are to the old version of the image, you can fill in the corresponding tag
Docker images
2. Configure Dockerfile
Press ESC:WQ to save the exit
Docker build-t demo:1.0. --Note: There is a last point indicating the current path
Docker run-d-P 8000:8000 demo:1.0 run container
Look at the running container and you should have a running container when you run normally.
Docker PS
Five. Testing
At this point, the publication succeeds.
Netcore 2.0 application is released via Docker on CentOS 7