centos6.8中安装jenkins

By | 2017年5月17日
目录
[隐藏]

一、安装jenkins需要jdk

先安装jdk-7u80-linux-x64.gz

1.上传jdk-7u80-linux-x64.gz到/opt/src目录。

2.执行安装脚本。

cat jdk.sh

#######################################################

cd /opt/src
tar zxvf jdk-7u80-linux-x64.gz
mv jdk1.7.0_80 /opt/java/
echo ‘export JAVA_HOME=/opt/java/’ >> /etc/profile
echo ‘export JRE_HOME=/opt/java/jre’ >> /etc/profile
echo ‘export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib:$CLASSPATH’ >> /etc/profile
echo ‘export PATH=$JAVA_HOME/bin:$PATH’ >> /etc/profile
source /etc/profile

######################################################

使用java -version测试安装是否成功。

[root@localhost src]# java -version
java version “1.7.0_80”
Java(TM) SE Runtime Environment (build 1.7.0_80-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.80-b11, mixed mode)

二、安装jenkins。

1.下载jenkins

mkdir -p /opt/jenkins/jenkins_home
mkdir -p /opt/jenkins/jenkins_node
cd /opt/jenkins
2.启动jenkins
start_jenkins.sh
#!/bin/bash
JENKINS_ROOT=/home/AAA/jenkins
export JENKINS_HOME=$JENKINS_ROOT/jenkins_home
java -jar $JENKINS_ROOT/jenkins.war –httpPort=8000
chmod a+x start_jenkins.sh
测试启动,./start_jenkins.sh
报错:
[root@localhost jenkins]# ./start_jenkins.sh
Running from: /opt/jenkins/jenkins.war
webroot: EnvVars.masterEnvVars.get(“JENKINS_HOME”)
May 17, 2017 1:59:13 PM Main deleteWinstoneTempContents
WARNING: Failed to delete the temporary Winstone file /tmp/winstone/jenkins.war
Jenkins requires Java7 or later, but you are running 1.7.0_80-b15 from /opt/java/jre
java.lang.UnsupportedClassVersionError: winstone/Launcher : Unsupported major.minor version 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
说明JDK版本太低,更换jdk8版本。
安装过程略,测试版本。
[root@localhost src]# java  -version
java version “1.8.0_121”
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)
再进行启动测试。
启动正常,
后台启动 nohup ./start_jenkins.sh > jenkins.log 2>&1 &
打开12.0.65.110:8000进行安装。

 

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注