In this post we will be installing Microsoft .net SDK on Ubuntu Linux and create high performance HTTP end-point in C# on which you can build a micro-service (or anything else).
Table of Contents
There three choices install net5.x on OS. see:Install the .NET SDK or the .NET Runtime on Ubuntu
1.Install the .NET SDK or the .NET Runtime with Snap.
2.Install the .NET SDK or the .NET Runtime with a script.
3.Install the .NET SDK or the .NET Runtime manually.
https://github.com/dotnet/core/blob/master/release-notes/5.0/5.0.0/5.0.0-install-instructions.md
os:Ubuntu 18.04*64
.net 5 version:.net 5.01
.NET 5.0 download url:https://dotnet.microsoft.com/download/dotnet/5.0
https://aka.ms/dotnet-download
You can download .NET 5.0, for Windows, macOS, and Linux, for x86, x64, Arm32, Arm64.
Install using deb/rpm packages
step 1:
Create a directory to use for the download location and change into that directory. For example .
output:
step 2:get
Open a terminal and run the following commands:
download come from:
https://dotnet.microsoft.com/download/dotnet/thank-you/sdk-5.0.100-linux-x64-binaries
output:
step 3:Run the script
output
How to check that .NET is already installed
You can see which versions of the .NET SDK are currently installed with a terminal. Open a terminal and run the following command.
Check SDK versions & Check runtime versions
output
aliyun vps
Install using deb/rpm packages on aliyun Ubuntu 18.04*64
aliyun install error
instead of
cd dotnet_install
dotnet_install# apt install -y --allow-downgrades ./dotnet_packages/*
output:
.NET SDK (reflecting any global.json):
Version: 5.0.100
Commit: 5044b93829
Runtime Environment:
OS Name: ubuntu
OS Version: 18.04
OS Platform: Linux
RID: ubuntu.18.04-x64
Base Path: /usr/share/dotnet/sdk/5.0.100/
Host (useful for support):
Version: 5.0.0
Commit: cf258a14b7
.NET SDKs installed:
3.0.100 [/usr/share/dotnet/sdk]
3.1.301 [/usr/share/dotnet/sdk]
5.0.100-rc.2.20479.15 [/usr/share/dotnet/sdk]
5.0.100 [/usr/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 3.0.0 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.5 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.0-rc.2.20475.17 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.0 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.0.0 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.5 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.0-rc.2.20475.5 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.0 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET runtimes or SDKs:
https://aka.ms/dotnet-download
# dotnet --info
.NET SDK (reflecting any global.json):
Version: 5.0.100-rc.1.20452.10
Commit: 473d1b592e
Runtime Environment:
OS Name: ubuntu
OS Version: 18.04
OS Platform: Linux
RID: ubuntu.18.04-x64
Base Path: /usr/share/dotnet/sdk/5.0.100-rc.1.20452.10/
Host (useful for support):
Version: 5.0.0-rc.1.20451.14
Commit: 38017c3935
.NET SDKs installed:
5.0.100-rc.1.20452.10 [/usr/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 5.0.0-rc.1.20451.17 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 5.0.0-rc.1.20451.14 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET runtimes or SDKs:
https://aka.ms/dotnet-download
upgrade net5.x on Ubuntu 18.04*64
detail:https://docs.microsoft.com/en-us/dotnet/core/install/linux-ubuntu#1804-
step 1:
Open a terminal and run the following commands:
cd dotnet_install
wget https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
output
Saving to: ‘packages-microsoft-prod.deb’
#ls -l
-rw-r--r-- 1 root root 92798272 Sep 16 2020 dotnet-5.0.0-rc.1-deb.tar.gz
-rw-r--r-- 1 root root 92970717 Oct 15 2020 dotnet-5.0.0-rc.2-deb.tar.gz
-rw-r--r-- 1 root root 35418 Nov 11 2020 dotnet-install.sh
drwxr-xr-x 2 501 staff 4096 Oct 13 2020 dotnet_packages
-rw-r--r-- 1 root root 137519004 Nov 5 2020 dotnet-sdk-5.0.100-linux-x64.tar.gz
-rw-r--r-- 1 root root 7088 Oct 15 2020 install-dotnet-preview.sh
-rw-r--r-- 1 root root 6256 Jan 3 2019 packages-microsoft-prod.deb
#sudo dpkg -i packages-microsoft-prod.deb
Configuration file '/etc/apt/sources.list.d/microsoft-prod.list'
==> Modified (by you or by a script) since installation.
==> Package distributor has shipped an updated version.
What would you like to do about it ? Your options are:
Y or I : install the package maintainer's version
N or O : keep your currently-installed version
D : show the differences between the versions
Z : start a shell to examine the situation
The default action is to keep your current version.
*** microsoft-prod.list (Y/I/N/O/D/Z) [default=N] ? y
Installing new version of config file /etc/apt/sources.list.d/microsoft-prod.list
step 2: check that .NETx version is already installed
dotnet --info
output
.NET SDK (reflecting any global.json):
Version: 5.0.101
Commit: d05174dc5a
Runtime Environment:
OS Name: ubuntu
OS Version: 18.04
OS Platform: Linux
RID: ubuntu.18.04-x64
Base Path: /usr/share/dotnet/sdk/5.0.101/
Host (useful for support):
Version: 5.0.1
Commit: b02e13abab
.NET SDKs installed:
3.0.100 [/usr/share/dotnet/sdk]
3.1.301 [/usr/share/dotnet/sdk]
5.0.100 [/usr/share/dotnet/sdk]
5.0.101 [/usr/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 3.0.0 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.5 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.0 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.1 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.0.0 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.5 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.0 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.1 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
step 3:Install the SDK&Install the runtime
sudo apt-get update
sudo apt-get install -y apt-transport-https
sudo apt-get update
sudo apt-get install -y dotnet-sdk-5.0
sudo apt-get update
sudo apt-get install -y apt-transport-https
sudo apt-get update
sudo apt-get install -y aspnetcore-runtime-5.0
Here's what the script does.
Detects the distribution and version. If it's in the 5.0 Supported OS list, the script will continue.
Determines if additional system dependencies or utilities are needed to successfully complete and install them. For example tar is used to unpack that installer packages.
Downloads the tar.gz containing the .NET preview installer packages for the detected distribution.
Downloads the system dependency installer, if needed.
Expands the tar.gz into ./dotnet_packages
Attempts to install the contents of ./dotnet_packages using rpm or dpkg, as appropriate, for the detected distribution.
dotnet-runtime-5.0:If only the .NET Core Runtime is needed, install dotnet-runtime-5.0 using your package manager.
aspnetcore-runtime-5.0: If you also need ASP.NET Core functionality, installing aspnetcore-runtime-5.0 will install both the ASP Runtime and .NET Core Runtime.
Migrate from ASP.NET Core 3.1 to 5.0