Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to download dotnet-sdk-2.2 on ubuntu 20.04 focal?

I've been trying to download netcore 2.2 on ubuntu, Ive tried with apt and I have no luck I get the package not found error.

I also tried downloading the binaries and registering the path but it doesn't seem to work. Is it just not possible at all?

like image 214
Jose Gonzalez Avatar asked Mar 02 '23 02:03

Jose Gonzalez


2 Answers

.NET Core 2.2 was End of Life'd in Dec 2019. So Microsoft doesn't produce packages .NET Core 2.2 for recent versions of Linux distributions, including Ubuntu 20.04. Only 2.1 and 3.1, the currently supported versions, are available for Ubuntu 20.04.

If you want to install them, you should try a manual install:

  1. Go to the main download site: https://dotnet.microsoft.com/download/dotnet-core

  2. Click "Out of support versions". That should show you a table. Click on 2.2, which should take you to: https://dotnet.microsoft.com/download/dotnet-core/2.2

  3. Click on the "x64" under the "Binaries" table of the release: https://dotnet.microsoft.com/download/dotnet-core/thank-you/sdk-2.2.207-linux-x64-binaries

  4. Follow the steps on that page to extract the downloaded tarball and "install" it:

    mkdir -p $HOME/dotnet && tar xf dotnet-sdk-2.2.207-linux-x64.tar.gz -C $HOME/dotnet
    export DOTNET_ROOT=$HOME/dotnet
    export PATH=$PATH:$HOME/dotnet
    

I am going to repeat the warnings you will see on the download site: This is an old version of .NET Core which has many unpatched security vulnerabilities that are now public. You do not want to deploy an application to production using .NET Core 2.2. Upgrade to 3.1 or downgrade to 2.1 instead.

like image 60
omajid Avatar answered Mar 04 '23 17:03

omajid


In my case, I already had versions installed through APT.

As I had to work on some projects that still use .NET Core 2.2, I just copied the contents of the $HOME/dotnet/sdk/2.2.207 (this version may be different on your machine) and $HOME/dotnet/shared/* folders to /usr/share/dotnet.

With bash, I've used this commands:

sudo cp -r ~/dotnet/sdk/* /usr/share/dotnet/sdk/
sudo cp -r ~/dotnet/host/* /usr/share/dotnet/host/
sudo cp -r ~/dotnet/shared/* /usr/share/dotnet/shared/
like image 33
Bruno B. de Souza Avatar answered Mar 04 '23 17:03

Bruno B. de Souza