Deploy Jenkins to a remote (Linux Server) and jenkinslinux

Source: Internet
Author: User
Tags ssh server

Deploy Jenkins to a remote (Linux Server) and jenkinslinux

Next, the last time we said that we only implemented Local Automatic deployment. This is only applicable when the development environment and deployment environment are on the same machine. However, we usually need to deploy the project to a remote Linux server, so the main content of this section is:

1. Deploy a Web project in the development environment to a remote Linux server;

2. Automatic Backup;

Prepare the environment:

Local development, installation of virtual machines, installation of Linux servers on virtual machines

Procedure:

1. Install the plug-in. log on to the Jenkins background and choose System Management> Manage plug-in. In the optional plug-in, select Publish Over SSH to install the plug-in;

2. After installation, configure this option and find it in system management, for example:

  

Here, I will only talk about the main configuration items, such as SSH Server Name and Server Name. Just give them a Name. Hostname, Server IP address, Username, and remote Server account. Here I use root; remote Directory, access path, "/" root path.

For other options, see http://blog.csdn.net/wangmuming/article/details/22925895.

3. You do not need to create a new project this time. Make a copy of the project created above and modify it on this basis,

  

4. You do not need to change the above parameters. You only need to modify "post-build operations" and delete the method of deploying the war package (Deploy war/ear to a container, after adding the plug-in just now (Send build artifacts over SSH), the configuration is shown in the figure below:

  

Note: Remote directory, which is best configured as an absolute path, mainly to temporarily place the project, which can be seen in step 1;

5. Add deploy. sh script, the bin directory of the newly downloaded tomcat does not have this file, just create a new one, the content is as follows, adjust according to your actual situation, are some common shell commands:

#!/bin/shexport JAVA_HOME=/usr/java/jdk1.7.0_75kill -9 $(ps -aef | grep tomcat/conf | grep -v grep | awk '{print $2}')cd /app/programs/tomcat_test1/webappsmv ROOT.war ROOT_`date +%Y%m%d%H%M%S`.war.bak#rm -rf ROOTmv  /app/programs/temp/mvcDemo3*-SNAPSHOT.war ROOT.warcd /app/programs/tomcat_test1/bin./startup.sh

6. After the above configuration, access the test and run it successfully.

  

Summary: Up to now, all configurations for automatic deployment to local and remote have been completed. These two documents mainly focus on Operation implementation and memo. Some details are not described. If you need them, you can study them in depth and discuss them one by one...

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.