1. 在执行· wget -qO - https://download.jitsi.org/jitsi-key.gpg.key | apt-key add -
出现下列错误:
- 首先检查能不能访问外网(我就是这样的);
- 如果网络没问题,使用下列方式下载证书:
浏览器直接访问https://download.jitsi.org/jitsi-key.gpg.key
,得到下载文件:
然后上传到服务,接着执行:sudo apt-key add jenkins-ci.org.key
;
2. 遇到Certificate verification failed
问题:
在执行sudo apt update
后遇到
Certificate verification failed: The certificate is NOT trusted. The certificate chain uses expired certificate. Could not handshake: Error in the certificate verification. [IP: 151.101.74.133 443]
重装ca-certificates:
sudo apt install --reinstall ca-certificates
服务无法连接问题
apt upgrade , apt update, apt get install jenkins -y
最新Jenkins问题
最新的Jenkins执行sudo apt update会报错:
Failed to fetch https://pkg.jenkins.io/debian-stable/binary/InRelease Cannot initiate the connection to pkg.jenkins.io:443 (2a04:4e42:1a::645). - connect (101: Network is unreachable) Could not connect to pkg.jenkins.io:443 (146.75.114.133), connection timed out
原因是官方启用新的验证方式:
- 手动下载:
- 打开浏览器,并输入 https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key 这个链接。
- 浏览器会下载 jenkins.io-2023.key 文件到你指定的下载位置。请注意文件名是否正确。
- 将下载的 jenkins.io-2023.key 文件重命名为 jenkins-keyring.asc
执行下列命令:
sudo tee /usr/share/keyrings/jenkins-keyring.asc < jenkins-keyring.asc > /dev/null
这个命令会将jenkins-keyring.asc
写入到/usr/share/keyrings/下的jenkins-keyring.asc
中;
- 最后执行:
sudo apt-key add /usr/share/keyrings/jenkins-keyring.asc
- 执行
echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] https://pkg.jenkins.io/debian-stable binary/ | sudo tee /etc/apt/sources.list.d/jenkins.list > /dev/null
然后执行 sudo apt update
https问题
如果遇到以下问题:
Failed to connect to repository : Command "git ls-remote -h -- https://仓库地址.git HEAD" returned status code 128: stdout: stderr: fatal: unable to access 'https://仓库地址.git.git/': server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none jenkins
解决方案:
到安装Jenkins的服务器切换到Jenkins用户:
sudo su -s /bin/bash jenkins
设置Git不验证HTTPS的证书:
git config --global http.sslVerify false
注意:前提是确保你访问的服务是可靠的
配置节点问题
出现错误:
[SSH] No Known Hosts file was found at /var/lib/jenkins/.ssh/known_hosts. Please ensure one is created at this path and that Jenkins can read it. Key exchange was not finished, connection is closed.
在配置节点的ssh启动时候选择下图: