How do I install .netcore on CentOs machine?


Here is the script I use to install CoreCLR on CentOS 7. I have been testing this against two installs on VirtualBox:

My test VMs

CentOS 7 with GNOME Desktop and networking turned on

CentOS 7 with networking turned on (almost a minimal install, all you get is a terminal, but your network card works so you can download stuff)

I roll back to the clean install point to repeat the tests.

Yum packages

Note the original poster was stuck trying to figure out the yum versions of the CoreCLR dependencies. I believe I have done this. At this point, I've had no problems, but CoreCLR is experimental and we're on beta 7 for this answer.

Note that it is harmless to run all of these steps on the CentOS install with GNOME desktop installed, but I do note in "comments" what you don't need on each.

This script never installs Mono and should be good for playing around with CoreClr. That said I have put both on a machine and it's working, but it's out of scope of the answer.

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

## install unzip before installing any dnx versions
## (appears to already be installed on CentOS with GNOME)
sudo yum install -y unzip

## Install CoreCLR latest
dnvm install latest -r coreclr

## install libuv
## dnu restore won't operate without this
## (curl already latest version, but ASP.NET on Linux docs currently have this... harmless)
sudo yum -y install automake libtool curl
curl -sSL | sudo tar zxfv - -C /usr/local/src
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

## libunwind.x86_64 is in the epel-release repository
## (Not necessary on GNOME, minimal install does not have this installed)
sudo yum -y install epel-release

## Install these CoreCLR dependencies before dnu restore
sudo yum -y install libunwind gettext libcurl-devel openssl-devel zlib

Libuv can't be found

So after you do all this, you can use the yeoman generators to get a project. I generally test with the ConsoleApplication and the WebApplicationBasic. However, when you try the WebApplicationBasic with

dnx kestrel

It blows up because kestrel wants to use libuv and can't load it. One way to solve this problem is to set an environment variable: LD_LIBRARY_PATH=/usr/local/lib.

But I was not satisfied with this. Thanks to paule96 on GitHub, I learned you could create symbolic links so libuv can be found when kestrel runs:

ln -s /usr/lib64/ /usr/lib64/libdl
ln -s /usr/local/lib/ /usr/lib64/

If you want to know how to install node, yeoman, and the aspnet-generators, use this:

## rpm for node 0.12 on centos from nodesource
sudo rpm -ivh

## yeoman and aspnet generators
sudo npm install -g yo
sudo npm install -g generator-aspnet

Respectfully, I would ask the original poster to change the question to mention this is for ASP.NET beta 7. There are still breaking changes to be made and I will likely have to update my scripts. But if the question clearly states this, we won't have to worry about the answer becoming stale.

For example: How to setup ASP.NET 5 Beta 7 on CoreCLR for CentOS? or How to setup Beta 7 .NET CoreCLR on CentOS?

I would also ask to consider adding the tag, unless you really don't think your question applies to that.