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
启动时报如下异常:
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配置文件
[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端口
vi /etc/sysconfig/jenkins
JENKINS_PORT修改为指定端口
重启
service jenkins start
将端口添加到防火墙并重启
通过http://ip:端口,进行访问即可
扫描公众号,关注更多信息
---------------------------------------------------------------------------------我是分割线--------------------------------------------------------------------------to be a better me, talk is cheap show me the code
版权所有,转载请注明原文链接。
文中有不妥或者错误的地方还望指出,以免误人子弟。如果觉得本文对你有所帮助不妨【推荐】一下!如果你有更好的建议,可以给我留言讨论,共同进步!
再次感谢您耐心的读完本篇文章。
----------------------------------------------------------------------------------------------------------------------------------------------------------------------