Jenkins 基础2

2022-03-21 17:54:44 浏览数 (1)

依赖

Jenkins 的运行需要 Java 环境 ,yum install jenkins 并不检查并且强制要求 java 已经正确安装,正常安装完jenkins并不代表其可以正常运行,使用下面的方式来确认当前环境下java的版本

代码语言:javascript复制
[root@h101 ~]# java -version
java version "1.7.0_65"
OpenJDK Runtime Environment (rhel-2.5.1.2.el6_5-x86_64 u65-b17)
OpenJDK 64-Bit Server VM (build 24.65-b04, mixed mode)
[root@h101 ~]# 

Note: To further make things difficult for CentOS users, the default CentOS version of Java is not compatible with Jenkins. Jenkins typically works best with a Sun implementation of Java, which is not included in CentOS for licensing reasons

CentOS 版本的java 与Jenkins并不兼容

代码语言:javascript复制
java -version
java version "1.5.0"
gij (GNU libgcj) version 4.4.6 20110731 (Red Hat 4.4.6-3)

EPEL仓库里提供的OpenJDK 可以很好的支持Jenkins

代码语言:javascript复制
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)

如果出现java的相关报错,可以先尝试找找java版本的原因


防火墙

代码语言:javascript复制
[root@h101 ~]# vim /etc/sysconfig/iptables
[root@h101 ~]# grep 8080 /etc/sysconfig/iptables
-A INPUT -p tcp -m state --state NEW -m tcp --dport 8080  -j ACCEPT 
[root@h101 ~]# /etc/init.d/iptables  reload 
iptables: Trying to reload firewall rules:                 [  OK  ]
[root@h101 ~]# iptables -L -nv | grep 8080
    0     0 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:8080 
[root@h101 ~]# 

默认情况下Jenkins监听在8080端口,所以要打开此端口,否则服务将无法访问

0 人点赞