Install ASP.NET 5 on Linux Ubuntu 14.04 - 15.04

Updated for beta8


I'm running several ASP.NET 5 application on multiple Ubuntu Debian machines already. Some options are not necessary, but I've included them because you will need them later on.

For the installation I will use a fresh copy of Ubuntu 14.04 x32 Debian 8.1 x64

Note: I'd recommend using x64 because .NET coreclr just supports x64 at the moment


0. Since most of our commands require root permission, we will switch to sudo bash 

sudo bash


First we need to install a few dependencies:


1. NPM:

Optional, but I highly recommend installing the Node Package Manager.

apt-get install npm


2. GIT:

Optional, but most people use Git as their version control software nowadays. Including Microsoft.

apt-get install git


3. Mono:

(More or less optional) This is an open source software platform, sponsored by Xamarin, that allows us to use .NET on cross platform devices. Many things are still missing in .NET Core so you might want to target mono instead. Atleast until all you needed features gets included into .NET Core.

If you target the coreclr you don't need mono. See Mono Installation Docs.

apt-key adv --keyserver --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
echo "deb wheezy main" |  tee /etc/apt/sources.list.d/mono-xamarin.list
apt-get update

install Mono-Complete


4. DNX Prerequisites

.NET Core needs following packets (Mono doesn't need them btw):

apt-get install libunwind8 gettext libssl-dev libcurl3-dev zlib1g libicu-dev


5. Libuv:

The (development) web server Kestrel is based on libuv. [Comparison: WebListener is a wrapper around HTTP.sys]

apt-get install automake libtool curl

-sSL | tar zxfv - -C /usr/local/src
cd /usr/local/src/libuv-1.4.2
sh ./configure
make install
rm -rf /usr/local/src/libuv-1.4.2 && cd ~/ ldconfig


6. DNVM:

Unzip (Is needed to unzip runtimes for DNVM):

apt-get install unzip

The .NET Version Manager is a command line tool to configure and setting up (different) runtimes.

curl -sSL | DNX_BRANCH=dev sh && source ~/.dnx/dnvm/
source ~/.dnx/dnvm/


7. Node.js + Build-Essential

Optional: This comes handy in combination with bower and grunt. It's required for the yeoman generators.

curl -sL | bash -
apt-get install -y nodejs
apt-get install -y build-essential


Now we need to fix/install a few things:


1. Fix NuGet Feeds:

cd ~/
mkdir NuGet
cd NuGet
nano NuGet.config
<?xml version="1.0" encoding="utf-8"?>
<add key="AspNetVNext" value="" />
<add key="" value="" />
<disabledPackageSources />

(Save with CTRL+O and Exit with CTRL+X)


2. Update DNVM + Upgrade DNX Runtime (You may need apt-get install unzip):

dnvm update-self
dnvm install latest

Caution:  If you want the latest feed use the unstable paramater -u (dnvm update-self -u or dnvm install latest -u)!

If you want to install the coreclr use the parameter -r coreclr

If you want a specific or older version use this for example:

dnvm install 1.0.0.-beta8


3. Updating NPM:

npm install -g npm@latest
npm cache clean


4. Yeoman Generators:

npm install -g yo grunt-cli generator-aspnet bower


If you have STILL an outdated Node.js version do this and RESTART your terminal 

npm cache clean -f
npm install -g n
n stable


Basicly we are done! For a small test we are going to create a project:


0. You could download an example instead:

1. Call the ASP.NET Generator:


yo aspnet


 2. Select Web Application:


2. After creation, change into its folder:

cd YourAppName


3. Restore NuGet pakets:

dnu restore


4. Run kestrel:

Update: If you are at beta1-6 use 'dnx . kestrel' (with a dot) instead

dnx kestrel


If you want to run kestrel in the background:

nohup dnx kestrel > /dev/null 2>&1 &


... done (go to http://localhost:5001 or http://localhost:5004 - whatever is stated in your project.json)



Mahmut Jomaa is a Software Engineer from Germany.

Currently he attends university to gain more knowledge in Computer Science.

+2 # Deploy from Visual Studio..? 2015-10-20 13:46 – David
Hi Mahmut , awesome article, the most complete and clear I found on the net, better than Microsoft documentation :)

I follower your guide step by step, but I'm not familiar with git and it's not clear to me how I can now deploy my ASP.NET5.0 application from my pc (Visual Studio) to my Linux machine...

Can I simply copy my ASP.NET5.0 source (for example via WinSCP) to a folder on my Linux machine..? Or have I to create a Nuget package..?

Please add a final paragraph with a step-by-step exaple of deploying from Visula Studio too :)

