A vigorous core craze, starting with the deployment environment. Referring to many of the online predecessors of the course, also encountered a lot of pits, this way to make a complete note.
First, build the. Net Core 2 application Web publishing, as it is used to test the core environment on CentOS, and then use the core instance of VS17 directly.
Release
Second, the deployment of the CentOS 7 core environment
1. Connect and start the previously installed virtual machine, "root" login
2, if the virtual machine is located as a Linux server, then we need to be able to remote operation.
This is Xshell 5.
After the new, we need to fill in the host is the server IP
Switch to the virtual machine if the lock screen, enter key, open the application terminal
# IP addr, no IP address found because the configuration was missing
# cd/etc/sysconfig/network-scripts/
# ls can see the file Ifcfg-rth0 is the configuration we need
# VI Ifcfg-eth0
"I" key into edit mode
Change Onboot=yes
"ESC" key
Enter ": Wq" to save
# Service Network restart reboot, check again, IP is present
Enter the acquired IP
After OK, you can also execute commands in Xshell at the terminal.
Second, for the installation of. NET Core 2 We directly use Microsoft's official reference material (Https://www.microsoft.com/net/core#linuxcentos)
- # sudo rpm--import https://packages.microsoft.com/keys/microsoft.asc
- # sudo sh-c ' echo-e ' [Packages-microsoft-com-prod]\nname=packages-microsoft-com-prod \nbaseurl=https:// packages.microsoft.com/yumrepos/microsoft-rhel7.3-prod\nenabled=1\ngpgcheck=1\ngpgkey=https:// Packages.microsoft.com/keys/microsoft.asc ">/etc/yum.repos.d/dotnetdev.repo"
- # sudo yum update
- # sudo yum install libunwind Libicu
- # sudo yum install dotnet-sdk-2.0.0
After execution,
# dotnet--help, appears as shown, the environment is installed successfully!
Third, upload the published web of. NET Core 2 to the server
Uploading with tools Xftp
Garbled after connection, this is because the folder in the server is in Chinese.
Change the folder name to English first
Open Terminal, enter
# Export Lang=en_us
# xdg-user-dirs-gtk-update
# Export LANG=ZH_CN
Turn off reboot and reconnect xftp to see the normal English name.
Create a new test folder in home to save the uploaded core
Upload all the files in Publishoutput
CD into test file, execute DLL
Here you can create a new connection,
# Curl http://localhost:5000
Appears as shown
Or browse directly from the server
This makes the core environment deployment complete.
CentOS 7 Installing. Net Core 2.0 Detailed steps