Deployment Projects under Linux

Source: Internet
Author: User
Tags svn tomcat server apache tomcat

Svn+tomcat9.0+maven3.3+jenkins implementation of Web project automatic construction and remote publishing under Linux CentOS7 (2015-12-20 19:17:03) reproduced
Tags: svn tomcat maven Jenkins Auto build remote Release Category: Operating system servers

CentOS7 under Svn+tomcat9.0+maven3.3+jenkins Implement Web Project Auto-build and remote publishing

by : Award -giving Guest QQ : 1033553122

Directory

First, Practical Environment

Second, installation SVN ( if not )

Third, installation Java

Four, installation Apache Tomcat

Five, installation maven

Six, installation Jenkins

Seven, Jenkins Basic Settings

1) System Management-System Setup

2) System Management-security settings

3) System Management-plug-in management

Eight, Auto-build tasks and automatic deployment

First, Practical Environment

CentOS 7 Operating System (CENTOS-7-X86_64-DVD-1503-01.ISO)

: http://ftp.riken.jp/Linux/centos/7/isos/x86_64/

Http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

Apache Tomcat (apache-tomcat-9.0.0.m1.tar.gz)

: http://tomcat.apache.org/download-90.cgi

Maven (apache-maven-3.3.9-bin.tar.gz)

: http://maven.apache.org/download.cgi

Jenkins (Jenkins.war)

: Https://wiki.jenkins-ci.org/display/JENKINS/Meet+Jenkins

Deploy to Container Plugin (Deploy-1.0.phi)

: https://updates.jenkins-ci.org/download/plugins/deploy/

Collection of above packages: Http://pan.baidu.com/s/1c1xnUfu

Second, installation SVN ( if not )

Reference article: Configuring SVN installation and basic configuration under CentOS7

Third, installation Java

[Email protected] tmp]# mkdir-p/usr/local/java

[Email protected] tmp]# MV Jdk-8u65-linux-x64.tar.gz/usr/local/java

[[email protected] tmp] #cd/usr/local/java/

[[email protected] Java] #tar-xvzf jdk-8u65-linux-x64.tar.gz

......

[Email protected] java]# RM-RF jdk-8u65-linux-x64.tar.gz

Environment variable Configuration

[Email protected] java]# Vim/etc/profile

Add the following content:

#added by Shouke

Export java_home=/usr/local/java/jdk1.8.0_65

Export JRE_HOME=/USR/LOCAL/JAVA/JDK1.8.0_65/JRE

Classpath=.: $JAVA _home/lib/dr.jar: $JAVA _home/lib/tools.jar:

Export path= $PATH: $JAVA _home/bin: $JRE _home/bin



[Email protected] bin]# Source/etc/profile

To see if the installation was successful

[Email protected] java]# java-version

Java Version "1.8.0_65"

SE Runtime Environment (build 1.8.0_65-b17)

Java HotSpot (TM) 64-bit Server VM (build 25.65-b01, Mixed mode)

[[email protected] Java] #javac-version

Javac 1.8.0_65

Reference connection:

Http://docs.oracle.com/javase/8/docs/technotes/guides/install/linux_jdk.html#BJFJJEFG

Four, installation Apache Tomcat

[[email protected] tmp] #tar-xvzf apache-tomcat-9.0.0.m1.tar.gz

......

[Email protected] tmp]# mkdir-p/usr/local/apache-tomcat

[Email protected] tmp]# MV apache-tomcat-9.0.0.m1/usr/local/apache-tomcat/

Environment variable configuration:

[Email protected] java]# Vim/etc/profile

......

#added by Shouke

Export java_home=/usr/local/java/jdk1.8.0_65

Export JRE_HOME=/USR/LOCAL/JAVA/JDK1.8.0_65/JRE

Export CATALINA_BASE=/USR/LOCAL/APACHE-TOMCAT/APACHE-TOMCAT-9.0.0.M1

Export CATALINA_HOME=/USR/LOCAL/APACHE-TOMCAT/APACHE-TOMCAT-9.0.0.M1

