« Back to home

Installing ASP .NET Core 1.0 on Ubuntu 14.04

Daj się poznać

After my last impromptu post about Project Rider, I’m finally writing about the setup of my Linux environment for ASP .NET Core 1.0. I mentioned that I am going to play with ASP .NET Core 1.0 on Ubuntu 14.04 but for sure I’ll also play with it on Windows. However, in this post I will describe how I installed ASP .NET Core 1.0 on Ubuntu 14.04. I am not writing about how to install Ubuntu 14.04 itself, as it’s not the place and time to write about this.

My starting point for this process was on the official asp.net page.

I opened terminal (CTRL+SHIFT+T) and executed all the following commands:

sudo apt-get install unzip curl  
curl -sSL https://raw.githubusercontent.com/aspnet/Home/dev/dnvminstall.sh | DNX_BRANCH=dev sh && source ~/.dnx/dnvm/dnvm.sh

Next I installed all the prerequisites for the DNX by issuing this line in terminal:

sudo apt-get install libunwind8 gettext libssl-dev libcurl4-openssl-dev zlib1g libicu-dev uuid-dev

Then I installed DNX for .NET Core. issuing this command:

dnvm upgrade -r coreclr

All the commands executed smoothly and without errors.

I also installed Mono. Firstly, I added the package repository to my system by executing this in the terminal:

 sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --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

Then I installed three mono packages with the command:

sudo apt-get install mono-devel mono-complete ca-certificates-mono

After this I used the command:

dnvm upgrade -r mono

to install DNX for mono.

There is also one piece of the puzzle needed. To be able to run the application in server Kestrel I had to install libuv. I did this by issuing the following commands in shell:

sudo apt-get install make automake libtool curl
curl -sSL https://github.com/libuv/libuv/archive/v1.8.0.tar.gz | sudo tar zxfv - -C /usr/local/src
cd /usr/local/src/libuv-1.8.0
sudo sh autogen.sh
sudo ./configure
sudo make
sudo make install
sudo rm -rf /usr/local/src/libuv-1.8.0 && cd ~/
sudo ldconfig

After this I also added these two lines:

source dnvm.sh
export MONO_MANAGED_WATCHER=disabled

to my ~/.bash_profile file to ensure that I can always run the dnvm and dnu commands and to work around a known bug in Mono. You can find more information here.

Having set up DNVM, and getting DNX done, I could now install the Visual Studio Code. I’ve always wanted to try Visual Studio Code. I haven’t had the occasion to do this until now. However, having access to the EAP version of Project Rider, I am only waiting for better support of ASP .NET Core application in it and I’ll give up Visual Studio Code.

Installing Visual Studio Code was a piece of cake. I only downloaded the zip file from this page and then I unzipped it in a location that was convenient for me, and inside the folder where I unzipped the VS Code I had an executable file named Code. Double clicking on it launches the VS Code.

To create the first ASP .NET Core 1.0 application I also needed Node.js and npm. Yes, it’s true that nothing works these days without Node.js. Node.js and npm are required to install and run Yeoman, Gulp and other massive amounts of Node.js packages.

To install Node.js I use a Node Version Manager. I did this by issuing the following command:

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.30.2/install.sh | bash

After installing nvm, I installed the recent version of Node.js which is 5.5.0, the issuing command was:

nvm install v5.5.0

Then I set it to the currently used version with the command:

nvm use 5.5.0

and finally I aliased it as the default version so that this version of Node could be used in any new shell. I did this using the command:

nvm alias default 5.5.0

After this, I installed Yoeman then aspnet generator for Yoeman and finally Gulp and Bower. This line executed in the terminal did the job:

 npm install -g yo generator-aspnet gulp bower

All these steps with Node.js are required in order to have a nice generator which helps you with the setup of ASP .NET projects (Nancy project also) and with other things, for example, adding a new controller or view. However, I’ll write about this in the next post.

Related posts:


comments powered by Disqus