Home PC Games Linux Windows Database Network Programming Server Mobile  
  Home \ Server \ Build ASP.NET 5 development environment in Ubuntu     - To install and deploy Java applications under CentOS 6.5 (Linux)

- Btrfs file system creation and their characteristics in Linux (Linux)

- To modify the existing user ID and comments GPG key (Linux)

- JavaScript notes --Objects (Programming)

- iOS Sensor Development - add to APP phone password, fingerprint security authentication (Programming)

- How to modify the Emacs Major Mode Shortcuts (Linux)

- Java multi-threaded communications pipeline flow (Programming)

- 2 minutes to read large data framework Hadoop and Spark similarities and differences (Server)

- CentOS yum install LAMP (Server)

- Ubuntu 14.04 How to install Cinnamon 2.4.5 (Linux)

- How to configure HTTP Strict Transport Security (HSTS) (Linux)

- Linux, how to filter, split, and merge pcap file (Linux)

- stat Usage: Get permission to file the corresponding figures (Linux)

- php How to prevent being injected (Linux)

- Docker Basic and Advanced (Linux)

- The method of installing software under Ubuntu Linux (Linux)

- Java development environment to build under Ubuntu (Linux)

- Linux Network Programming --epoll model Detailed principles and examples (Programming)

- Using IntelliJ IDEA 13 integrated development environment to build Android (Linux)

- C ++ multithreading and critical resource instance (Programming)

  Build ASP.NET 5 development environment in Ubuntu
  Add Date : 2018-11-21      
  0x00 EDITORIAL nonsense

By the end of this time too busy, all kinds of things scrape together at this time, no time to learn what they are interested in, so no write blog Ye Hao. Recently there is a small work function to make Web applications, before there was a similar demand was made by the WCF WebAPI, front-end with ExtJS. The demand is not critical, as long as enough to solve the problem, it does not matter what specific technique, just in time for ASP.NET 5 release, so I plan to try. With powerful VS installation under Windows all the way to solve the problem, but ASP.NET5 cross-platform ah, decided to try to deploy development environment in Linux later fooled others into the pit also more convincing. Has been used before Windows, just out of curiosity had Linux installed, so not very familiar with Linux system, while doing the investigation, during various natural pit, toss more than a day, but also considered the final run up, and here the record about stepped pit and resolved and unresolved issues.

0x01 Windows and Ubuntu dual system

Before use Linux virtual machine installed, this time as we have to test it on a bit more serious, aside from the 100G hard disk space, referring to the online tutorial installed Ubuntu dual system. But this is not the focus of this article, and can easily be found to a large number of tutorials specifically do not say.

0x02 install ASP.NET 5 development environment

The following highlights began, referring to the main steps of Microsoft's official documentation:
First, to explain the first step on a pit, because a lot of commands need to use sudo, so I just sudo bash the terminal to switch to the root, the consequences of that behind some of the documents created folder is the root, which later led to the non under root appears with yo create a project when permission error, spent a lot of time to find the problem. So to less unnecessary trouble when operating below honestly suggest that you use sudo. The screenshot below you can see I still use the root, we do not do this.

1 installation DNVM

First, prepare development environment to build the tools used. In general it is possible that a system built, but just in case, or run it, soon anyway:

sudo apt-get install unzip curl
This command will install unzip and curl, two tools for extracting and downloading
What is DNVM, DNX

Then download DNVM. Official website document gives the following command:

curl -sSL https://raw.githubusercontent.com/aspnet/Home/dev/dnvminstall.sh | DNX_BRANCH = dev sh && source ~ / .dnx / dnvm / dnvm.sh
Here ready to use just curl, but comes with a general system.

Follow the prompts to download After Run

source ~ / .dnx / dnvm / dnvm.sh
Thus DNVM installation is complete. You can enter dnvm to see if the installation was successful.

2 Use DNVM installation DNX

First still we need to prepare the tools used to install

sudo apt-get install libunwind8 gettext libssl-dev libcurl4-openssl-dev zlib1g libicu-dev uuid-dev
Then install DNX for.NET Core with DNVM

dnvm upgrade -r coreclr

Then use DNVM install DNX for Mono

dnvm upgrade -r mono

The system does not prompt me to install Mono, you need to install. Referring to the official website link given in the document, followed by executing the following command:

apt-key adv --keyserver keyserver.ubuntu.com -recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
echo "deb http://download.mono-project.com/repo/debian wheezy main" | tee /etc/apt/sources.list.d/mono-xamarin.list
apt-get update
apt-get install Mono-Complete
3 Install libuv

Why do you want to install this thing, because developers need to run local Web service test ah, in Windows, we have IIS Express, but Linux does not. The official recommended the kestrel, kestrel and uses libuv the library, so we need to install the library. The library source code is compiled mounted, order more, anyway, I copied the complete line by line, substantially replicate the time to complete the next command of a command execution is completed, the experience is also quite good general :) process is: installation tools needed to compile, download and extract the source code, compile and install, load the shared library for the new library to take effect.

