Things have changed a fair bit since my last post back in May, and getting the latest and greatest ASP.NET vNext up and running with Mono is now reasonably straight forward,
so I thought I’d do a quick update on installing ASP.NET vNext on OSX and Linux.
Install Mono
Xamarin now maintains Mono packages for OSX and most common Linux distributions, and are committed to a regular release schedule, so getting Mono up and running is now a much simpler affair. Currently, there are supported packages for Mono. Installation is generally as simple as adding the Xamarin repository to your packages sources, and importing their GPG key) and then installing. I am going to cover OSX and Ubuntu 14.04 here, but easy instructions for most distros can be found http://www.mono-project.com/docs/getting-started/install/linux/.
sudo sh -c 'echo "deb http://download.mono-project.com/repo/debian wheezy main" > /etc/apt/sources.list.d/mono-xamarin.list'
Update your package cache
1
sudo apt-get update
Install the Mono development package
1
sudo apt-get install mono-devel
We will need to install some certificates on Linux, to avoid getting an exception when downloading packages with nuget package restore. This is not required on OSX.
Open a new shell and type mono --version. You should be running Mono version 3.8.0 or newer.
If not, you probably still have an old version of Mono on your path. This might be the case if you had previously installed Mono from source (as per my last blog post). You will want to make sure you remove your old installation. Running make clean from the Mono source code folder is probably the best way to do this. Additionally, remove any other installation that may have been installed via a third party package manager such as homebrew on OSX.
Install KVM and the K Runtime
If your on Linux, you may need to install curl.
1
sudo apt-get install curl
If you have any old (alpha) versions of kre installed, I recommend removing them from your system and starting fresh, and then starting a new shell. This will avoid any package sources being carried over in environment variables. I’m not going to paste the commands here, for fear of people nuking their LOLcats image collection accidentally and blaming me .. but effectively you just want to remove the ~/.kre folder from your home directory, and start a new shell.
Bootstrap your KVM installation by downloading and running the kvm install script from the aspnet/Home respository. We are using the dev branch here, which will download a kvm that is pointing at the feed for the latest beta packages. At the time of writing the master branch is still pointing at the alpha CTP.
1
curl https://raw.githubusercontent.com/aspnet/Home/dev/kvminstall.sh | sh && source ~/.kre/kvm/kvm.sh
Install the latest K Runtime
1
kvm upgrade
Verify the latest install
12
kvm list
k --version
You should now have one of the latest betas installed. The active version from kvm list should reflect the actual version of kre that you see when you run k --version.
Try out the Hello World vNext Demo from David Fowler’s github repository
David Fowler has created a Demo app for OSX and Linux, and put it up in his personal repository on GitHub. To check everything is working properly, we are going to clone it, and run it locally on our OSX or Linux installation.
First, install “git” if you don’t already have it. OSX users can get it from git-scm.com, or on Ubuntu
Open a browser and go to http://localhost:5000. If everything is in order, you will see “Hello World” staring back at you ….
Final Notes
The steps above are the bare minumum to get you up and running with vNext on Linux or OSX. The project is still (only barely) in beta, and is not ready the prime time yet. That being said, the ASP.NET vNext team at Microsoft have shown a huge commitment to cross platform support for the next iteration of ASP.NET. ASP.NET, running in production, on Linux, fully supported by Microsoft, will be a thing, and probably within the next twelve months. The time to get in there, get your hands dirty and kick the tires is now .. while the devs are ready and able to respond to your feedback.
If you have any problems or feedback, or just want to hang around and see what’s going on, jump into the ASP.NET vNext chat channel at https://jabbr.net/#/rooms/AspNetvNext, there is almost always someone around.