NET core project deployed to Linux (CENTOS7)
Read Catalogue
- 1. Opening instructions
- 2.Jexus Simple Description
- 3.Visual Studio 2015 is published locally and tested
- 4. Configure Jexus and deploy the. NET Core Description
- 5. Summary of other knowledge points
Back to Top
1. Opening InstructionsA The previous blog briefly explains a summary of using. NET core development, with the address: (http://www.cnblogs.com/hanyinglong/p/6442148.html), So this blog we will be on the basis of the previous blog to deploy its code, deploy it under the Linux Centos7. b This week in Tuesday, March 7, Microsoft released the latest development tools (Visual Studio 2017), briefly looking at it, bringing a better development experience and driving a big step forward for cross-platform development. NET cross-platform will be more mature. C below we deploy a. NET core project to Linux using Jexus, so if we are going to deploy a. NET core project to a Linux server, we need to prepare a few things (Linux server, Jexus, server to install the database, other ( Redis, etc.). D Let's start with a rough demonstration of how to deploy a. NET core project to a Linux server, test address: http://www.chuxinm.com/back to the top
2.Jexus Simple DescriptionA website address: http://www.jexus.org/b about the installation of Jexus, I have also written an article, the address is (http://www.cnblogs.com/hanyinglong/p/5456757.html), I wrote this article is based on mono installation, what meaning, that is, to install Jexus, it is necessary to install mono, but now Jexus provides a non-mono installation of the program, very convenient, we can experience a bit, if the installation encountered any problems, You can find the solution on the website or elsewhere. C Jexus Quick Install ((a pair of commands will be installed successfully jexus))
1. Installation: sudo curl Jexus.org/release/install | Sh
2. Update: sudo curl Jexus.org/release/upgrade | Sh
Description: The installation method using this command will be Jexus installed to the/usr/jexus location.
Back to Top
3.Visual Studio is published locally and testedA after the development of the local system, first we need to test the local release, if not an error, upload to Server B local project structure as shown: we deploy to Linux based on this project release. B.1 First open cmd, switch to the project under the drive letter, the project to switch to the SRC root directory (.. /src/project name), Run command dotnet publish, run without error The local publishing succeeds, and after successful execution shows the path to where the project was published. B.2 as shown, we jump to the published path (under the project root directory under/bin/debug/netcoreapp1.0/publish/), Run command: dotnet ProgrammersLiveShow.dll, according to the prompt to access the address, Can be tested locally,: C as shown, we follow the Access path (HTTP://LOCALHOST:5000/), if the access is successful, then prove that there is no problem of local publishing, as shown: if there is a function to log in, then the system login test, verify that there are no issues in the publishing. Back to Top
4. Configure Jexus and deploy the. NET Core DescriptionA in the above steps we briefly explained some of the system's functions and local publishing, now let's briefly explain how to configure Jexus, because previously installed Jexus, we directly found the installation path under Linux: B as shown, we see the Jexus installation directory, Jexus configuration is also very simple, first we open the Site configuration folder siteconf, and then open the default file, see as shown in the configuration, the configuration of the simple description is as follows: C as shown, we deploy its project to the system (/var/www/default /publish) under D first we upload the locally published file to the server and upload the local publish folder directly to/var/www/default, as shown in E because I am now publishing the system itself, I need to close the thread that is now running in the background (perform the following two command, the system that is already online will not be accessible), if it is the first release, you do not need this step, the command is as follows: (1):p S-ef | grep ProgrammersLiveShow.dll (2): Kill-9 PID F upload is complete, the system jumps to publish, executes Dotnet ProgrammersLiveShow.dll, runs successfully and can be accessed, Then the release is successful, but there is a drawback, is that after the release of Xshell can not be closed, if the default program will be launched, so we can use the following command directly set it to run in the background command as follows: Nohup dotnet Programmersliveshow . dll & G After all of the above steps are complete, use the server domain name plus the 80 port number to access it, there may be a configuration 80 port number external access permissions, below will briefly explain back to the top
5. Summary of other knowledge pointsA in the frequent system updates, do a good job of backup is a very important thing, every time on the line to replace the system before you have to perform the following command to backup: Tar zcvf/var/www/default/remark/(date) publish.tar.gz/var/www/de fault/publish/b Centos7 Open Ports, CENTOS7 and 7 previously open port implementations are inconsistent. B.1 CentOS upgrade to 7, found unable to use the Iptables control Linuxs port, Google found that CentOS 7 use FIREWALLD instead of the original iptables. Below is a note on how to open a port with FIREWALLD Linux Port B.2: Firewall-cmd--zone=public--add-port=80/tcp--permanent--zone #作用域--add- Port=80/tcp #添加端口, in the format: Port/Communication protocol--permanent #永久生效, without this parameter reboot b.3 restart firewall firewall-cmd--reload b.4 turn on firewall: Syst Emctl Start Firewalld
NET Core Project Deployment