Thank you very much again.
Reply | Reply with quote | Quote
+1 # You can do both 2015-10-29 15:50 – MJomaa
Hi David, thank your for your comment :)

Before beta8 it was not possible to deploy a .NET Core project directly from Visual Studio (aka without copy pasting the whole source code) to a *nix machine without further hassles.
[*To be right on this: It was possible, but not everything from .NET Core was suited for cross-platform at that time like missing libs and so on]

However if you've targeted Mono, it worked fine. Now .NET Core can do this, too.
In other words: Cross-platform support by Microsoft got one step further.

There are currently 3 ways:

1) The easiest way is to copy the source code and running "dnu restore" and "dnx kestrel" on the *nix machine. This was possible before beta8.

2) Use the publish to disk feature from Visual Studio. This will pack your code, the required NuGet packages and the selected clr into a folder with usually 2 cmd / terminal commands. Then copy the deployed folder to your *nix machine and just run it :)
(If the linux-coreclr is missing in the list, just install it into your windows dnvm)

3) Publish to Azure. If you are using Azure you can deploy your application easily with the built-in function from Visual Studio or from source control.

Note that this will be much easier in the future.
Even the whole installation process will be a simple 'apt-get install XXX' at one point.
Reply | Reply with quote | Quote
-1 # access to gpio 2015-11-19 23:59 – Patryk
Hi, when we want to have web with access to rpi gpio we must give sudo permission to dnx kestrel ? how we can do it ?
Reply | Reply with quote | Quote
+1 # Check your permissions 2015-11-23 18:37 – MJomaa
You have to check the permissions and the owner/group of the file.
(In Linux everything is more or less.. a file - even a directory)
Use the command ls -la for that.

AFAIK you need atleast chmod 660 for /sys/class/gpio/

You can switch to super user (root) with:
su or sudo bash (Note: Debian Server doesn't have sudo installed)
and start your kestrel server / cmd program with root privileges for testing.

I'd recommend to create an extra user and set the permissions and ownership with chmod and chown for that new user specificly.

Just keep in mind that Unix was designed for multiple user / sessions, so creating a new user on the fly is really no big deal.

In addition I'd recommend you to use an automated process watcher:
Reply | Reply with quote | Quote
Roberto Prevato
+1 # Restore failed access denied 2015-12-28 09:57 – Roberto Prevato
Thanks for the detailed article!
I followed along up to the point I must run "dnu restore" for the HelloMvc application. I first got the error "Restore failed Access to the path "/home/$user$/.dnx/packages/Microsoft.Framework.Lo gging.Console" is denied."; then if I simply change this folder permissions; I get another error: "Error: ConnectFailure (interrupted)". Do you have any hint, how to solve this issue?
Reply | Reply with quote | Quote
Roberto Prevato
+1 # Resolved 2015-12-28 11:27 – Roberto Prevato
It was my mistake: I was trying to run dnu restore from the normal user (not root). Running dnu restore from a root bash, like described in the article, works fine.
Reply | Reply with quote | Quote
+1 # Software Developer 2016-01-14 07:46 – Vignesh
Hi Mahmut, This is best article i have found. Everything works perfectly. Finally i have installed everything and created a sample project as per your steps. When i do, 'dnu restore' my application dependencies get failed. I couldn't able to fix this. Handled various ways but no solution, Kindly help me.

Mono Version
Mono JIT compiler version 4.2.1 (Stable Thu Nov 12 09:52:44 UTC 2015)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors.
TLS: __thread
SIGSEGV: altstack
Notifications: epoll
Architecture: amd64
Disabled: none
Misc: softdebug
LLVM: supported, not enabled.
GC: sgen
Reply | Reply with quote | Quote
0 # I need more information :) 2016-01-15 16:45 – MJomaa
I see, you have one of the latest mono versions installed.

Does your application target .NET Core or the full .NET framework?
Make sure you have the right CLR selected. (dnvm list, dnvm use)

Can you copy paste the error message?
If the message is too long you can use a copy-paste service like or
Reply | Reply with quote | Quote
0 # __ 2016-01-31 16:23 – Maciej
Hello Mahmut,

Great tutorial, thank you.
I'm an advanced developer Asp.Net in Windows, but in Linux I am new new.
Is there a possibility that I normally develope applications in Visual Studio on Windows, but publish I will make to share'a, e.g.
and only through the browser, for example: http: //linux_machine/appl_folder/default.aspx run and application?
I other words, I would like to still develope in Win but publish to Linux and give end users final appl link
Reply | Reply with quote | Quote
0 # Yep 2016-01-31 23:12 – MJomaa
You can develop with Visual Studio on Windows and publish it to Linux. :)
Actually that is what I do atm.

