'Cannot install .NET on Ubuntu 18.04

I followed the official installation page for installing .NET 6.0 on Ubuntu 18.04 but I am not able to succeed.

The page told me to do:

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

rm packages-microsoft-prod.deb

And then:

sudo apt-get update; \
  sudo apt-get install -y apt-transport-https && \
  sudo apt-get update && \
  sudo apt-get install -y dotnet-sdk-6.0

I get the following result:

Reading state information... Done
E: Unable to locate package dotnet-sdk-6.0
E: Couldn't find any package by glob 'dotnet-sdk-6.0'
E: Couldn't find any package by regex 'dotnet-sdk-6.0'

When I do "apt search dotnet 6" the package dotnet-sdk-6.0/bionic is shown. But I am not able to install this, I get the same error as before.

I also tried installing with snap. But that is not working either. After giving it the alias dotnet (like was told on the installation page) I get the following: /snap/dotnet-sdk/79/snap/command-chain/snapcraft-runner: 3: exec: /snap/dotnet-sdk/79/dotnet: not found

Can somebody please help me with this? Or tell me the reason why it is not working.



Solution 1:[1]

On what architecture are you running your ubuntu 18.04 ?

If you want to use dotnet 6, you also could download the binary file and install it.

Installation inside your home directory.

mkdir ~/.dotnet 
cd ~/.dotnet
wget https://download.visualstudio.microsoft.com/download/pr/17b6759f-1af0-41bc-ab12-209ba0377779/e8d02195dbf1434b940e0f05ae086453/dotnet-sdk-6.0.100-linux-x64.tar.gz
tar -xf dotnet-sdk-6.0.100-linux-x64.tar.gz
export PATH="$PATH:$HOME/.dotnet"
rm -rf dotnet-sdk-6.0.100-linux-x64.tar.gz

Solution 2:[2]

if you upgraded to Ubuntu 22.04, first install SSL 1.0

http://security.ubuntu.com/ubuntu/pool/main/o/openssl1.0/libssl1.0.0_1.0.2n-1ubuntu5.8_amd64.deb

and then follow standard instructions:

https://docs.microsoft.com/en-US/dotnet/core/install/linux-ubuntu#2110

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Waytal
Solution 2 AFD