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.
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.
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
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
Inside a folder create a new console project with:
dotnet new console
To run it, you need to use:
And everything works correctly qou will be able to see a Hello World message on your terminal: