Update
Since the time this article was published Microsoft has released the official way of installing DotNet Core you can find them in DotNet Ubuntu 18.04 Downloads
With the release of Ubuntu 18.04 the new LTS version of the popular Operating System, people might be eager to try dotnet on the platform.
Sadly, at the time of writing this post, neither the page getting stater page DotNet Get Stated nor the downloads page DotNet Downloads list a compatible package with this OS.
In fact, if you try to install following the instruccions for the closest release which was 17.04 Instructions Ubuntu 17.04 you will get an error of missing dependencies.
In order to install you have to used the following steps as it is indicated in this GitHub issue.
Registering Microsoft keys and feeds
It is necessary to add the keys and the feed to the system so you have to type in a terminal the following commands.
sudo apt-key adv --keyserver packages.microsoft.com --recv-keys EB3E94ADBE1229CF
sudo apt-key adv --keyserver packages.microsoft.com --recv-keys 52E16F86FEE04B979B07E28DB02C46DF417A0893
To add the feed you need to type:
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-bionic-prod bionic main" > /etc/apt/sources.list.d/dotnetdev.list'
And update the packages list with
sudo apt-get update
Installing DotNet Core
To install dotnet you can use the stable version with:
sudo apt-get install dotnet-sdk-2.1.105
Or the newest preview version with:
sudo apt install dotnet-sdk-2.1.300-preview2-008533
Remember that you can have both installed side by side, newer dotnet have the dotnet --list-sdks and dotnet --list-runtimes, although the newest will be used if it is not overridden with a global.json file. You can find more info in this Scott Hanselman's post. Also
Testing the installation
Inside a folder create a new console project with:
dotnet new console
To run it, you need to use:
dotnet run
And everything works correctly qou will be able to see a Hello World message on your terminal:
Hello World!
Top comments (9)
Can u help me?
How to trust the self signed certificate to run a web app on https?
since
dotnet dev-certs https --trust
not work in linux.Hours I've spent working on this. Even wound up ditching my old Ubuntu Studio distro. Thank you so much!
how come, that the tutorial from Microsoft doesn't work and this one is working as a charm...
Thanks Carlos!
I managed to download and install everything. thanks a lot
Thanks man,this is great..
You are a person with a capital letter. You have solved my problem)
This was a Godsend. I am new to programming and even newer to Linux and Ubuntu. I was destroying my brain trying to figure this out. Thanks for this.
OMG, that helped. Thanks! <3 <3 <3