Install jenkins under centos6.5
The predecessor of Jenkins is Hudson, a scalable continuous integration engine.
In general, jenkins is a plug-in that can be deployed automatically,
For me, the application is also deployed on the system.
Go to our installation steps.
1. Install JDK and build a maven Environment
Considering the actual application scenarios of jenkins, we need to install these basic environments first.
Jdk installation is relatively simple and I will not go into details here. The maven environment borrowed the content of other osc heroes blogs,
The installation is successful.
Maven official website download installation package: http://maven.apache.org/download.cgi
Download the version as needed. Here, the author chooses version 3.1.1.
1. Upload apache-maven-3.1.1-bin.tar.gz to the server,
Decompress:
Tar-zvxfapache-maven-3.1.1-bin.tar.gz
Move to/usr/local:
mvapache-maven-3.1.1/usr/local
Configure Environment Variables
vi/etc/profile
Add
exportMAVEN_HOME=/usr/local/apache-maven-3.1.1
exportPATH=$PATH:$MAVEN_HOME/bin
Recompile the file
source/etc/profile
Verify that maven is successfully installed
mvn--version
The console displays the following information:
Apache Maven 3.1.1 (0728685237757ffbf44136acec0402957f723d9a; 23:22:22 + 0800)
Maven home:/usr/local/apache-maven-3.1.1
Java version: 1.7.0 _ 25, vendor: Oracle Corporation
Java home:/usr/java/jdk1.7.0 _ 25/jre
Default locale: zh_CN, platform encoding: UTF-8
OS name: "linux", version: "2.6.32-358.6.2.el6.x86 _ 64", arch: "amd64", family: "unix"
Indicates that the installation is successful.
2. Install jenkins
wget-O/etc/yum.repos.d/jenkins.repohttp://pkg.jenkins-ci.org/redhat/jenkins.reporpm--importhttp://pkg.jenkins-ci.org/redhat/jenkins-ci.org.keyyuminstalljenkinsAfter a command is executed, jenkins is installed, which is very simple.
Configure the jenkins port to avoid conflict.
vi/etc/sysconfig/jenkins
Enter this file. This is the jenkins system configuration file,
Locate 2 and modify the port number:
JENKINS_PORT = "8080"
JENKINS_AJP_PORT = "8009"
The default value is as follows. You can change it to the desired port number to avoid conflict (the default tomcat port is also like this)
Here, the author changes:
JENKINS_PORT = "8888"
JENKINS_AJP_PORT = "8889"
Next we can try to start the jenkins service.
Servicejenkinsstart
If the prompt is: Starting Jenkins [OK]
The jenkins service is successfully started. You can directly access jenkins through http: // ip: port number.
However, the following error is reported:
StartingJenkinsbash:/usr/bin/java: The file or directory does not exist.[Failed]If this error occurs, you do not need to worry about it. The cause of this error is your jdk configuration error,
Run the following command:
Java-version
Java version "1.7.0 _ 25"
Java (TM) SE Runtime Environment (build 1.7.0 _ 25-b15)
Java HotSpot (TM) 64-Bit Server VM (build 23.25-b01, mixed mode)
We can see that the jdk version is1.7.0 _ 25, copy this name
vi/etc/init.d/jenkins
Find this code
candidates="/etc/alternatives/java/usr/lib/jvm/java-1.6.0/bin/java/usr/lib/jvm/jre-1.6.0/bin/java/usr/lib/jvm/java-1.7.0/bin/java/usr/lib/jvm/jre-1.7.0/bin/java/usr/lib/jvm/java-1.8.0/bin/java/usr/lib/jvm/jre-1.8.0/bin/java/usr/bin/javaWe will find that this is not called1.7.0 _ 25 file directory
After this code, we add
/usr/java/jdk1.7.0_25/bin/java
The effect is as follows:
candidates="/etc/alternatives/java/usr/lib/jvm/java-1.6.0/bin/java/usr/lib/jvm/jre-1.6.0/bin/java/usr/lib/jvm/java-1.7.0/bin/java/usr/lib/jvm/jre-1.7.0/bin/java/usr/lib/jvm/java-1.8.0/bin/java/usr/lib/jvm/jre-1.8.0/bin/java/usr/bin/java/usr/java/jdk1.7.0_25/bin/java"Save and exit. Run the following command again:
servicejenkinsstart
Is it successful?
Stop command:
servicejenkinsstop
Restart command:
servicejenkins restart
After successful startup, we can access the service through http: // ip: port number.
At this point, the jenkins installation is OK.