Recently .net core is in full swing,There are also many documents on environmental construction in China.But many are already outdated,Even if you follow this process, you can't avoid some places.So below I will teach you to build an environment from beginning to end.And successfully run the demo on the official website.

I. System environment

This time I was lazy to do a virtual machine,So register a trial account with a cloud provider as the host for this time.

System:ubuntu server 14.04.2 lts 64bit



2. The text

1. First we install the mono environment

1.1 We first enter in the console:

The contents are as follows:

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3fa7e0328081bff6a14da29aa6a19b38d3d831ef

1.2 Then continue to enter:

The contents are as follows:

echo "deb http://download.mono-project.com/repo/debian wheezy main" | sudo tee /etc/apt/sources.list.d/mono-xamarin.list

1.3 continue the installation:

The contents are as follows:

sudo apt-get update

1.4 The last step is to officially download mono and install it.It will take longer

The contents are as follows:

sudo apt-get install mono-complete

1.5 After the above steps are completed, confirm whether the installation was successful.And the version is correct,We need to enter the following command to view

Need to pay attention here,After the reader is installed,Look at the version number,Your version number should be the same or higher than me,If the installation below is lower than me, there will be problems,So make sure you have the correct version of mono installed here.

2. Install .net version control (dnvm)

The contents are as follows:

curl -ssl https://raw.githubusercontent.com/aspnet/home/dev/dnvminstall.sh | dnx_branch=dev sh&&source ~/.dnx/dnvm/dnvm.sh

3. install dnx

dnx is the net operating environment,Currently, there are two methods, mono and .net core.I will install two,And use our two environments to run our programs separately.

3.1 must install dnx tools

The contents are as follows:

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

3.2 Install dnx for .net core

You can see that the version we are currently downloading is 1.0.0-rc1-update1.

The contents are as follows:

dnvm upgrade -r coreclr

3.3 Install dnx for mono

Before, we just installed mono, but did not install the mono sdk corresponding to dnx.

The contents are as follows:

dnvm upgrade -r mono

3.4 Verify the dnx we installed

Below we use the following instructions to view some versions of dnx currently installed

You can see that we have installed the corresponding mono implementation and coreclr implementation, so we must understand the relationship between dnvm, dnx, mono, and coreclr.

3.5 install libuv

This is a library that must be installed to run the web.The relevant commands are as follows,I no longer take screenshots one by one.

sudo apt-get install make automake libtool curlcurl -ssl https://github.com/libuv/libuv/archive/v1.8.0.tar.gz | sudo tar zxfv--c/usr/local/srccd/usr/local/src/libuv-1.8.0sudo sh autogen.shsudo ./configuresudo makesudo make installsudo rm -rf /usr/local/src/libuv-1.8.0&&cd ~/sudo ldconfig

4. Run the official example

4.1 In order to download examples from the official website,So we need to install git first

After the installation is complete, we will download the instance of the official website to the local

Then we switch to the corresponding directory,On the author's machine, you can go to the instance of the corresponding version by following the instructions

After switching to this directory, we can see which instances there are through ls:

The official provides a console by default,asp.net 5 and asp.net mvc 6 three examples.

4.2 run console example with mono and coreclr

First we change to this directory:

Then restore the referenced library:

The specific installation time depends on the reader's network environment.If the following interface is displayed, the installation is successful:

Then we can run using dnx:

The output is correct.

Let's switch dnx to coreclr to run the program:

Successfully switched,Below we run directly:

The content was also successfully output.

4.3 run mvc with mono and coreclr

First we still need to switch to the corresponding directory,Remember that our dnx is coreclr:

Restore referenced libraries:

This may take a long time,Because there are more reference libraries.Continue to be a successful installation interface:

This time it's not dnx run. If i want to try it, you can try it.The last mistake I believe readers can understand,Here we need to run through other instructions (dnx web):

We successfully saw the final effect,Now we switch to mono to run it once.

Finally running is still dnx web


  • Previous Installation and use of VNC remote desktop program in Centos
  • Next MySQL Slave triggers oom-killer solution