What's new on ASP.NET Core RC2? dotnet cli on Azure CentOS 7.1

In this blog post, I target another platform for .NET CLI. This platform is CentOS 7.1 ! The CentOS Linux distribution is a stable, predictable, manageable and reproducible platform derived from the sources of Red Hat Enterprise Linux (RHEL). Since March 2004, CentOS Linux has been a community-supported distribution derived from sources freely provided to the public by Red Hat. As such, CentOS Linux aims to be functionally compatible with RHEL.

As I mentioned in my previous blog post, open dot.net then choose Linux platform where you will find 4 Linux different distributions.

I'm Windows developer so I choose Microsoft Azure VM service to provide me with CentOS VM.

Azure VM CentOS 7.1 Creation

Let's go to the Azure Marketplace and type CentOS. Choose CentOS-based 7.1 published by OpenLogic!

The creation of your VM is made of 4 tiny steps. First, you have to name your VM and enter both a username and a password. Other compulsory fields should be completed too.

According to your needs, choose the best size of your virtual virtual machine. You have a long list of choice just click on View all.

Step 3 is about settings and configuring optional features. I highlighted the domain name which I masked it here for security. It is usefull for connection once your VM is created.

Step 4 is a summary of the other previous steps and when we click on the OK button Microsoft Azure starts the process of creation of the chosen VM.

I advice you here to have a small coffee break until your CentOS VM is totally cooked.

dotnet cli install

In order to install .NET Core on CentOS, first we need to get the install script using the command below.
curl -sSL https://raw.githubusercontent.com/dotnet/cli/rel/1.0.0-preview1/scripts/obtain/dotnet-install.sh | bash /dev/stdin --version 1.0.0-preview1-002702 --install-dir ~/dotnet

Note that the script will inform you of any prerequisites that you are missing. I suggest installing them using yum.

  • sudo yum install libunwind

  • sudo yum install libicu

curl -sSL https://raw.githubusercontent.com/dotnet/cli/rel/1.0.0-preview1/scripts/obtain/dotnet-install.sh | bash /dev/stdin --version 1.0.0-preview1-002702 --install-dir ~/dotnet

Once the previous script is successfully executed, we should create a symbolic link between ~/dotnet/donet and /user/local/bin using the following command:

  • sudo ln -s ~/dotnet/dotnet /usr/local/bin

Hello World!

Here I'm doing dotnet --info to wrap up the asp.net core and runtime environment versions.

dotnet restore will grab the dependencies and the dependencies of the dependencies from our project.json file created by the command dotnet new.

Note here the creation of a new file project.lock.json.

We notice here that dotnet run is the same as Windows platform!

I find some difficulties to install an X Window to play with Visual Studio Code.

What was your experience with CentOS and dotnet cli? Let's hear it in the comments!

Linux aspnetcore azure CentOS Getting Started

Hi, I'm Maher, Development Technologies MVP. I'm blogging about ASP.NET Core and Microsoft Azure.