However if your goal is to publish always to Linux, I'd recommend you still setting up an extra Virtual Machine with Ubuntu or any other Distro - so you can test your application in the end environment.

Or even better:
With gulp/grunt you can even automate the process and automaticly deploy to a docker CI-Server everytime you hit 'ctlr+save'!
Reply | Reply with quote | Quote
0 # Asp.Net hosting on Ubuntu-Mono- Failed 2016-03-27 12:22 – Prabhu
Hi Mahmut Jomaa,
This is Prabhu working as a .Net developer, i tried to host 4.0 application on ubuntu 15.04 terminal ,i could not succeeded. I executed the above steps , when i ran dnu restore receive an error like "the requested feature is not implemented" .
I tried to install latest version of mono , i could install only mono 3.2.8 .Received some error/warning message .
Error Details:
System.NotImplementedException.The requested feature is not implemented. at Microsoft.Dnx.Tooling.Restore.NuGet.PackageUtiliti es.EnsureValidPackageContents(System.IO.Stream stream)

Feeds Used :

Mono Version :Debian 3.2.8+dfsg-4ubuntu4

DNX Version :1.0.0-rc2-15546

I'm looking for your valuable comments/tips to resolve this issue.

Thanks and Regards,
Reply | Reply with quote | Quote
0 # Outdated Mono Version 2016-03-29 02:27 – MJomaa
Hello Prabhu,

Yes your mono version is outdated.
Try to add the Alpha-Channel and upgrade or reinstall mono-complete.

Besides that your dnx version 1.0.0-rc2-15546 is still quite new and unstable (despite the rc in its name). I would wait for the build announcement tomorrow or use the rc1-update1 dnx version instead.

If the problem persists, try to dnu restore with the coreclr dnx tooling first and then switch back to the normal mono clr.

dnvm upgrade -r coreclr -a x64
dnu restore
dnvm upgrade -a x64
dnu restore
Reply | Reply with quote | Quote
Rob de Voer
0 # Two lines in libuv are tangled up making the command fail. 2016-04-05 02:48 – Rob de Voer
In the install libuv section (5) two lines got tangled up making that section fail as is.

The line:

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

should be two lines:

cd /usr/local/src/libuv-1.4.2

Thanks for a great article!

Reply | Reply with quote | Quote
0 # Thank you 2016-04-05 04:48 – MJomaa
Thank you Rob. The line breaks now as expected.
This article will be updated once RC2 comes out.
Reply | Reply with quote | Quote
Rob de Voer
0 # RC2 versus Update 2 2016-04-05 23:53 – Rob de Voer
Sorry for my ignorance but I now have Update 2 installed is that different from RC2?

Have lost my regular RSS feeds on updates, especially since ScottG has changed focus as he was one of my main sources of info.

Where can I keep up to date with the upcoming releases?
Reply | Reply with quote | Quote
0 # It is not RC2. 2016-04-06 19:09 – MJomaa
Update 2 is the Visual Studio update.
The RC2 isn't released yet. In fact there isn't even a proposal release date atm.

You can keep up to date on github, and the
Reply | Reply with quote | Quote
Rob de Voer
0 # Thank for setting me right 2016-04-06 20:48 – Rob de Voer
In hindsight was obvious you referred to versioning for Core 1.0. Appreciate the help.
Reply | Reply with quote | Quote
0 # ASP.NET hosting on ubuntu 2016-04-06 10:08 – Florentin
I just discovered your article. Thank you for sharing knowledge. I have partners who have an ASP.NET application locally. They would like to host it online. I want to know if it is possible to made on a virtual machine dedicated (cloud) as having operating system Ubuntu 15.10?

