5 On Linux 1

1 Introduction


As you know, is now cross-platform and open source. You can run application on Linux, Windows, and Mac OS X.

Nadella (Microsoft CEO) said “Microsoft loves Linux”, and I say “I love both, Linux and Microsoft”.

tux Microsoft_logo_(2012).svg

In this post, I will talk about:

  1. Motivation for 5 on Linux ;
  2. Installing 5 on Linux (Ubuntu 15.04);
  3. Installing Visual Studio Code (VS Code);
  4. Install Node.js and related tools
  5. Install Yeoman, the tool for scaffolding 5 applications
  6. Develop Simple Console Application on Linux
  7. Develop MVC Web Application
  8. Issues


2 Motivation for 5 on Linux

ASP.NET 5 is a new open-source and cross-platform framework for building modern cloud-based Web applications using .NET” (from )

It is a good direction for team to give us a tool capable of running on different platforms. We develop once and we deploy everywhere like in Java!

3 Installing 5 on Linux (Ubuntu 15.04)

Steps for installing 5 on Linux (Ubuntu 15.04) are:

  1. Install Mono;
  2. Install libuv;
  3. Install .NET Version Manager (dnvm)

After these three steps, we should run 5 on Linux machine


3.1 Mono Installation

Mono is   ”a software platform designed to allow developers to easily create cross platform applications” (from ).  It is developed using C# and sponsored by

Commands to get Mono installed on Linux

sudo apt-key adv --keyserver --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF

This command imports the public key used by the package management system

echo "deb wheezy main" | sudo tee /etc/apt/sources.list.d/mono-xamarin.list

the above command creates a list file for our mono
After this command, we have to reload our package database

sudo apt-get update

Once the package database is updated, it is time to install mono by this command

sudo apt-get install mono-complete

3.2 libuv installation

libuv  is “a multi-platform support library with a focus on asynchronous I/O. It was primarily developed for use by Node.js and others” (from In our case it will be used by KestrelHttpServer.

Firstly, we need to install these tools, if they are not already installed on Linux: automake, libtool and curl.

sudo apt-get install automake libtool curl

After this command, we fetch libuv source by executing the following command and we extract it

curl -sSL | sudo tar zxfv - -C /usr/local/src

Following commands are used to compile and to install libuv on the linux machine

cd /usr/local/src/libuv-1.4.2
sudo sh
sudo ./configure
sudo make
sudo make install
sudo rm -rf /usr/local/src/libuv-1.4.2 && cd ~/
sudo ldconfig

3.3 .NET Version Manager (DNVM) Installation

This command installs dnvm

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

At this stage, we have a machine capable of running 5. We can check which .Net version by this command

dnvm list


4 Installing Visual Studio Code (VS Code)

Visual Studio Code (VS Code) is a brand new code editor and cross-platform (Windows, Linux, Mac OS X) from Microsoft.

VS Code installation on Linux is straightforward, just you download the zip file from this web page. .

Once downloaded; you make a new folder and extract inside that folder. It is useful to create a link to the executable Code by this command:

sudo ln -s /path/to/vscode/Code /usr/local/bin/code

This way, we can run the command code .  from any folder.

5 Installing node.js and Yeoman

From my point of view, I have found that one of the big changes in 5 is the introduction of node.js and related tools (bower, grunt, gulp, yeoman, …). Any web application developer should learn node.js and related tools if he/she wants to stay competitive.

Yeoman as we can read on their web site is  a “web’s  scaffolding tool for modern webapps”.  And 5 on linux leverages yeoman for scaffolding Applications.

To install node.js on linux, just you run this command:

sudo apt-get install nodejs-legacy npm

We will need to install grunt-cli, which is a task runner and bower, which is used to manage JavaScript libraries for our applications

sudo npm install –g grunt-cli
sudo npm install –g bower

Now it is time to install yeoman:

sudo npm install –g yo

Because we are working with; we need to install as well for yeoman:

sudo npm –g generator-aspnet

At this stage, we can now start generating applications by yeoman

yo aspnet


The following picture illustrates its output:





As we can see on this picture, different applications can be generated:

  • Empty Application
  • Console Application
  • Web Application
  • Web Application Simple (Without Membership and Authorization)
  • Web API Application
  • Nancy ASP.Net Application
  • Class Library

The following picture illustrates what we get once we choose to generate Console Application


As we can see on this picture, we have to give a name to our ASP.Net Application, and the tool tells us what to do for building and running the application.

Three important commands to be aware of are:

  • dnu restore;
  • dnu . run for console application ;
  • dnx . kestrel for web projects


The following picture illustrates the output for dnx . kestrel


Once the server has started, we can go to http://localhost:5000  (this port can change in the config file …). The following picture illustrates our Web Application in Firefox browser


6 Debugging Issues

At the moment, it is easy to debug Node.js Applications, but for Console Applications, you can do it but it is not straightforward. Use this hack from this web site for console application . It is written for Mac but it works on Linux as well.

For Web Application, it is not feasible yet (!


The following picture illustrates debugging Node.js Application


Following picture illustrates Debugging Console Application


7 Conclusion

In this post, I have tried to highlight my enthusiasm regarding the 5 which is now  cross-platform.  It is not yet ready to develop enterprise Applications on Linux but I think it will be feasible in coming days.

Leave a comment

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

One thought on “ 5 On Linux