---
title: "Building ASP .NET 5 Applications on Linux with TFS 2015, Part 3: Installing DNX"
description: In part 1, we set up TFS. In part 2, we configured our Linux build agent. Now in part 3, we'll be setting up DNX (the .NET Execution Environment) for Linux. Since DNX/ ASP .NET 5 is still in development, we'll be going against the latest dev branch for extra fun.
---

[InCycle Software's Application Modernization and DevOps Blog ](https://blogs.incyclesoftware.com)

# [Building ASP .NET 5 Applications on Linux with TFS 2015, Part 3: Installing DNX](https://blogs.incyclesoftware.com/2015/08/building-asp-net-5-applications-on-linux-with-tfs-2015-part-3-installing-dnx/)

 Written by [Daniel Mann](https://blogs.incyclesoftware.com/author/daniel-mann) | Aug 17, 2015 8:00:06 AM

In part 1, we set up TFS.  
 In part 2, we configured our Linux build agent.  
 Now in part 3, we'll be setting up DNX (the .NET Execution Environment) for Linux. Since DNX/ ASP .NET 5 is still in development, we'll be going against the latest dev branch for extra fun. You can find more details on the [ASPNET GitHub page](https://github.com/aspnet/Home/tree/dev).

First up, we need to install Mono, the open-source CLR and BCL implementation.  
 Run the following commands to get that process started.

`sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF`

`echo "deb http://download.mono-project.com/repo/debian wheezy main" | sudo tee /etc/apt/sources.list.d/mono-xamarin.list`

`sudo apt-get update`

`sudo apt-get install mono-complete`

As always, answer any prompts that come up with "yes", and wait patiently. Installing Mono takes a while!

When it's done, run `mono --version`

If everything is okay, you'll see this:

`Mono JIT compiler version 4.0.3 (Stable 4.0.3.20/d6946b4 Tue Aug 4 09:43:57 UTC 2015) Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com TLS: __thread SIGSEGV: altstack Notifications: epoll Architecture: amd64 Disabled: none Misc: softdebug LLVM: supported, not enabled. GC: sgen`

Now we can install DNVM/DNX.

`sudo apt-get install unzip`

`curl -sSL https://raw.githubusercontent.com/aspnet/Home/dev/dnvminstall.sh | DNX_BRANCH=dev sh && source ~/.dnx/dnvm/dnvm.sh`

Run those commands, answer "yes" to any prompts, and when they're complete, run the  
`dnvm` command to test that everything is installed:

`___ _ ___ ____ ___ / _ \/ |/ / | / / |/ / / // / /| |/ / /|_/ / /____/_/|_/ |___/_/ /_/`.NET Version Manager - Version 1.0.0-beta7-10410  
 By Microsoft Open Technologies, Inc.

DNVM can be used to download versions of the .NET Execution Environment and mana ge which version you are using.  
 You can control the URL of the stable and unstable channel by setting the DNX_FE ED and DNX_UNSTABLE_FEED variables.

Current feed settings:  
 Default Stable: https://www.nuget.org/api/v2  
 Default Unstable: https://www.myget.org/F/aspnetvnext/api/v2  
 Current Stable Override:  
 Current Unstable Override:

Use dnvm [help|-h|-help|--help] to display help text.

Then, we need to make sure we have the most recent DNX, so run `dnvm upgrade -u`

You'll see text along these lines:

`Determining latest version Latest version is 1.0.0-beta7-12340 Downloading dnx-mono.1.0.0-beta7-12340 from https://www.myget.org/F/aspnetvnext/api/v2 Download: https://www.myget.org/F/aspnetvnext/api/v2/package/dnx-mono/1.0.0-beta7-12340 ######################################################################## 100.0% Installing to /home/ictfs-admin/.dnx/runtimes/dnx-mono.1.0.0-beta7-12340 Adding /home/ictfs-admin/.dnx/runtimes/dnx-mono.1.0.0-beta7-12340/bin to process PATH Setting alias 'default' to 'dnx-mono.1.0.0-beta7-12340'`

Make a note of that path -- you'll need it later.

We also need to add a package source to our NuGet.Config, so modify ~/.config/NuGet/NuGet.Config:

`sudo nano ~/.config/NuGet/NuGet.Config`

Copy and paste this config into that file and save it. It's okay if the file is empty right now!

Now, a few more prerequisites. We have to install Libuv in order to test that DNX is working properly, so run these commands:

`sudo apt-get install automake libtool curl`

Answer "yes" to any prompts.  
 Then run:

`curl -sSL https://github.com/libuv/libuv/archive/v1.4.2.tar.gz | sudo tar zxfv - -C /usr/local/src`

`cd /usr/local/src/libuv-1.4.2`

`sudo sh autogen.sh`

`sudo ./configure`

`sudo make`

`sudo make install`

`sudo rm -rf /usr/local/src/libuv-1.4.2 && cd ~/`

`sudo ldconfig`

Finally, we need Git so that we can clone the ASPNET repo with the sample projects in it.

`sudo apt-get install git`

Answer "yes" to any prompts.

Now we can clone the repo with the sample code in it:

`cd ~`

`git clone https://github.com/aspnet/Home.git`

Navigate into the cloned repo:

`cd Home/samples/latest/HelloWeb`

Run the DNU utility to restore the missing NuGet packages. There are some performance issues with this, so first run

`export MONO_THREADS_PER_CPU=2000`

then

`dnu restore`

If you get an error at this step, run

`sudo service unscd stop`

, then rerun

`dnu restore`

You may also get some errors about missing packages. This is a development repo, so stuff is in a state of flux. When I was writing this blog, I had to open up project.json and add two dependencies:

"Microsoft.CodeAnalysis.CSharp": "1.0.0-*",  
 "System.Reflection.Metadata": "1.0.0-*"

and rerun the package restore.

Once the restore is done successfully, we can test that everything is installed and working properly by running

`dnx kestrel`

You should see

`Application started. Press Ctrl+C to shut down.`

You should be able to open up a browser and navigate to http://yourbuildserver:5004/ and see the ASP .NET welcome page.

Okay, you're done! Your environment is correctly configured to build ASP .NET 5 applications using DNX!

In our last blog post, we'll create a new TFS build definition that will build and package up this application for deployment!

[View full post](https://blogs.incyclesoftware.com/2015/08/building-asp-net-5-applications-on-linux-with-tfs-2015-part-3-installing-dnx/)

```json
{
  "@context" : "http://schema.org",
  "@type" : "BlogPosting",
  "author" : {
    "@type" : "Person",
    "name" : "Daniel Mann"
  },
  "dateModified" : "2017-07-20T16:38:30.891Z",
  "datePublished" : "2015-08-17T08:00:06Z",
  "headline" : "Building ASP .NET 5 Applications on Linux with TFS 2015, Part 3: Installing DNX",
  "image" : {
    "@type" : "ImageObject",
    "height" : 60,
    "url" : "/hs/hsstatic/content_shared_assets/static-1.4092/img/default-amp-logo.png",
    "width" : 60
  },
  "mainEntityOfPage" : "https://blogs.incyclesoftware.com/2015/08/building-asp-net-5-applications-on-linux-with-tfs-2015-part-3-installing-dnx/",
  "publisher" : {
    "@type" : "Organization",
    "logo" : {
      "@type" : "ImageObject",
      "height" : 60.0,
      "url" : "https://cdn2.hubspot.net/hubfs/707613/logo-InCycle-New-Blue---transparent.png",
      "width" : 195.91837
    },
    "name" : "InCycle Software Blog"
  }
}
```