在centos7.9上安装Jenkins的安装过程

1.jenkins的安装和配置:

  • 安装JDK:

    复制代码
    yum install -y fontconfig java-11-openjdk
    # 安装目录:/usr/lib/jvm
    # fontconfig 是 Linux 系统中用于配置和管理字体的一种工具
  • 下载jenkins安装包:

    复制代码
    sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo --no-check-certificate
    sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io-2023.key
  • 修改jenkins的启动配置文件:

    复制代码
    vim /usr/lib/systemd/system/jenkins.service
    sed -i 's/^User=.*/User=root/' /usr/lib/systemd/system/jenkins.service
    sed -i 's/^Group=.*/Group=root/' /usr/lib/systemd/system/jenkins.service
    # 修改为自己想要的访问端口号
    sed -i 's/^Environment=\"JENKINS_PORT=.*/Environment=\"JENKINS_PORT=8888\"/' /usr/lib/systemd/system/jenkins.service
    # 修改Jenkins前缀(方便Nginx代理)
    sed -i 's/^#Environment=\"JENKINS_PREFIX/Environment=\"JENKINS_PREFIX/' /usr/lib/systemd/system/jenkins.service
  • 启动jenkins:

    复制代码
    systemctl daemon-reload && systemctl start jenkins && systemctl enable jenkins
  • jenkins默认安装目录 /var/lib/jenkins在服务启动成功后创建文件

    复制代码
    [root@localhost ~]# ll /var/lib/jenkins
    total 28
    -rw-r--r-- 1 root root 1640 Dec 18 10:53 config.xml
    -rw-r--r-- 1 root root  156 Dec 18 10:53 hudson.model.UpdateCenter.xml
    -rw------- 1 root root 1712 Dec 18 10:53 identity.key.enc
    -rw-r--r-- 1 root root    7 Dec 18 10:53 jenkins.install.UpgradeWizard.state
    -rw-r--r-- 1 root root  171 Dec 18 10:53 jenkins.telemetry.Correlator.xml
    drwxr-xr-x 2 root root    6 Dec 18 10:53 jobs
    drwxr-xr-x 3 root root   19 Dec 18 10:53 logs
    -rw-r--r-- 1 root root  907 Dec 18 10:53 nodeMonitors.xml
    drwxr-xr-x 2 root root    6 Dec 18 10:53 nodes
    drwxr-xr-x 2 root root    6 Dec 18 10:53 plugins
    -rw-r--r-- 1 root root   64 Dec 18 10:53 secret.key
    -rw-r--r-- 1 root root    0 Dec 18 10:53 secret.key.not-so-secret
    drwx------ 4 root root  265 Dec 18 10:53 secrets
    drwxr-xr-x 2 root root   26 Dec 18 10:53 updates
    drwxr-xr-x 2 root root   24 Dec 18 10:53 userContent
    drwxr-xr-x 3 root root   56 Dec 18 10:53 users
  • 修改镜像地址:

    复制代码
    vim /var/lib/jenkins/hudson.model.UpdateCenter.xml
    # 将<url></url>内的地址修改为
    https://mirrors.tuna.tsinghua.edu.cn/jenkins/updates/update-center.json
  • 重启jenkins:(jenkins没有重启)

    复制代码
    systemctl daemon-reload && systemctl start jenkins
  • 浏览器访问:

    复制代码
    http://192.168.174.202:8888/jenkins
  • 将此路径文件中的密钥复制到输入框:

    复制代码
    [root@jenkins-server ~]# cat /var/lib/jenkins/secrets/initialAdminPassword
    0c28e6d1e10d4e858a1c38e09ca8df86
  • 因为Jenkins插件需要连接默认官网下载,速度非常慢,而且经过会失败,所以我们暂时先跳过插件安装

  • 创建一个新的管理员账号:

  • 确认jenkins的访问地址:

  • 完成:

2.安装汉化插件:

重新访问:

相关推荐
java叶新东老师14 分钟前
linux 部署 flink 1.15.1 并提交作业
linux·运维·flink
程序员JerrySUN1 小时前
Linux系统架构核心全景详解
linux·运维·系统架构
无敌的牛1 小时前
Linux文件理解,基础IO理解
linux·运维·服务器
angushine1 小时前
鲲鹏服务器logstash采集nginx日志
运维·服务器·nginx
睿思达DBA_WGX2 小时前
由于主库切换归档路径导致的 Oracle DG 无法同步问题的解决过程
运维·数据库·oracle
XXYBMOOO2 小时前
Xilinx-FPGA-PCIe-XDMA 驱动内核兼容性问题修复方案
linux·运维·服务器
会飞的青蛙2 小时前
从购买服务器,到Ubuntu + Docker + Jenkins 部署,再到网页展示!
nginx·ci/cd·jenkins
爱学习的狮王3 小时前
window10和ubuntu22.04双系统之卸载ubuntu系统
linux·运维·ubuntu
liux35283 小时前
从零构建:Jenkins与Kubernetes集成的完整指南
java·kubernetes·jenkins
Deutsch.5 小时前
负载均衡Haproxy
运维·负载均衡·haproxy