Thanks in advance!
Reply | Reply with quote | Quote
0 # Yes it is possible 2016-04-06 19:43 – MJomaa
You can host your ASP.NET 5 application on Ubuntu 15.10.
Besides that I recommend using a version with a "LTS" suffix (Long Term Support).
For example Ubuntu 14.04.3 LTS.
If you want to save 50mb RAM you can use Debian instead :)
Reply | Reply with quote | Quote
0 # ASP.NET hosting on ubuntu 2016-04-07 09:02 – Florentin
Hi MJomma!
Thanks for your reply. I'll use Ubuntu 14.04 LTS. but did you write a other article which explain how we can host a ASP.NET application existing?
if no, this article allow it to do so? if yes how?
Reply | Reply with quote | Quote
Roddy Dairion
0 # Packaged into a script. 2016-04-22 14:27 – Roddy Dairion
I've put all these command into a shell script taking into consideration, missing certs. Hope this helps

just sudo ./ once you have it on your machine.
Reply | Reply with quote | Quote
Roddy Dairion
0 # Packaged into a script. 2016-04-22 14:21 – Roddy Dairion
I've put all these command into a shell script taking into consideration, missing certs. Hope this helps

just sudo ./ once you have it on your machine.
Reply | Reply with quote | Quote
Roddy Dairion
0 # Packaged into a script. 2016-04-22 14:23 – Roddy Dairion
I've put all these command into a shell script taking into consideration, missing certs. Hope this helps

just sudo ./ once you have it on your machine.
Reply | Reply with quote | Quote
Roddy Dairion
0 # Packaged into a script. 2016-04-22 14:25 – Roddy Dairion
I'm sorry for multiple post I can't seem to edit my previous posts.

I've put all these command into a shell script taking into consideration, missing certs. Hope this helps

just sudo ./ once you have it on your machine.
Reply | Reply with quote | Quote
abu fatih
0 # i can't access yo aspnet 2016-04-23 15:57 – abu fatih
I have a messages to run yo aspnet
throw err;

Error: EACCES: permission denied, open '/root/.config/configstore/insight-yo.json'
You don't have access to this file.
I hope your solution. Thank You
Reply | Reply with quote | Quote
Roddy Dairion
0 # User permission 2016-04-23 16:57 – Roddy Dairion
Quoting abu fatih:
I have a messages to run yo aspnet
throw err;
Error: EACCES: permission denied, open '/root/.config/configstore/insight-yo.json'
You don't have access to this file.
I hope your solution. Thank You

Usually due to user permission if you've used sudo to install yo then you must use sudo to run yo.
Reply | Reply with quote | Quote
0 # npm - undefined symbol 2016-04-26 13:42 – Stefan

When running the following command I get the following:

npm install -g npm@latest
npm: symbol lookup error: npm: undefined symbol: uv_os_homedir

Trying to install on Ubuntu 16.04 LTS
Reply | Reply with quote | Quote
0 # fixed! 2016-04-26 14:23 – Stefan
Installed libuv 1.9.0 and it worked :)
Reply | Reply with quote | Quote
0 # dnx krestrel 2016-07-02 00:02 – Caio
When I run 'dnx kestrel' I got this error:

Error: unknown keyword platform System.InvalidOperationException: unknown keyword platform at Microsoft.Dnx.Runtime.LibraryDependencyType.Parse (System.String keyword) in :0 at Microsoft.Dnx.Runtime.ProjectReader.PopulateDependencies (System.String projectPath, IList`1 results, Microsoft.Extensions.JsonParser.Sources.JsonObject settings, System.String propertyName, Boolean isGacOrFrameworkReference) in :0 at Microsoft.Dnx.Runtime.ProjectReader.ReadProject (System.IO.Stream stream, System.String projectName, System.String projectPath, ICollection`1 diagnostics) in :0 at Microsoft.Dnx.Runtime.Project.TryGetProject (System.String path, Microsoft.Dnx.Runtime.Project& project, ICollection`1 diagnostics) in :0
Reply | Reply with quote | Quote
0 # Reply: dnx krestrel 2016-07-02 09:58 – MJomaa
Hello Caio,

first of all you should try to move from DNX to the new dotnet CLI. DNX is not supported anymore.
Installation is very simple these days. Just go to for more information.

You are trying to run your dnx project in an unknown CLR. Edit your global.json for the right CLR. Make sure the targeted CLR is installed, too.
Reply | Reply with quote | Quote
+1 # Reply: dnx krestrel 2016-07-02 11:19 – Caio
It worked, thank you very much :-)
Reply | Reply with quote | Quote
Tawheed Ahmad
0 # thanks 2016-08-26 18:18 – Tawheed Ahmad
thanks dude :-)
Reply | Reply with quote | Quote
Security code Refresh