(1) Simple setup in the Jenkins Linux environment
Jenkins is an open source software project designed to provide an open and easy-to-use software platform that makes continuous software integration possible.
----Baidu Encyclopedia
This is a Java-based development tool. For a variety of reasons, recently began to contact, decided to study. Jenkins more than one way to build, a personal summary of one of them, the content of the article is relatively simple, shortcomings, welcome correction.
First, you need to prepare the tools JDK, Maven. The data shows that the JDK version is better than 1.7, and did not study the following version of 1.7, so-called "no actual research, there is no voice", do not do too much to repeat.
The JDK should be needless to say, I'm sure you'll find it.
Maven http://maven.apache.org/download.cgi
My tools:
Jdk-8u131-linux-x64.tar.gz
Apache-maven-3.5.0-bin.tar.gz
Environment:
[[email protected] ]# uname -alinux node02.cn 2.6.32-642.el6.x86_64 #1 SMP Tue May 10 17:27:01 UTC 2016 x86_64 x86_64 x86_64 gnu/linux[[email protected] jdk]# free -m total used free shared buffers cachedMem: 1861 511 1350 0 10 356-/+ buffers/cache: 143 1717swap: 1023 0 1023[[email protected] ]#[[email protected] ~]# service iptables stopiptables: Setting chains to Policy accept: filter [ ok ]iptables: Flushing firewall rules: [ OK ]iptables: Unloading modules: [ ok ][[email protected] ~]# setenforce 0[[email protected] ~]#
First, configure the JDK
[Email protected] jdk]# pwd/data/jdk[[email protected] jdk]# lsjdk-8u131-linux-x64.tar.gz
Unpack the JDK installation package:
[[email protected] jdk]# tar zxvf jdk-8u131-linux-x64.tar.gz[[email protected] jdk]# lsjdk1.8.0_131 Jdk-8u131-linux-x64.tar.gz[[email protected] jdk]# cd jdk1.8.0_131/[[email protected] jdk1.8.0_131]# pwd/data/jdk/jdk1.8.0_131[[email protected] jdk1.8.0_131]# lsbin db javafx-src.zip lib man release THIRDPARTYLICENSEREADME-JAVAFX.txtCOPYRIGHT include jre LICENSE README.html src.zip thirdpartylicensereadme.txt[[email protected] jdk1.8.0_131]#
Create an environment variable file: (For ease of maintenance, create an app's environment variable file below)
[Email protected] jdk1.8.0_131]# Vim/etc/profile.d/java-jdk.sh[[email protected] jdk1.8.0_131]# cat! $cat/etc/ Profile.d/java-jdk.shexport java_home=/data/jdk/jdk1.8.0_131export path= $JAVA _home/bin: $PATHexport CLASSPATH=.:$ Java_home/lib/dt.jar: $JAVA _home/lib/tools.jar
After saving exits, use source to take effect:
[[email protected] jdk1.8.0_131]# source! $source/etc/profile.d/java-jdk.sh
To test the Java environment:
[[email protected] jdk1.8.0_131]# Java-versionjava version "1.8.0_131" Java (TM) SE Runtime Environment (build 1.8.0_131-b One) Java HotSpot (TM) 64-bit Server VM (build 25.131-b11, Mixed mode) [[email protected] jdk1.8.0_131]#
Second, configure Maven
[Email protected] maven]# pwd/data/maven[[email protected] maven]# lsapache-maven-3.5.0-bin.tar.gz
Extract:
[[Email protected] maven]# tar zxvf apache-maven-3.5.0-bin.tar.gz ^c[[email protected] maven]# lsapache-maven-3.5.0 APAC He-maven-3.5.0-bin.tar.gz[[email protected] maven]# CD Apache-maven-3.5.0[[email protected] apache-maven-3.5.0]# Lsbin Boot conf lib LICENSE NOTICE README.txt
Configure and take effect environment variables:
[Email protected] apache-maven-3.5.0]# Vim/etc/profile.d/maven.sh[[email protected] apache-maven-3.5.0]# source!$ Source/etc/profile.d/maven.sh[[email protected] apache-maven-3.5.0]# cat/etc/profile.d/maven.shexport MAVEN_HOME=/ Data/maven/apache-maven-3.5.0export path= $MAVEN _home/bin: $PATH [[email protected] apache-maven-3.5.0]#
Test:
[Email protected] apache-maven-3.5.0]# mvn-vapache maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426; 2017-04-04t03:39:06+08:00) Maven Home:/data/maven/apache-maven-3.5.0java version:1.8.0_131, Vendor:oracle Corporationjava Home:/data/jdk/jdk1.8.0_131/jredefault Locale:en_us, Platform Encoding:utf-8os name: "Linux", version : "2.6.32-642.el6.x86_64", Arch: "AMD64", Family: "Unix" [[email protected] apache-maven-3.5.0]#
Configuration is successful!
Third, install Jenkins:
[Email protected] ~]# Wget-o/etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo[[email Protected] ~]# rpm--import http://pkg.jenkins-ci.org/redhat/jenkins-ci.org.key[[email protected] ~]# Yum clean all[[ Email protected] ~]# yum install jenkins[[email protected] ~]#
Configure Jenkins:
Modify the configuration file for Jenkins
[Email protected] ~]# vim/etc/sysconfig/jenkins #默认端口是8080 # Port Jenkins is listening on. # Set To-1 To disable # jenkins_port= "8080" * * * * type:string "# # # Serviceres Tart:jenkins # #/IP Address Jenkins listens on for HTTP requests. All interfaces (0.0.0.0). # jenkins_listen_address= "".
Modify the service script for Jenkins
[[Email protected] ~]# vim /etc/init.d/jenkins. 64 # search usable Java as /usr/bin/java might not point to minimal version required by jenkins. 65 # see http://www.nabble.com/ guinea-pigs-wanted-----hudson-rpm-for-redhat-linux-td25673707.html 66 candidates= " 67 /etc /alternatives/java 68 /usr/lib/jvm/java-1.8.0/bin/java 69 /usr/lib/jvm/jre-1.8.0/bin/java 70 /usr/lib/jvm/java-1.7.0/bin/java 71 /usr/lib/jvm/jre-1.7.0/bin/java 72 /usr/ bin/java 73 /data/jdk/jdk1.8.0_131/bin/java # Add Content--Specify your Java path 74 75 for candidate in $candidates 76 do 77 [ -x "$JENKINS _java_cmd" ] && break 78 jenkins_java_cmd= "$candidate".
Start the Jenkins service:
[[Email protected] ~]# service Jenkins startstarting Jenkins [OK][[email Pro Tected] ~]#
Visit the test for a moment:
650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M01/98/7E/wKioL1k9S56AZkF2AADTx_jbxQQ674.png-wh_500x0-wm_ 3-wmp_4-s_3070225474.png "title=" Jenkins start. png "alt=" wkiol1k9s56azkf2aadtx_jbxqq674.png-wh_50 "/>
Start interface Prompt password generation location:
[Email protected] ~]# Cat/var/lib/jenkins/secrets/initialadminpassword
Paste in the input box
650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M02/98/7E/wKiom1k9S_mxSH-YAAFbhbiMkxI568.png-wh_500x0-wm_ 3-wmp_4-s_3410731481.png "title=" Enter the password interface. png "alt=" wkiom1k9s_mxsh-yaafbhbimkxi568.png-wh_50 "/>
Next, choose the recommended plug-in installation:
650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M02/98/7E/wKioL1k9TIjC1nDtAAHmvx9Zjh8183.png-wh_500x0-wm_ 3-wmp_4-s_2197225504.png "title=" Jenkins Select Plug-in installation. png "alt=" wkiol1k9tijc1ndtaahmvx9zjh8183.png-wh_50 "/>
To start installing plugins:
650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M01/98/7E/wKioL1k9TPnSIcbCAAGfcyw8i0Y515.png-wh_500x0-wm_ 3-wmp_4-s_1768786879.png "title=" Jenkins starts installing plugins. png "alt=" wkiol1k9tpnsicbcaagfcyw8i0y515.png-wh_50 "/>
After the installation is complete, you will be prompted to create the user:
650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M01/98/7E/wKiom1k9TdfRqF1qAAE1tyjxx4Q401.png-wh_500x0-wm_ 3-wmp_4-s_2686906467.png "title=" Aaaa.png "alt=" Wkiom1k9tdfrqf1qaae1tyjxx4q401.png-wh_50 "/>
Welcome interface:
650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M01/98/7E/wKioL1k9TnfwAWTkAADsi1uptvA564.png-wh_500x0-wm_ 3-wmp_4-s_2985430924.png "title=" Ready.png "alt=" Wkiol1k9tnfwawtkaadsi1uptva564.png-wh_50 "/>
Next you can create a task:
650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M01/98/7E/wKioL1k9TrOhq1HIAACj29XSwTw742.png-wh_500x0-wm_ 3-wmp_4-s_1667134763.png "title=" Jjjj.png "alt=" Wkiol1k9trohq1hiaacj29xswtw742.png-wh_50 "/>
This article is from the "ZQSBG" blog, make sure to keep this source http://zqsbg.blog.51cto.com/11471572/1934314
(1) Simple setup in the Jenkins Linux environment