In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article introduces the knowledge of "the process of developing and deploying ASP.NET 5 under Linux". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
1. Overview
First give an overview of the practice environment and the use of tools-"
Operating system: ubuntu-15.04 (32-bit desktop version) [strongly recommended that you play 64-bit version]
Development tool: vscode 0.9.1 (32-bit version under Linux)
Development aids: generator-aspnet (create ASP.NET5 project or file templates; rely on yo tools)
Development aids: dnvm (PowerShell script;. Net program running environment management tool; with nuget)
Development aids: npm (a necessary tool for front-end development)
Dependent environment: dnx-mono 1.0.0-beta8 (mono version of the .NET runtime with dnu,dnx tools)
Dependency environment: mono jit (compiler; if using dnx-coreclr-linux-x64, this compiler may not be required)
Dependent environment: libuv (running platform support library)
Deployment method: self-hosting (selfhost;dnx commands execution)
Deployment method: container running hosting (using docker virtualization technology)
(below $: under the terminal command line; #: under the docker container / bin/bash)
2.vscode
See https://code.visualstudio.com for downloads and documentation
Tools downloaded by the browser or under the terminal:
$: wget x.zip download address
Decompress:
$: unzip-n x.zip-d / specified directory
The Code file under the directory is the execution file, which can be run directly.
If you call out vscode to run in any path of the terminal, it should be set to a global command, that is, to create a link.
$: sudo ln-s / absolute path / Code / usr/local/bin/code
$: code. (open vscode in the current path directory)
3.dnvm
For documentation, see https://docs.asp.net.
You may need to install the decompression and download tools:
$: sudo apt-get install unzip curl
Download the sh installation and setup script:
$: curl-sSL https://raw.githubusercontent.com/aspnet/Home/dev/dnvminstall.sh | DNX_BRANCH=dev sh & & source ~ / .dnx/dnvm/dnvm.sh
View help:
$: dnvm-h
View the clr list:
$: dnvm list
4.dnx-mono
The environment required to install dnx:
$: sudo apt-get install libunwind8 gettext libssl-dev libcurl3-dev zlib1g libicu-dev
If you want to install dnx-coreclr-linux-x64:
$: dnvm upgrade-r coreclr
I can only install dnx-mono here:
$: dnvm upgrade-r mono
5.mono jit
For documentation, see http://www.mono-project.com.
Add the mono project signing key to the system's package repository:
$: 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
Update the software package repository table for the system:
$: sudo apt-get update
Install the full version of mono jit:
$: sudo apt-get install mono-complete
View the version:
$: mono-V (uppercase)
6.libuv
For documentation, see http://docs.libuv.org.
Download the latest version of http://dist.libuv.org/dist/v1.7.5
Environment required for installation:
$: sudo apt-get install automake libtool
Enter the extracted directory and execute the command script:
$: sh autogen.sh
Check or set up the compilation environment:
$:. / configure
Compile:
$: make
Install the compiled program:
$: sudo make install
Configuration enabled:
$: ldconfig
7.npm
See https://nodejs.org
See https://www.npmjs.com
Npm depends on nodejs, just install nodejs.
If you use the officially compiled version, you need to set it to a global command.
Source code compilation and installation is used here.
Download source code https://nodejs.org/dist/v4.1.2/node-v4.1.2.tar.gz
Enter the decompressed directory, check and set up the compilation environment:
$:. / configure
Compile:
$: make
Install the compiled program:
$: sudo make install
8.generator-aspnet
View document https://github.com/OmniSharp/generator-aspnet
Install yo:
$: sudo npm install-g yo
Use yo:
$: yo
Install generator-aspnet:
$: sudo npm install-g generator-aspnet
Use generator-aspnet:
$: yo aspnet
9.demo
When the above is ready, you can get high.
You can use generator-aspnet to quickly create an ASP.NET5 project or file
Use vscode tools to write code
Flexible use of dnvm (dnu,dnx) to take care of the running environment and packages.
For front-end development, you can combine npm tools.
Here, download demo from the official.
Install the git tool first:
$: sudo apt-get install git
Clone download:
$: git clone https://github.com/aspnet/Home.git aspnet-home
Go to the root directory of the project (the path where project.json is located) and download the project dependent installation package:
$: dnu restore (this step is to ensure a complete download! )
View the commands configuration in project.json:
$: code. (open the project to see)
Execute the program:
$: dnx commands
(if commands configures "web": "...", execute dnx web)
10.docker
See https://www.docker.com
If the system is 64-bit, see the official installation using sh scripts.
No matter whether the system is 32-bit or 64-bit, it can be installed using source code compilation (I haven't experienced it yet).
Here we have to use what is already included in the ubuntu software repository.
Install docker:
$: sudo apt-get install docker.io
View the version:
$: docker-v
To run something else, you need to start the docker service:
$: service docker start
Note: to learn docker, you need to understand the three core concepts of mirror, container and warehouse.
View the image:
$: sudo docker images
Find the image:
$: sudo docker search ubuntu-x86
Official images are almost 64-bit, I have to find x86 32-bit version, more sad!
Found in this way, may not be appropriate, download ($: sudo docker pull ubuntu) is also slow!
You can download the template at https://download.openvz.org/template/precreated.
Import template:
$: cat x.tar.gz | sudo docker import-ubuntu:latest
Then run the image to the container and enter the container:
$: sudo docker run-t-I ubuntu:latest / bin/bash
After entering the container, you can install dnvm,dnx-mono,mono jit,libuv according to the previous steps.
After installation, exit the container:
#: exit
Then be sure to submit it and save it as a new image:
$: sudo docker commit-m 'submit message'-a 'author information' the new image name of the container id to be submitted
With this new image, you can run it to the container.
We then save the image:
$: sudo docker save-o xx.tar to save the name of that image
If you need to load this saved xx.tar:
$: sudo docker load-input xx.tar
Find an ASP.NET5 Web project and add a Dockerfile file to its root directory in the code format:
# this is made by using the official image # FROM microsoft/aspnet:1.0.0-beta8#. The loaded image FROM ubuntu/aspnet5# copies all the files in the current directory to COPY in the root directory / app directory of the image (container). / app/# container runs in the working directory, that is, the directory after / bin/bash runs is app/# WORKDIR / app# executes dnu restoreRUN ["dnu", "restore"] # Open port EXPOSE 5004#dnx web executes ENTRYPOINT ["dnx", "- p", "project.json", "web"]
Then create the image according to the Dockerfile configuration and run the container:
$: sudo docker build-t myweb.
(myapp: generate a new mirror name;.: Dockerfile file in the current directory)
How do I browse the web program running in the container on the host? You can use a mapped port:
$: docker run-t-d-p 5000 purl 5004 myweb
Here, the host browser can open http://localhost:5000.
This is the content of "the process of developing and deploying ASP.NET 5 under Linux". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.