Linux 安装Jenkins

1、首先准备java环境,安装JDK,当前新版jenkins要求jdk版本1.8.     

2、下载jenkins至Linux服务器

  • 这里选择最新版 ,使用yum方式下载安装:执行命令
  sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo
  sudo rpm --import https://jenkins-ci.org/redhat/jenkins-ci.org.key
  sudo yum install jenkins

 

  • 看到jenkins版本和complete字样时,已经安装完成.

 

 

 

 

 

3、配置jenkins端口

vi /etc/sysconfig/jenkins
查找/JENKINS_PORT,修改JENKINS_PORT="8080",默认为“8080”,我修改为了8088

 

 

 4、启动jenkins

输入service jenkins restart
[root@bogon jenkins]# sudo service jenkins start
Starting Jenkins bash: /usr/bin/java: No such file or directory
                                                          [FAILED]

 

 

 

 

5、配置jenkins配置文件

 需要“vi /etc/init.d/jenkins”,把java路径加上,如下:----红色部分是我自己JDK路径

# Search usable Java. We do this because various reports indicated
# that /usr/bin/java may not always point to Java >= 1.6
# see http://www.nabble.com/guinea-pigs-wanted-----Hudson-RPM-for-RedHat-Linux-td25673707.html
candidates="
/usr/java/jdk1.7.0_79/bin/java
/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"for candidate in $candidatesdo [ -x "$JENKINS_JAVA_CMD" ] && break JENKINS_JAVA_CMD="$candidate"doneJAVA_CMD="$JENKINS_JAVA_CMD $JENKINS_JAVA_OPTIONS -DJENKINS_HOME=$JENKINS_HOME -jar $JENKINS_WAR"

 

配置后重新启动jenkins 启动成功!

posted @ 2018-07-23 11:16  路漫漫吾将上下而求索  阅读(224)  评论(0编辑  收藏  举报