Classpath=.: $JAVA _home/lib/dr.jar: $JAVA _home/lib/tools.jar:

Export path= $PATH: $JAVA _home/bin: $JRE _home/bin: $CATALINA _base: $CATALINA _home

[Email protected] bin]# Source/etc/profile

Set the Administrator account password

[[email protected] apache-tomcat-9.0.0.m1]# ls

Bin conf lib LICENSE logs NOTICE release-notes RUNNING.txt temp WebApps work

[Email protected] apache-tomcat-9.0.0.m1]# CD conf/

[Email protected] conf]# vim Tomcat-users.xml

Find the following:



New users and roles under it

Question: How do you know what role a character is? Click the corresponding button, click Cancel,



Like, it'll tell you how to do it.



Can be set according to the actual situation, the modified file configuration is as follows



Description: Admin user can access server Status,manager App, Host Manager

, Hostadmin can only access host Manager

Launch Apache Tomcat

[Email protected] tmp]# cd/usr/local/apache-tomcat/apache-tomcat-9.0.0.m1/

[[Email protected] apache-tomcat-9.0.0.m1]# CD bin

[Email protected] bin]# sh startup.sh

Using catalina_base:/usr/local/apache-tomcat/apache-tomcat-9.0.0.m1

Using Catalina_home:/usr/local/apache-tomcat/apache-tomcat-9.0.0.m1

Using Catalina_tmpdir:/usr/local/apache-tomcat/apache-tomcat-9.0.0.m1/temp

Using Jre_home:/usr/local/java/jdk1.8.0_65/jre

Using CLASSPATH:/usr/local/apache-tomcat/apache-tomcat-9.0.0.m1/bin/bootstrap.jar:/usr/local/apache-tomcat/ Apache-tomcat-9.0.0.m1/bin/tomcat-juli.jar

Tomcat started.

[Email protected] bin]#

Firewall opens default port of 8080

[[email protected] bin] #firewall-cmd--permanent--zone=public--add-port=8080/tcp

Success

[[email protected] bin] #firewall-cmd--reload

Access test



Five, installation maven

[Email protected] tmp]# mkdir-p/usr/local/maven

[Email protected] tmp]# TAR-XVZF apache-maven-3.3.9-bin.tar.gz

......

[Email protected] tmp]# MV apache-maven-3.3.9/usr/local/maven/

environment variable Settings

[[email protected] tmp] #vim/etc/profile

Export java_home=/usr/local/java/jdk1.8.0_65

Export JRE_HOME=/USR/LOCAL/JAVA/JDK1.8.0_65/JRE

Export CATALINA_BASE=/USR/LOCAL/APACHE-TOMCAT/APACHE-TOMCAT-9.0.0.M1

Export CATALINA_HOME=/USR/LOCAL/APACHE-TOMCAT/APACHE-TOMCAT-9.0.0.M1

Export maven_home=/usr/local/maven/apache-maven-3.3.9

Classpath=.: $JAVA _home/lib/dr.jar: $JAVA _home/lib/tools.jar:

Export path= $PATH: $JAVA _home/bin: $JRE _home/bin: $CATALINA _base: $CATALINA _home: $MAVEN _home/bin

[Email protected] tmp]# Source/etc/profile

To see if the installation was successful

[Email protected] tmp]# mvn-v

Apache Maven 3.3.9 (BB52D8502B132EC0A5A3F4C09453C07478323DC5; 2015-11-11t00:41:47+08:00)

Maven Home:/usr/local/maven/apache-maven-3.3.9

Java version:1.8.0_65, Vendor:oracle Corporation

Java Home:/usr/local/java/jdk1.8.0_65/jre

Default Locale:en_us, Platform Encoding:utf-8

OS name: "Linux", Version: "3.10.0-229.el7.x86_64", Arch: "AMD64", Family: "Unix"

Reference connection: http://maven.apache.org/install.html

Six, installation Jenkins

[[email protected] tmp]# ls

Jenkins.war

