UPDATE: Microsoft added the official docs to Install .NET Core on Ubuntu 20.04 package manager.
UPDATE 2: Added link to scripted installation alternative Scripted Install
The newest Ubuntu LTS release is available now. Sadly, at the time of this writing (April 24th), there is no official installation method for Ubuntu 20.04 listed on the .Net website.
Manual Installation
For this tutorial we are going to manually install DotNet Core 3.1.201 SDK using the binaries provided in the official page.
Download the binaries
Head to .Net Core Downloads and look for the x64 Binaries in the Linux.
Alternatively you can use this link to get the specific version used in this tutorial.
Extract and link
After the download finishes, open a Terminal (you can use Super+Alt+T as a shortcut).
Navigate to the folder where it was downloaded and run the following command
mkdir -p $HOME/dotnet && tar zxf dotnet-sdk-3.1.201-linux-x64.tar.gz -C $HOME/dotnet
This command will create a dotnet folder on the user's home directory and extract there the contents of the file.
Note: Please be aware that the file name dotnet-sdk-3.1.201-linux-x64.tar.gz
matches the one you downloaded, otherwise you might need to modify the previous command accordingly to your download.
Export variables
Run the following commands to temporarily add the dotnet binaries in your terminal session.
export DOTNET_ROOT=$HOME/dotnet
and
export PATH=$PATH:$HOME/dotnet
Note: This will work only for the current session, at the end of the tutorial you will find instructions to add it permanently.
Test the installation
Run dotnet
in the Terminal, and the following should show appear:
Congratulations! You have installed dotnet core.
Permanently add the dotnet command
To add the dotnet commands permanently, you need to add the dotnet folder to the path of your system. To achieve this need to modify the ~/.bashrc
file by running.
gedit ~/.bashrc
This will open an editor with the file contents. At the end of the file add the following two lines:
export PATH=$PATH:$HOME/dotnet
export DOTNET_ROOT=$HOME/dotnet
Save the file (Ctrl+S) and close all the open Terminal windows. Next time you open a new one dotnet
will be available.
Other installation methods
Package Manager
This is the official way to install dotnet core for Ubuntu based systems. The instructions for the 20.04 version can be found in Package Manager Install
Scripted Install
It has been reported that some PopOS! users might have issues with the official and manual installation methods. In that case it might be solved by using the scripted install method whose instructions can be found in the following link Scripted Install. Thanks to Emma for the contribution.
Top comments (10)
I had problem with this instructions (they are same as on microsoft's page) with JetBrain Rider. I returns error it can't connect to Msbuild Even i point it to right place. So i had to use scrpting instalation guide from its page
Hi Emma do you have the link to that information so I can update the post with it. Thanks
Hi here it is... docs.microsoft.com/en-us/dotnet/co... (this is wats working on my Pop_OS 20.10)
I've updated the post with the information provided. Thank you for your contribution Emma
Hi May Meow!
I think it can help you:
dev.to/antoniofalcao/using-net-5-w...
Thanks for this!
It works +1000 .
Check docs.microsoft.com/en-us/dotnet/co...
Thanks I will update the post with the new information
Much appreciated Carlos.