sudo apt-get install make automake libtool curl
curl -sSL https://github.com/libuv/libuv/archive/v1.4.2.tar.gz | sudo tar zxfv - -C / usr / local / src
cd /usr/local/src/libuv-1.4.2
sudo sh autogen.sh
sudo ./configure
sudo make
sudo make install
sudo rm -rf /usr/local/src/libuv-1.4.2 && cd ~ /
sudo ldconfig
So far we have completed the installation of the development environment ASP.NET 5. This is not just the end of it? At first I was thinking, but soon realized that something was wrong. When I want to build a test project found it impossible to start on Windows I have been using VS new solutions, select Web, and then select what template to use, but there is no template in the Linux ah, can not file one by one manually establish it. Then continue to look to find the original documents as well as Your First APS.NET 5 Application on XXX series, but there is no Linux, Mac reference should also be no problem.

0x03 Installation and Configuration Development Tools

Development Tools naturally Visula Studio Code, the official website to download
Download, unzip, run directly Code can be used.
Template established when the project is generated by the yeoman. Installation yeoman need npm, so we install npm

sudo apt-get install npm
npm and nodejs are interdependent, install either one will be automatically installed on another. Can be used after installation

npm install -g yo bower grunt-cli gulp
Install yeoman, bower, grunt-cli, gulp. But the question is, yeoman need nodejs version 0.12 or more, but with apt-get install version 0.10 only, all kinds of torment upgrade or not, including the use of the legendary n weird name but is said to be dedicated to upgrading the tools nodejs not. In the investigation to go online to find the article here:
There are such a command:

curl --silent --location https://deb.nodesource.com/setup_0.12 | sudo bash -
I looked under the open https://deb.nodesource.com rub original here
After running the above piece of command also prompts the download is complete

Execute this command

sudo apt-get install nodejs
You can install the latest version of the nodejs. After the installation has become the latest 0.12.9

Such re-use npm install yeoman and a series of tools would be no problem, the command is as follows:

npm install -g yo bower grunt-cli gulp
yeoman is installed, but can not generate a template for the yeoman of ASP.NET, this is we need to be installed. To install ASP.NET template, use the following command:

npm install -g generator-aspnet
After the installation is complete, I can use the project to establish a yeoman. We want to put into the project directory, run

yo aspnet

Then we see the template selection interface, we choose WebApplication, and then we'll be prompted to enter the name of the application, we enter first, then yeoman will help us create this directory first, and then build the project files are good.

Use VSCode Open first catalog will be prompted to missing dependencies

Run the following command in the directory project

dnu restore
So that you can rely on to solve the problem. If this is the first time to restore a lot of things you might take a moment to download.
After completion of the directory structure is probably the case, consistent with the use of VS created. Code also have properties and methods of reference tips.

Project.json file in the project, we can see the Friends of web commands this command in dependency we can find the dependence. This command will be able to use the web service to open kestrel.

Performed under the project directory

dnx web

You can open web services, so in your browser type localhost: 5000 we will be able to see the page.

About the HomeController try to change it the message. Web service must be restarted to take effect, this is better to use VS ah, VS can then save the changed F5 to refresh the effect can be seen, with the use of the same script development.

Rather strange to dnx switch to coreclr input dnx after no reflection, online search did not see where the problem lies. There is to know, please enlighten me.

Thanks @zwmyxzs given solution before @ zwmyxzs written articles on the subject: ubuntu15 coreclr.

Because coreclr adapted Ubuntu14, I used Ubuntu15, unbuntu14 is used libicu52, and unbuntu15 is libicu55, so long as you can put on a libicu52.

wget http://security.ubuntu.com/ubuntu/pool/main/i/icu/libicu52_52.1-8ubuntu0.2_amd64.deb
dpkg -i libicu52_52.1-8ubuntu0.2_amd64.deb
@zwmyxzs Success according to the method.

Services normally run with coreclr

0x04 written in the last crap

Because of Linux is not very familiar with the whole process encountered many problems large and small, I picked up a few more annoying to write next. They will be exposed to some mentally retarded IQ I did not mention this enough effort. However, after the completion of we have more understanding of dnvm, dnx and many other concepts. But let me do ASP.NET 5 develop, then I would choose windows, ah, after all, there's a strong biological VS. Finally, talk about Ubuntu's use, until the use of Windows, a sudden change to the Ubuntu feeling did not imagine so difficult, a graphical interface can be considered mature, a lot of tools to use Web applications can be basically resolved. JetBrains development, then the series can be used, and now more than a VSCode, they do not write WPF feeling problem is not great. Web search encountered a problem also can be solved basically, slowly should be able to skillfully it.
- Hadoop scheduling availability of workflow platform - Oozie (Server)
- Linux protobuf-c (Linux)
- Linux System Getting Started Learning: Debian download, installation and graphical interface (Linux)
- Getting the Linux shell variable test (Programming)
- [SHELL] MySQL primary recovery solution from + Keepalived online (Server)
- With screenfetch linux logo and basic hardware information display with cool Linux logo (Linux)
- ELKstack log analysis platform (Server)
- ntop monitoring software configuration and installation (Linux)
- How to Debian Linux the default Python version switch to alternative version (Linux)
- Oracle 11g can not export a variety of empty table solution (Database)
- The difference between Objective-C language nil, Nil, NULL, NSNull (Programming)
- How to configure MongoDB replica set (Database)
- C ++ pointer of the (error-prone model) (Programming)
- How to turn Java String into Date (Programming)
- Nginx installation configuration Zabbix (Server)
- C ++ pointer two third memory model (Programming)
- Ubuntu 14.04 Install WordPress on Nginx (Server)
- iOS in Singleton (Programming)
- Depth understanding of the use of Spring Redis (Programming)
- Intruder tools Knark Analysis and Prevention Linux environment (Linux)
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.