一、java环境安装

1、如下图,安装Jenkins需要java1.8或java11,因此先安装java。这里建议安装java1.8,感觉java11支持不太好!!!

2、下载java

(1)所有版本下载地址

Java Archive | Oraclehttp://www.oracle.com/technetwork/java/javase/archive-139210.html(2)下载步骤

 

 

 (3)一键安装

双击下载后的文件,根据提示,一键安装即可,如图,安装成功

java8之后,是没有自动生成jre文件夹的,因此需要进入到安装目录,手动安装

cd C:\Program Files\Java\jdk-11
bin\jlink.exe --module-path jmods --add-modules java.desktop --output jre

 (4)环境变量配置

如果采用默认方式安装,路径应该为:C:\Program Files\Java\jdk-11

 继续创建系统变量CLASSPATH

.;%JAVA_HOME%\bin;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar

 

 在Path中新增变量

%JAVA_HOME%\bin
%JAVA_HOME%\jre\bin

 打开新的cmd,查看版本:

 二、安装Jenkins

1、下载地址

https://jenkins.io/download/https://jenkins.io/download/2、根据提示,一键安装

3、访问

http://127.0.0.1:8080/

 (1)根据提示完成配置

 (2)如上图,显示插件安装失败,可以选择跳过该步骤并继续或尝试重试继续安装默认插件,这里选择第二种,依旧失败,在jenkins安装目录下了解到原因是下载问题:

(3)先记录一下推荐插件

 (4)跳过安装,进入系统,进行操作

进入如下链接进行设置:http://127.0.0.1:8080/pluginManager/advanced

查看源地址:https://updates.jenkins.io/update-center.json

更改源地址:https://mirrors.tuna.tsinghua.edu.cn/jenkins/updates/update-center.json

 (5)根据记录的推荐插件,逐个安装,很遗憾,全部失败

这个就有点恶心哈,感觉jenkins非常垃圾,不过不代表它不强大,总的来说还是挺有趣的,继续查找问题吧!

 

 (6)点击上图的详细错误,查看具体报错:

貌似说的是java报错的原因,缺失安全证书?

sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
	at java.base/sun.security.provider.certpath.SunCertPathBuilder.build(SunCertPathBuilder.java:141)
	at java.base/sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:126)
	at java.base/java.security.cert.CertPathBuilder.build(CertPathBuilder.java:297)
	at java.base/sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:380)
Caused: sun.security.validator.ValidatorException: PKIX path building failed
	at java.base/sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:385)
	at java.base/sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:290)
	at java.base/sun.security.validator.Validator.validate(Validator.java:264)
	at java.base/sun.security.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.java:321)
	at java.base/sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:221)
	at java.base/sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:129)
	at java.base/sun.security.ssl.CertificateMessage$T13CertificateConsumer.checkServerCerts(CertificateMessage.java:1313)
Caused: javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
	at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:128)
	at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:321)
	at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:264)
	at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:259)
	at java.base/sun.security.ssl.CertificateMessage$T13CertificateConsumer.checkServerCerts(CertificateMessage.java:1329)
	at java.base/sun.security.ssl.CertificateMessage$T13CertificateConsumer.onConsumeCertificate(CertificateMessage.java:1204)
	at java.base/sun.security.ssl.CertificateMessage$T13CertificateConsumer.consume(CertificateMessage.java:1151)
	at java.base/sun.security.ssl.SSLHandshake.consume(SSLHandshake.java:392)
	at java.base/sun.security.ssl.HandshakeContext.dispatch(HandshakeContext.java:444)
	at java.base/sun.security.ssl.HandshakeContext.dispatch(HandshakeContext.java:421)
	at java.base/sun.security.ssl.TransportContext.dispatch(TransportContext.java:178)
	at java.base/sun.security.ssl.SSLTransport.decode(SSLTransport.java:164)
	at java.base/sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1152)
	at java.base/sun.security.ssl.SSLSocketImpl.readHandshakeRecord(SSLSocketImpl.java:1063)
	at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:402)
	at java.base/sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:567)
	at java.base/sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:185)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.followRedirect0(HttpURLConnection.java:2758)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.followRedirect(HttpURLConnection.java:2680)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1843)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1509)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.getHeaderField(HttpURLConnection.java:3033)
	at java.base/java.net.URLConnection.getHeaderFieldLong(URLConnection.java:636)
	at java.base/java.net.URLConnection.getContentLengthLong(URLConnection.java:508)
	at java.base/java.net.URLConnection.getContentLength(URLConnection.java:492)
	at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getContentLength(HttpsURLConnectionImpl.java:389)
	at hudson.model.UpdateCenter$UpdateCenterConfiguration.download(UpdateCenter.java:1261)
Caused: javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
	at java.base/sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1963)
	at java.base/sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1958)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1957)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1525)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1509)
	at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:245)
	at hudson.model.UpdateCenter$UpdateCenterConfiguration.download(UpdateCenter.java:1277)
Caused: java.io.IOException: Failed to load https://updates.jenkins.io/download/plugins/antisamy-markup-formatter/2.4/antisamy-markup-formatter.hpi to C:\ProgramData\Jenkins\.jenkins\plugins\antisamy-markup-formatter.jpi.tmp
	at hudson.model.UpdateCenter$UpdateCenterConfiguration.download(UpdateCenter.java:1284)
Caused: java.io.IOException: Failed to download from https://updates.jenkins.io/download/plugins/antisamy-markup-formatter/2.4/antisamy-markup-formatter.hpi (redirected to: https://get.jenkins.io/plugins/antisamy-markup-formatter/2.4/antisamy-markup-formatter.hpi)
	at hudson.model.UpdateCenter$UpdateCenterConfiguration.download(UpdateCenter.java:1318)
	at hudson.model.UpdateCenter$DownloadJob._run(UpdateCenter.java:1872)
	at hudson.model.UpdateCenter$InstallationJob._run(UpdateCenter.java:2167)
	at hudson.model.UpdateCenter$DownloadJob.run(UpdateCenter.java:1846)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at hudson.remoting.AtmostOneThreadExecutor$Worker.run(AtmostOneThreadExecutor.java:121)
	at java.base/java.lang.Thread.run(Thread.java:834)

(7) 卸载java11,安装java8,再重新安装jenkins,结果如下:

如图,满屏的成功!!! 

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