Jenkins Server installation and configuration

Source: Internet
Author: User
Tags ranges server installation and configuration sonatype

Jenkins is an excellent continuous integration server. This article describes the basic installation and configuration methods of Jenkins in CentOS for your reference.

I. Software Package:

1. Download apache-maven-2.2.1-bin.tar
Http://www.apache.org/dyn/closer.cgi/maven/binaries/apache-maven-2.2.1-bin.tar.gz
2. Download jenkins: The http://mirrors.jenkins-ci.org/war/ lists all jenkins release versions, Select Download

Ii. Installation

 

This document assumes that the operating user is gistech.

1. Install jdk. For more information, see install jdk 1.6 in CentOS.
2. install Tomcat 7. For more information, see install Tomcat 7 in CenOS.

Modify tomcat configuration file

$ vi /home/gistech/tomcat/conf/server.xml

 

Modify the ctor node of port 8080 and add the following Configuration:

URIEncoding="UTF-8"

 

3. Install maven
1) decompress

$ tar -zvxf apache-maven-2.2.1-bin.tar.gz

 

2) Move to another directory

$ mv apache-maven-2.2.1 /home/gistech/maven

3) Configure Environment Variables
Edit the. bash_profile File

$ cd /home/gistech$ vi .bash_profile

 

Add the following content:

MAVEN_HOME=$HOME/mavenPATH=$PATH:$HOME/bin:$MAVEN_HOME/binexport MAVEN_HOMEexport PATH

 

Make environment variables take effect

$ source .bash_profile

 

4) verify whether the installation is successful

$ mvn -v   

 

5) Configure maven
Edit maven configuration file

$ cd maven/conf$ vi settings.xml

 

An example of modifying the configuration file is as follows:

<?xml version="1.0" encoding="UTF-8"?><settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"    xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">    <localRepository>/home/gistech/~m2</localRepository>    <servers>        <server>            <username>admin</username>            <password>password</password>        </server>    </servers>    <mirrors>        <mirror>            <!-- This sends everything else to /public -->            <id>nexus</id>            <mirrorOf>central</mirrorOf>            <url>http://192.168.120.247:8081/nexus/content/repositories/public</url>        </mirror>    </mirrors>    <profiles>        <profile>            <id>nexus</id>            <!-- Enable snapshots for the built in central repo to direct -->            <!-- all requests to nexus via the mirror -->            <repositories>                <repository>                    <id>central</id>                    <url>http://192.168.120.247:8081/nexus/content/repositories/public</url>                    <releases>                        <enabled>true</enabled>                        <updatePolicy>always</updatePolicy>                    </releases>                    <snapshots>                        <enabled>true</enabled>                        <updatePolicy>always</updatePolicy>                    </snapshots>                </repository>            </repositories>            <pluginRepositories>                <pluginRepository>                    <id>central</id>                    <url>http://192.168.120.247:8081/nexus/content/repositories/public</url>                    <releases>                        <enabled>true</enabled>                        <updatePolicy>always</updatePolicy>                    </releases>                    <snapshots>                        <enabled>true</enabled>                        <updatePolicy>always</updatePolicy>                    </snapshots>                </pluginRepository>            </pluginRepositories>        </profile>    </profiles>    <activeProfiles>        <!-- make the profile active all the time -->        <activeProfile>nexus</activeProfile>    </activeProfiles>    <pluginGroups>        <!-- define the sonatype plugin group, so the nexus plugins will work without             typing the groupId -->        <pluginGroup>org.sonatype.plugins</pluginGroup>    </pluginGroups></settings>

 

The localRepository node indicates the path for storing the downloaded jar package in the private server, which is modified according to the actual path.
The addresses contained in all url nodes: http: // 192.168.120.247: 8081/nexus/content/repositories/public, indicating the address of the nexus private server. Modify the address according to the actual address.
Username and password indicates the username and password used to log on to the nexus private server.
4. Install jenkins
1) copy to the tomcat webapps directory

$ mv jenkins.war /home/gistech/tomcat/webapps

 

2) Configure Environment Variables
Edit the. bash_profile File
Add the following content:

JENKINS_HOME=$HOME/tomcat/webapps/jenkinsexport JENKINS_HOME

 

Make environment variables take effect

source .bash_profile

 

3) start tomcat and Use http: // localhost: 8080/jenkins to access jenkins.

III. Basic jenkins Configuration

1. Global Configuration

Click "System Management" on the left of the homepage to go to "system settings". jenkins is set globally here.
1) install JDK. If the system variables are not read, you can manually set the alias and JAVA_HOME.
2) Likewise, Maven

3) Configure administrator email notification
The configuration method is as follows:

After the configuration is complete, you can click the send test mail test configuration button to test.
2. Create a job
1) Click "new job" on the page, enter the task name, and select "build a maven2/3 Project", for example:

2) Click "OK" to go to the task configuration page. The svn address of the configuration item is as follows:

3) configure the location of the maven pom file. You can use the relative path (relative to the location in the svn address Library), for example:

4) Configure maven compilation parameters, as shown in. Do not perform unit tests:

For details about maven compilation parameters, refer to the basic Maven commands.
3. Email Notification
Create a mail Notification configuration, for example, add the email address for sending mail notifications in the Recipients column.

4. timed Building
You can configure the Build time for the Build trigger. If you need to Build the trigger regularly, you can select Build periodically. The calendar parameters are described as follows:

  • The first parameter represents the minute. The value ranges from 0 ~ 59;
  • The second parameter represents the hour. The value ranges from 0 ~ 23;
  • The third parameter represents day. The value ranges from 1 ~ 31;
  • The fourth parameter indicates the month. The value ranges from 1 to 1 ~ 12;
  • The last parameter indicates the week. The value ranges from 0 ~ 7, 0, and 7 indicate Sunday.

For example, 0 *** indicates that a build is executed every 0th minutes of every hour.

5. Build a version update
In many cases, jenkins regularly polls the version library and triggers the build as long as there is a version update. jenkins provides Poll SCM to support version update building. For example, the configuration parameters are the same as those of the timed build, for example, */5 ** indicates polling every 5 minutes to check whether the version library is updated.

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.