概述
文章目录
- 1.确定java环境的安装(如果没有java环境需要配置java环境变量)
- 2.获取Jenkins源文件
- 3.导入Jenkins公钥
- 4.yum安装Jenkins
- 5.Jenkins配置文件配置java环境
- 6.配置文件
- 7.启停Jenkins
- 8.jenkins无法安装插件问题
1.确定java环境的安装(如果没有java环境需要配置java环境变量)
java -version
#编辑群居配置文件
vim /etc/profile
#在最下面,按i进入insert模式,添加一下内容
JAVA_HOME=jdk路径
export JAVA_HOME
CLASSPATH=.:$JAVA_HOME/lib
export CLASSPATH
PATH=$PATH:$JAVA_HOME/bin:$CLASSPATH
export PATH
#重新加载配置
source /etc/profile
2.获取Jenkins源文件
cd /etc/yum.repos.d/
wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo
3.导入Jenkins公钥
rpm --import https://jenkins-ci.org/redhat/jenkins-ci.org.key
4.yum安装Jenkins
yum install -y jenkins
5.Jenkins配置文件配置java环境
vi /etc/init.d/jenkins
6.配置文件
/usr/lib/jenkins/ #jenkins安装目录,WAR包会放在这里。
/etc/sysconfig/jenkins #jenkins配置文件
/var/lib/jenkins/ #默认的JENKINS_HOME。
/var/log/jenkins/jenkins.log #日志文件
7.启停Jenkins
service jenkins start
service jenkins stop
service jenkins restart
默认端口8080,ip:8080访问,注意虚拟机要开放端口,阿里云配置网络安全组
8.jenkins无法安装插件问题
- jenkins安装插件报错:原因是默认证书有问题
sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at sun.security.provider.certpath.SunCertPathBuilder.build(SunCertPathBuilder.java:145)
at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:131)
at java.security.cert.CertPathBuilder.build(CertPathBuilder.java:280)
at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:382)
Caused: sun.security.validator.ValidatorException: PKIX path building failed
at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:387)
at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:292)
at sun.security.validator.Validator.validate(Validator.java:260)
at sun.security.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.java:324)
at sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:229)
at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:124)
at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1351)
Caused: javax.net.ssl.SSLHandshakeException
at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)
at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1917)
at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:301)
at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:295)
at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1369)
at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:156)
at sun.security.ssl.Handshaker.processLoop(Handshaker.java:925)
at sun.security.ssl.Handshaker.process_record(Handshaker.java:860)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1043)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1343)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1371)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1355)
- 更新站点:https://mirrors.tuna.tsinghua.edu.cn/jenkins/updates/update-center.json
- 进入jenkins站点更新目录修改默认json配置
cd /var/lib/jenkins/updates/
- 全局替换default.json里面的下载插件地址
sed -i 's/http://updates.jenkins-ci.org/download/https://mirrors.tuna.tsinghua.edu.cn/jenkins/g' default.json
sed -i 's/http://www.google.com/https://www.baidu.com/g' default.json
- 查找证书路径
find / -type f -name cacerts
- 修改jenkins配置文件
vi /etc/sysconfig/jenkins
JENKINS_JAVA_OPTIONS="-Djava.awt.headless=true -Djavax.net.ssl.trustStore=/etc/pki/ca-trust/extracted/java/cacerts"
- 重启jenkins
service restart jenkins
最后
以上就是甜蜜狗为你收集整理的【软件部署】Linux系统yum方式安装Jenkins的全部内容,希望文章能够帮你解决【软件部署】Linux系统yum方式安装Jenkins所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复