[email protected] tmp]# CP jenkins.war/usr/local/apache-tomcat/apache-tomcat-9.0.0.m1/webapps/

Restart Apache Tomcat Server

[Email protected] bin]# sh/usr/local/apache-tomcat/apache-tomcat-9.0.0.m1/bin/shutdown.sh

[Email protected] bin]# sh sh/usr/local/apache-tomcat/apache-tomcat-9.0.0.m1/bin/startup.sh

Visit Jenkins



Seven, Jenkins Basic Settings

1) System Management-System Setup





2) System Management-security settings


After submission as follows





Register and Login

3) System Management-plug-in management

1) Deploy to container Plugin

Installation Method 1, online installation

System Management, management plug-in, optional plug-in filter, input deploy to container Plugin,



Cons: May not download, GFW is too powerful

Installation Method 2, local installation

Download Plugins, Plugins collection:

Https://updates.jenkins-ci.org/download/plugins

Deploy to Container Plugin:

https://updates.jenkins-ci.org/download/plugins/deploy/

Browse, upload plug-ins, management plug-ins, System Management, open. Phi Plug-in upload







To see if the installation was successful



Eight, Auto-build tasks and automatic deployment

Click "New", "Create a new task" (if you have never created a task)



For example, fill in the Item name and click "OK"

The code structure is as follows:



Select Subversion and fill in the Repository code URL

As above, prompt no credential, click Enter credential, open the following interface


As above, fill in the URL of the code base and user name and password, click "OK" to submit

Return to just the page, refresh, re-fill, the results are as follows





Building triggers






Description

1) Poll SCM: Regularly check the source changes (according to the SCM software version number), if there is an update checkout the latest code down, and then perform the build action.

2) Build periodically: build on a given period (it doesn't matter if the source code is changed)

Example:

*/60 * * * * (meaning to check the source changes every 60 minutes)

0 2 * * * (build once daily 2:00)

This is consistent with the Linux crontab file configuration.

Reference connection:

Http://www.scmgalaxy.com/scm/setting-up-the-cron-jobs-in-jenkins-using-build-periodically-scheduling-the-jenins-job.html





[Email protected] workspace]# pwd

/root/.jenkins/jobs/test_project1/workspace

[email protected] workspace]# LL

Total 56

-rw-r-----. 1 root root 16629 Dec 17:21 pom.xml

-rw-r-----. 1 root root 3235 Dec 17:21 readme.txt

Drwxr-x---. 2 root root 4096 Dec 17:21 review

Drwxr-x---. 4 root root 4096 Dec 17:21 src

Drwxr-x---. 8 root root 4096 Dec 17:21 target

-rw-r-----. 1 root root 16664 Dec 20 17:21 version change record. txt

Note: Here the POM settings are fastidious, refer to the connection:

Http://my.oschina.net/u/260244/blog/318755#OSC_h3_16

As above, post steps, choose only build success to run Post steps

As above, click on "Add post Build Steps", select Deploy War/ear to a container, set the remote publishing project

Description

1) The build will generate the Filename.war file under directory:/root/.jenkins/jobs/item_name/workspace/target, in this case:

/root/.jenkins/jobs/test_project1/workspace/target/appserver.war

2) war/ear files: Fill in the relative path where the. WAR,. EAR file resides

3) Context Path: Fill in the location to be published to the remote server, usually Tomcat's WebApps

4) Normally do not tick "Deploy on Failure", that is, build failure is not released

5) You can also use publish over SSH for remote publishing, refer to Connection:

http://jdkleo.iteye.com/blog/2159844



As above, click Add Contianer, you can select the container type, here Tomcat 7.x, then fill in the Tomcat administrator (Tomcat user with Manager-gui role), password, tomcat connection

Final submission, as follows



As below, click on the right button to start building for the first time



Click Connect to view console Output



As below, the first time will download the relevant files according to Pom.xml

Download PDF version:

CentOS7 svn+tomcat9.0+maven3.3+jenkins Implementation of Web project auto-build and remote publishing. pdf

Deployment Projects under Linux

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.