Scott Hanselman

Trying .NET Core on Linux with just a tarball (without apt-get)

June 08, 2017 Comment on this post [14] Posted in DotNetCore | Linux
Sponsored By

There's a great post on the .NET Blog about the crazy Performance Improvements in .NET Core that ended up on Hacker News. The top comment on HN is a great one that points out that the http://dot.net  website could be simpler, that it could be a one-pager with a clearer Getting Started experience.

They also said this:

Also, have a simple downloadable .tar.gz which expands into /bin + /lib + /examples. I loved C# back in my Windows days and I moved to Linux to escape Microsoft complexities and over-reliance on complex IDEs and tools, scattered like shrapnel all over my c:/

I will not run apt-get against your repo without knowing ahead of time what I'm getting and where will it all go, so let me play with the tarball first.

This is a great point, and we're going to look at revamping and simplifying the http://dot.net/core with this in mind in the next few weeks. They're saying that the Linux instructions, like these instructions on installing .NET Core on Ubuntu for example, make you trust a 3rd party apt repro and apt-get .NET, while they want a more non-committal option. This gets to the larger "the website is getting bigger than it needs to be and confusing" point.

.NET Core from a tarbar on Linux

Trying out .NET Core from a tarball

Go to https://www.microsoft.com/net/download/linux and download the .tar.gz for your distro to a nice local area.

NOTE: You MAY need to apt-get install libunwind8 if you get an error like "Failed to load /home/ubuntu/teste-dotnet-rc2/libcoreclr.so, error: libunwind.so.8: cannot open shared object file: No such file or directory" but libunwind isn't very controversial.

Once you've unziped/tar'd it into a local folder, just be sure to run dotnet from that folder.

Desktop $ mkdir dotnetlinux
Desktop $ cd dotnetlinux/
dotnetlinux $ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.2 LTS
Release: 16.04
Codename: xenial
dotnetlinux $ curl -o dotnet.tar.gz https://download.microsoft.com/download/E/7/8/E782433E-7737-4E6C-BFBF-290A0A81C3D7/dotnet-dev-ub
untu.16.04-x64.1.0.4.tar.gz
dotnetlinux $ tar -xvf dotnet.tar.gz
dotnetlinux $ cd /mnt/c/Users/scott/Desktop/localdotnettest/
localdotnettest $ ../dotnetlinux/dotnet new console
Content generation time: 103.842 ms
The template "Console Application" created successfully.
localdotnettest $ ../dotnetlinux/dotnet restore
Restoring packages for /mnt/c/Users/scott/Desktop/localdotnettest/localdotnettest.csproj...
localdotnettest $ ../dotnetlinux/dotnet run
Hello World!

There aren't samples in this tar file (yet) but there are (some weak) samples at https://github.com/dotnet/core/tree/master/samples you can clone https://github.com/dotnet/core.git and run them from samples. Note from the ReadMe that https://github.com/dotnet/core is the jumping off point for the other repos.

The more interesting "samples" are the templates you have available to you from "dotnet new."

localdotnettest $ /mnt/c/Users/scott/Desktop/dotnetlinux/dotnet new
*SNIP*

