Set up the ASP. NET Core environment and install Jexus in the CentOS Environment
After. NET Core2.0 came out, many companies began to use it for practical production. The reasons for this are as follows.
- Cross-platform deployment in Linux and Docker containers
- Superior performance, about 20 times of Node during testing
- The Community is getting increasingly active and has many excellent open-source projects.
Add the dotnet product Feed to the CentOS installation. NET Core development environment in two steps:
sudo rpm --import https://packages.microsoft.com/keys/microsoft.ascsudo sh -c 'echo -e "[packages-microsoft-com-prod]name=packages-microsoft-com-prod baseurl= https://packages.microsoft.com/yumrepos/microsoft-rhel7.3-prodenabled=1gpgcheck=1gpgkey=https://packages.microsoft.com/keys/microsoft.asc" > /etc/yum.repos.d/dotnetdev.repo'
Install. Net Core
- Update Software Repository
Download. NET SDK2.0
sudo yum updatesudo yum -y install libunwind libicusudo yum install dotnet-sdk-2.0.3
We have installed the. NET Core environment. Now we can start to run a console application and output the omnipotent "Hello World"
dotnet new console -o helloworldAppcd helloworldAppdotnet run
Is it a success? Have a sense of accomplishment. Continue on.
Create an Asp. NET Core Web application.
cd /homedotnet new razor -o webappcd webappdotnet run
The following errors may occur. Don't worry ~ "Unable to bind to http: // localhost: 5000 on the IPv6 loopback interface: 'error-99 EADDRNOTAVAIL address not available"
Continue. After jexus is installed
Install the independent edition Jexus
curl https://jexus.org/release/x64/install.sh|sh
Configure Jexus and release our site to Jexus
Create a directory for our release site
Mkdir-p/var/www/websitmcm/home/webapp/-- the website dotnet publish-o/var/www/website we created earlier -- published to the website directory
Configure jexus website
- Switch to the Jexus configuration file directory
- Copy the default configuration file aspnetcore.
'''
Cd/usr/jexus/siteconf
Cp default aspnetcore
Vi aspnetcore
Port = 80
Root = // var/www/website
Hosts = * # OR your.com, * .your.com
AppHost = {CmdLine = dotnet/var/www/aspnetcore/webapp. dll; AppRoot =/var/www/website/; Port = 0}
Note that port = 0 is not the site port, but the Jexus ing port. Enter 0 here.-delete the Jexus configuration file default-start Jexus.
Rm-rf/usr/jexus/siteconf/default
Sh/usr/jexus/jws start
'''
Last site visited
After starting/restarting, enter the IP address/Domain Name: port number in the browser to access the Asp. Net Core application ,: