Install .net 7.x
os:Ubuntu 18.04.3 LTS
# lsb_release -a
LSB Version: core-9.20170808ubuntu1-noarch:security-9.20170808ubuntu1-noarch
Distributor ID: Ubuntu
Description: Ubuntu 18.04.3 LTS
Release: 18.04
Codename: bionic
Before you install .NET, You may first run sudo apt update to refresh cache. Follow the installation instructions for Ubuntu as follow:
sudo apt update
output
Hit:1 http://mirrors.cloud.aliyuncs.com/ubuntu bionic InRelease
Get:2 http://mirrors.cloud.aliyuncs.com/ubuntu bionic-updates InRelease [88.7 kB]
Get:3 http://mirrors.cloud.aliyuncs.com/ubuntu bionic-backports InRelease [83.3 kB]
Get:4 http://mirrors.cloud.aliyuncs.com/ubuntu bionic-security InRelease [88.7 kB]
Get:5 https://artifacts.elastic.co/packages/7.x/apt stable InRelease [13.7 kB]
...
Reading package lists... Done
Step 1: Add Microsoft Repository
printf 'deb [arch=amd64 signed-by=/usr/share/keyrings/microsoft.gpg] https://packages.microsoft.com/ubuntu/18.04/prod bionic main\n' | sudo tee /etc/apt/sources.list.d/microsoft.list >/dev/null
Step 2: Install .NET SDK/Runtime & ASP.NET
sudo apt install dotnet-sdk-7.0 dotnet-runtime-7.0 aspnetcore-runtime-7.0
output
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
aspnetcore-targeting-pack-7.0 dotnet-apphost-pack-7.0 dotnet-host dotnet-hostfxr-7.0 dotnet-runtime-deps-7.0 dotnet-targeting-pack-7.0
...
Setting up dotnet-targeting-pack-7.0 (7.0.0-1) ...
Setting up dotnet-host (7.0.0-1) ...
# dotnet --info
.NET SDK:
Version: 7.0.100
Commit: e12b7af219
Runtime Environment:
OS Name: ubuntu
OS Version: 18.04
OS Platform: Linux
RID: ubuntu.18.04-x64
Base Path: /usr/share/dotnet/sdk/7.0.100/
Host:
Version: 7.0.0
Architecture: x64
Commit: d099f075e4
.NET SDKs installed:
5.0.402 [/usr/share/dotnet/sdk]
6.0.100 [/usr/share/dotnet/sdk]
6.0.202 [/usr/share/dotnet/sdk]
7.0.100 [/usr/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 5.0.11 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.0 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.4 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.0 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 5.0.11 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.0 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.4 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.0 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Uninstall .Net 7.x on Ubuntu 18.04(aliyun)
step 1:
sudo apt remove dotnet-sdk-7.0 dotnet-runtime-7.0 aspnetcore-runtime-7.0
How to Install .NET6 or 7 in Ubuntu 22.04 | 20.04, Debian 11/10 & Other Linux
https://fostips.com/ubuntu-22-04-net-6-how-to-install-other-linux/