A First Look at Installing ASP.NET 5, Part 3: Ubuntu Linux

This is the final part of a 3 part series exploring ASP.NET 5 running on Windows, Mac OSX and Linux.

Overall I found getting ASP.NET 5 to  run on Ubuntu to be quicker and easier than doing so for OS X. It might not have been easier than Installing Visual Studio 2015 RC on Windows given that it involved a lot more typing as opposed to just clicking a couple of “Download” and “Install” buttons, but it was certainly a lot faster.

I set up a fresh Ubuntu 14.04 VM in Parallels on my Macbook Pro and then followed the instructions at http://docs.asp.net/en/latest/getting-started/installing-on-linux.html and https://github.com/aspnet/Home.

Here’s what you need to do:

  1. Install mono: 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
  2. Install libuv: sudo apt-get install automake libtool curl 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
  3. Install the DNVM: curl -sSL https://raw.githubusercontent.com/aspnet/Home/dev/dnvminstall.sh | DNX_BRANCH=dev sh && source ~/.dnx/dnvm/dnvm.sh
  4. Add NuGet sources. Edit ~/.config/NuGet/NuGet.config  with the following content (Note: I had to create this file and add the contents manually – I’m not sure if installing DNVM should have done it for me or not.):
  5. Get the latest DNX version: dnvm upgrade
  6. Install Git if it’s not already installed: sudo apt-get install git
  7. Clone the repo with their sample code: git clone https://github.com/aspnet/Home
  8. Go to the directory containing the sample app you want to try out (I used home/samples/1.0.0-beta4/HelloMvc)
  9. Load dependencies: dnu restore
  10. Start Kestrel: dnx . kestrel
  11. Check http://localhost:5004 in your browser

And lo and behold! I was doing something I never in my wildest dreams imagined would be possible: running an ASP.NET web site on an Ubuntu Linux box.  

Screen Shot 2015-06-09 at 3.51.00 PM

VS Code also seems to work just fine on Ubuntu.  

Screen Shot 2015-06-09 at 3.57.39 PM
You’ll never use Sublime Text again.
You’ll note that in the steps above, I pulled Microsoft’s samples from  https://github.com/aspnet/Home instead of using Yeoman to scaffold a project.

While trying to install Yeoman, I encountered a number of errors and decided to skip ahead and see if I could get it working with one of their existing solutions first. Once I had done that, I did a little more research and discovered it’s a little different than for OS X.

I followed these instructions and although I got some warnings about my node and npm versions being out of date (they aren’t).

I also had to install bower and grunt: sudo npm install -g bower

It worked after that. I ran sudo npm install -g yo generator-aspnet  and then after that the command yo aspnet  worked, allowing me to scaffold out a new solution as described under OS X above.

Overall Impressions

Overall I have to say I was pleasantly surprised. I was expecting a lot more headaches trying to get up and running on a Mac or Linux box than I actually encountered, and as the product matures I’m sure the few errors I did run into will be resolved. Running from a command line in Windows didn’t seem to be a problem either.

Ironically, the most annoying installation was Visual Studio 2015 RC. It was a pretty glaring contrast between installing an enormous IDE and a number of much smaller command line installations. On the other hand – Visual Studio may have taken a long time (and hung at the end) but it was a single download and install – far less typing required and fewer steps where you could screw up.

I’ve only begun to play with VS Code, but I like what I see so far. For developers who’d rather use a Mac or a Linux box, it gives them a nice, lightweight IDE as an alternative to Visual Studio that will let them get up and running fast.

One enormous caveat to all of this is, of course, that ASP.NET 5 is still a work in progress and is not stable.  I’m sure some of you poor readers will try to follow the steps in one of these blog posts and discover all sorts of fun new errors and breaking changes. In that case, by all means leave a comment and let other readers know what you see and if you were able to resolve it. If it’s a new issue that hasn’t been reported yet, reporting it is as an issue in the appropriate Github repo is a great idea as well.

Still, I’m impressed with what Microsoft has come up with so far and I’m excited to see where they go from here.

brian-palladino

Washington DC area software developer and consultant currently focused on .NET and Ruby tech stacks