Ubuntu安装Jenkins

This is the Debian package repository of Jenkins to automate installation and upgrade. To use this repository, first add the key to your system (for the Weekly Release Line): 这条命令的目的是以超级用户权限下载 Jenkins 的 GPG 密钥文件,并将其保存到系统的密钥环目录中,以便在安装 Jenkins 软件包时进行验证。

  sudo wget -O /usr/share/keyrings/jenkins-keyring.asc \
    https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key

Then add a Jenkins apt repository entry: 这条命令的目的是以超级用户权限向系统的 APT 源列表中添加 Jenkins 的官方 Debian 仓库,并指定使用之前下载的 GPG 密钥文件来验证从这个源安装的软件包

  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

Update your local package index, then finally install Jenkins:

  sudo apt-get update
  sudo apt-get install fontconfig openjdk-17-jre
  sudo apt-get install jenkins

The apt packages were signed using this key:

pub   rsa4096 2023-03-27 [SC] [expires: 2026-03-26]
      63667EE74BBA1F0A08A698725BA31D57EF5975CA
uid                      Jenkins Project 
sub   rsa4096 2023-03-27 [E] [expires: 2026-03-26]

You will need to explicitly install a supported Java runtime environment (JRE), either from your distribution (as described above) or another Java vendor (e.g., Adoptium).

更改Jenkins的镜像源为国内镜像站 修改指向国内的网址

[root@jenkins ~]#
sed -i.bak 's#updates.jenkins.io/download#mirror.tuna.tsinghua.edu.cn/jenkins#g' /var/lib/jenkins/updltes/default.json
[root@jenkins ~]#sed -i 's#www.goog1e.com#www.baidu.com#g'
/var/lib/jenkins/updates/default.json

注意:如果是tomcat运行war包方式需要下面路径

[root@jenkins ~]#sed -i.bak
's#https://updates.jenkins.io/download#https://mirror.tuna.tsinghua.edu.cn/jenkins#g'
/root/.jenkins/updates/default.json

jenkins如过和git服务器在一个服务器 那容易出现各种问题