Templates Short Name Language Tags
----------------------------------------------------------------------
Console Application console [C#], F# Common/Console
Class library classlib [C#], F# Common/Library
Unit Test Project mstest [C#], F# Test/MSTest
xUnit Test Project xunit [C#], F# Test/xUnit
ASP.NET Core Empty web [C#] Web/Empty
ASP.NET Core Web App mvc [C#], F# Web/MVC
ASP.NET Core Web API webapi [C#] Web/WebAPI
Solution File sln Solution

Examples:
dotnet new mvc --auth None --framework netcoreapp1.1
dotnet new classlib
dotnet new --help

From here you can "dotnet new web" or "dotnet new console" using your local dotnet before you decide to commit to installing .NET Core from an apt repo or yum or whatever.


Sponsor: Check out Seq: simple centralized logging, on your infrastructure, with great support for ASP.NET Core and Serilog. Download version 4.0.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Hosting By
Hosted in an Azure App Service
June 08, 2017 23:22
FYI, all the tarball links point to v1.0.4 instead of v1.0.5 or v1.1.2
June 08, 2017 23:42
Good point Matt -- one of the disadvantages of maintaining an over-complicated site affects even the simplifying blog post!
Jed
June 09, 2017 0:27
You can also get daily tarballs from here: https://github.com/dotnet/cli
June 09, 2017 1:35
I thought Stephen Toub's blog post was great. I find it ironic that what you took from it though is the need to gain more acceptance on places like Hacker News by making it more friendly to Linux devs.

What I took from it (besides all the great work the community has done) is what a shame that the .NET Framework (aka- where Microsoft's *paying* customers are) is now a distant afterthought on its way to being deprecated- with no official strategy on moving mainline Windows development to .NET Core yet.

WPF, WinForms, etc all need a way to be written on top of .NET Core, both to unify the code base and to ensure that the *customers* you should be caring about are actually getting the benefits of the work going on.
Sam
June 09, 2017 19:43
What about debian testing? The libunwind8 that can be found in the testing repo doesn't seems to be compatible.
June 09, 2017 19:44
I've installed .Net Core on my Debian Jessie install.

This documentation sums up how to install from the tarball.


FYI, all the tarball links point to v1.0.4 instead of v1.0.5 or v1.1.2


It would seem that the install instructions are outdated. However if you go to ms download area, under Runtime, you will find v1.0.5 and v1.1.2. All the SDK files still point to v1.0.4.

June 09, 2017 20:51
Yeah, the tarballs for 1.0.5 and 1.1.2 are here: https://www.microsoft.com/net/download/linux

Also, Scott, you've got spam ;)
June 10, 2017 23:15
Unfortunately, those simple instructions only work on reasonably stuffed mainline distribtions - official instructions can be found for ubuntu, debian, fedora, suse, and centos if I remember correctly (which is a good thing, most ppl will be happy with such broad support).

I like this post, because it shows a generic way to get dotnet working on linux. Typically this would be: Download, unpack, symlink executable into /usr/local/bin or similar, satisfy dependencies. You left out the symlink to be less intrusive, nice.

However, I don't like the post, because the remaining dependencies (not mentioned in this post, e.g. libicu) are not met on other linux systems. Fact: Scott would have a hard time to gather a complete list, because required dependencies are scattered around various git repos and there is no global list. Many of them can be found on raspberry tutorials, which are all debian based to the best of my knowledge.

The past week I've been compiling more and more dependencies into a custom yocto-bitbake-openembedded linux running on a small armv7l device. Good: now the latest dotnet core 2.0 build from https://github.com/dotnet/core-setup/ works like a charm and my asp.net core 2.0 webapi serves sweet json from this tiny device. Bad: I don't really understand what dependencies were required and which one accidentally went into it. Put differnently: I don't know, what I'm doing ;-) Try & error is quite time-consuming when you compile the linux from scratch... otherwise I could now present a precise list of dependencies for 2.0.

I hope for dependency clarification, because this will probably allow dotnet on any linux. The 2.0 builds are quite generic and less focused on particular distros (great). You can find generic builds for linux-x64, and 32bit linux-armhf at least.
June 11, 2017 4:35
However, I don't like the post, because the remaining dependencies (not mentioned in this post, e.g. libicu) are not met on other linux systems. Fact: Scott would have a hard time to gather a complete list, because required dependencies are scattered around various git repos and there is no global list. Many of them can be found on raspberry tutorials, which are all debian based to the best of my knowledge.
June 12, 2017 2:21
Hello Scott...
Does exist any programing related stuff that could benefit from a 10 core cpu?
I only saw 3D rendering, video editing and video transcoding ....
For compiling I read that its overkill....
June 12, 2017 2:24
Maybe some kind of testing for example.
June 12, 2017 17:47
I use the Docker images to prevent system "pollution". This is safer too...
June 19, 2017 4:35
Muito bom!!! Parabéns!!!
June 20, 2017 1:27
Thanks for the great write-up Scott!

Comments are closed.

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.