View Linux kernel versions
Uname-a
Print results
[Email protected]:~$ uname-a4.4.0-31-generic #50-ubuntu SMP Wed Jul 00:07:12 UTC x86_64 x86 _64 x86_64 Gnu/linux
View Ubuntu System version
Lsb_release-a
Print results
[Email protected]:~$ lsb_release-aNo LSB modules is available. Distributor ID: ubuntudescription: 16.04. 1 ltsrelease: 16.04codename: Xenial[email protected]:
You can see that the version number is 16.4
View Official document execution dotnet Environment installation process
Https://www.microsoft.com/net/learn/get-started/linuxredhat
Here we choose Ubuntu
Continue with the following command:
Register the trusted Microsoft signature key:
Curl https:///PACKAGES.MICROSOFT.COM/KEYS/MICROSOFT.ASC | gpg--dearmor > MICROSOFT.GPG
Go on
sudo mv MICROSOFT.GPG/ETC/APT/TRUSTED.GPG.D/MICROSOFT.GPG
Depending on the system version, execute the following command
' echo "Deb [ARCH=AMD64] https://packages.microsoft.com/repos/microsoft-ubuntu-xenial-prod xenial main" >/etc/ Apt/sources.list.d/dotnetdev.list'
Well, the environment has been deployed, and below we install the SDK
Perform the following three lines of command separately
sudo apt-get install apt-transport-httpssudo apt-get updatesudo apt-get Install dotnet-sdk-2.1. 4
At this point, the SDK installation is complete
--------------------------------------------------------------------------------------------------------------- ------
Now let's build a new console project and test it.
New console-o myappcd myappdotnet run
A directory permission issue was encountered
Template "Console application" could not being created.
Access to the path '/etc/apt/trusted.gpg.d/myapp ' is denied.
Permission to add a directory using the permissions command
Here, however, we change the creation location to the current home directory creation.
The operation results are as follows
[Email protected]:~/dotnet$ dirmyapp[email protected]:~/dotnet$ cd myapp/[email protected]:~/ dotnet/myapp$ dirmyapp.csproj obj program.cs[email protected]:~/dotnet/dotnet Run Hello World ! [email protected]:
The compilation ran successfully.
Below we use the MVCAPI project compiled under Windows to run on Linux for a try.
First we upload the entire project solution directory to the Linux server.
I'm using xftp here.
Then to run which project, switch directly to the project directory, for example I want to run MYWEBAPI this API interface
[Email protected]:~/dotnet/myweb$ cd mywebapi[email protected]:~/dotnet/myweb/mywebapi$ lsappsettings. Development.json bin mywebapi.csproj obj Properties Wwwrootappsettings.json controll ERs mywebapi.csproj.user Program.cs startup.cs[email protected]:~/dotnet/myweb/mywebapi$ dotnet runModels/gedu_lsa_v_1_7_1context.cs ( -,Ten): Warning CS1030:#warning: ' To protect potentially sensitive information in your connection string, you should move it out of source code. See http://go.microsoft.com/fwlink/?linkid=723263 for guidance on storing connection strings. ' [/home/python/dotnet/myweb/core/mydb.csproj]Controllers/mycontroller.cs ( -, -): Warning Cs0162:unreachable code detected [/home/python/dotnet/myweb/mywebapi/Mywebapi.csproj] Using Launch Settings from/home/python/dotnet/myweb/mywebapi/properties/Launchsettings.json ... Hosting environment:developmentcontent Root Path:/home/python/dotnet/myweb/Mywebapinow listening on:http://localhost:61697Application started. Press CTRL +C to shut down.^capplication isShutting down ...
This time we access the following API interface address
Successfully see JSON returned by interface
This is also true for MVC projects.
【. Netcore Learning "ubuntu16.04 build the. NET core MVC API Runtime Environment