Jenkins安装部署

 官方文档:https://wiki.jenkins-ci.org/display/JENKINS/Installing+Jenkins+on+Red+Hat+distributions#InstallingJenkinsonRedHatdistributions-ImportantNoteonCentOSJava
 安装jenkins
sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat-stable/jenkins.repo
sudo rpm --import https://jenkins-ci.org/redhat/jenkins-ci.org.key
sudo yum install jenkins

  这里需要注意的是java的版本要求。

  类似于

java -version
java version "1.5.0"
gij (GNU libgcj) version 4.4.6 20110731 (Red Hat 4.4.6-3)

 jenkins需要GCJ版本的Java,不支持GNU版本的Java。因而需要注意

 正确的版本

java -version
java version "1.7.0_79"
OpenJDK Runtime Environment (rhel-2.5.5.1.el6_6-x86_64 u79-b14)
OpenJDK 64-Bit Server VM (build 24.79-b02, mixed mode)

 启动、关闭和重启jenkins

sudo service jenkins start/stop/restart
sudo chkconfig jenkins on

 启动时报如下异常:

Jenkins安装部署
SEVERE: Container startup failed
java.io.IOException: Failed to start Jetty
        at winstone.Launcher.<init>(Launcher.java:158)
        at winstone.Launcher.main(Launcher.java:356)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:601)
        at Main._main(Main.java:307)
        at Main.main(Main.java:98)
Caused by: java.net.BindException: 地址已在使用
        at sun.nio.ch.Net.bind0(Native Method)
        at sun.nio.ch.Net.bind(Net.java:344)
        at sun.nio.ch.Net.bind(Net.java:336)
        at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:199)
        at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
        at org.eclipse.jetty.server.nio.SelectChannelConnector.open(SelectChannelConnector.java:187)
        at org.eclipse.jetty.server.AbstractConnector.doStart(AbstractConnector.java:316)
        at org.eclipse.jetty.server.nio.SelectChannelConnector.doStart(SelectChannelConnector.java:265)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
        at org.eclipse.jetty.server.Server.doStart(Server.java:293)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
        at winstone.Launcher.<init>(Launcher.java:156)
        ... 7 more
Jenkins安装部署

 查找jenkins配置文件

Jenkins安装部署
[root@xxxxxxx ~]# find / -name jenkins
/usr/lib/jenkins
/etc/rc.d/init.d/jenkins
/etc/logrotate.d/jenkins
/etc/sysconfig/jenkins
/var/lib/jenkins
/var/lib/yum/repos/x86_64/6/jenkins
/var/cache/jenkins
/var/cache/yum/x86_64/6/jenkins
/var/log/jenkins
Jenkins安装部署

 修改jenkins端口

vi /etc/sysconfig/jenkins 

 JENKINS_PORT修改为指定端口

 重启

service jenkins start

 将端口添加到防火墙并重启

 通过http://ip:端口,进行访问即可








本文转自秋楓博客园博客,原文链接:http://www.cnblogs.com/rwxwsblog/p/5633116.html,如需转载请自行联系原作者
上一篇:《软件测试的有效方法(第2版)》笔记(一)


下一篇:《Linux From Scratch》第三部分:构建LFS系统 第六章:安装基本的系统软件- 6.64. D-Bus-1.8.16