CentOS 7上安装 Jenkins 2.346 -- yum 方式
  DGdJRDRdbXFV 2023年11月02日 25 0

CentOS 7上安装 Jenkins -- yum 方式

装插件太麻烦了,最后选择了 装JAVA 11,安装最版本 Jenkins

​https://mirrors.jenkins.io/war/​

CentOS 7上安装 Jenkins 2.346 -- yum 方式_Docker


开源 Devops 工具 Jenkins 在官方博客宣布,从 6 月 28 日发布的 Jenkins 2.357 和将于 9 月发布的 LTS 版本开始,Jenkins 需要 Java 11 才能使用,将放弃 Java 8

由于服务器上装的Java 8,不想换11 所以 这边选择了,2.346,(之前装的 2.227,由于好多插件不支持这个版本,所以卸载重新装成了 2.346)

安装 Jenkins

# 
[root@localhost ~]# ll /etc/yum.repos.d/
总用量 40
-rw-r--r--. 1 root root 1664 4月 8 2020 CentOS-Base.repo
-rw-r--r--. 1 root root 1309 4月 8 2020 CentOS-CR.repo
-rw-r--r--. 1 root root 649 4月 8 2020 CentOS-Debuginfo.repo
-rw-r--r--. 1 root root 314 4月 8 2020 CentOS-fasttrack.repo
-rw-r--r--. 1 root root 630 4月 8 2020 CentOS-Media.repo
-rw-r--r--. 1 root root 1331 4月 8 2020 CentOS-Sources.repo
-rw-r--r--. 1 root root 7577 4月 8 2020 CentOS-Vault.repo
-rw-r--r--. 1 root root 616 4月 8 2020 CentOS-x86_64-kernel.repo
-rw-r--r--. 1 root root 2081 3月 9 2022 docker-ce.repo
[root@localhost ~]# wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat/jenkins.repo
--2022-10-20 17:40:31-- https://pkg.jenkins.io/redhat/jenkins.repo
正在解析主机 pkg.jenkins.io (pkg.jenkins.io)... 151.101.110.133, 2a04:4e42:1a::645
正在连接 pkg.jenkins.io (pkg.jenkins.io)|151.101.110.133|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:71
正在保存至: “/etc/yum.repos.d/jenkins.repo”
100%[==========================================>] 71 --.-K/s 用时 0s
2022-10-20 17:40:33 (1.56 MB/s) - 已保存 “/etc/yum.repos.d/jenkins.repo” [71/71])

# 添加成功后,查看
[root@localhost ~]# ll /etc/yum.repos.d/
总用量 48
-rw-r--r--. 1 root root 1664 11月 23 2020 CentOS-Base.repo
-rw-r--r--. 1 root root 1309 11月 23 2020 CentOS-CR.repo
-rw-r--r--. 1 root root 649 11月 23 2020 CentOS-Debuginfo.repo
-rw-r--r--. 1 root root 314 11月 23 2020 CentOS-fasttrack.repo
-rw-r--r--. 1 root root 630 11月 23 2020 CentOS-Media.repo
-rw-r--r--. 1 root root 1331 11月 23 2020 CentOS-Sources.repo
-rw-r--r--. 1 root root 8515 11月 23 2020 CentOS-Vault.repo
-rw-r--r--. 1 root root 616 11月 23 2020 CentOS-x86_64-kernel.repo
-rw-r--r--. 1 root root 2081 3月 9 2022 docker-ce.repo
-rw-r--r--. 1 root root 71 11月 30 2016 jenkins.repo
# 导入公钥
[root@localhost ~]# rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
# yum 可以更新一下,
[root@localhost ~]# yum upgrade
# 安装 Jenkins 如果报 jenkins-2.227.1-1.1.noarch.rpm 的公钥尚未安装,则加上 --nogpgcheck
[root@localhost ~]# rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
[root@localhost ~]# yum install jenkins-2.346
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
正在解决依赖关系
--> 正在检查事务
---> 软件包 jenkins.noarch.0.2.346-1.1 将被 安装
--> 解决依赖关系完成

依赖关系解决

=================================================================================================
Package 架构 版本 源 大小
=================================================================================================
正在安装:
jenkins noarch 2.346-1.1 jenkins 87 M

事务概要
=================================================================================================
安装 1 软件包

总下载量:87 M
安装大小:87 M
Is this ok [y/d/N]: Y
Downloading packages:
jenkins-2.346-1.1.noarch.rpm | 87 MB 00:02:49
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
警告:RPM 数据库已被非 yum 程序修改。
正在安装 : jenkins-2.346-1.1.noarch 1/1
验证中 : jenkins-2.346-1.1.noarch 1/1

已安装:
jenkins.noarch 0:2.346-1.1

完毕!
[root@localhost ~]#

# 修改配置,jenkins安装成功后,默认的用户是jenkins,端口是8080,为了防止冲突,并且给用户赋权限,我们修改用户名和端口。
# 进到 VI 后 输入 /PORT 可以快速定位到 PORT 处,修改默认端口
[root@localhost ~]# vi /etc/sysconfig/jenkins
JENKINS_USER="root" #将用户改成 root
JENKINS_PORT="8888" #修改默认端口

# 添加自启动
[root@localhost ~]# systemctl enable jenkins
Created symlink from /etc/systemd/system/multi-user.target.wants/jenkins.service to /usr/lib/systemd/system/jenkins.service.
# 启动 Jenkins
[root@localhost ~]# systemctl start jenkins

# 查看服务状态,上面改了端口,这边还是使用的 8080
[root@localhost ~]# systemctl status jenkins
● jenkins.service - Jenkins Continuous Integration Server
Loaded: loaded (/usr/lib/systemd/system/jenkins.service; enabled; vendor preset: disabled)
Active: active (running) since 五 2022-10-21 12:06:05 CST; 1min 8s ago
Main PID: 16863 (java)
CGroup: /system.slice/jenkins.service
└─16863 /usr/bin/java -Djava.awt.headless=true -jar /usr/share/java/jenkins.war --webroot=%C/jenkins/war --httpPort=8080

10月 21 12:06:04 localhost.localdomain jenkins[16863]: 2022-10-21 04:06:04.393+0000 [id=27] INFO jenkins.InitReactorRunner$1#onAttained: Augmented all extensions
10月 21 12:06:05 localhost.localdomain jenkins[16863]: 2022-10-21 04:06:05.237+0000 [id=28] INFO jenkins.InitReactorRunner$1#onAttained: System config loaded
10月 21 12:06:05 localhost.localdomain jenkins[16863]: 2022-10-21 04:06:05.242+0000 [id=28] INFO jenkins.InitReactorRunner$1#onAttained: System config adapted
10月 21 12:06:05 localhost.localdomain jenkins[16863]: 2022-10-21 04:06:05.243+0000 [id=28] INFO jenkins.InitReactorRunner$1#onAttained: Loaded all jobs
10月 21 12:06:05 localhost.localdomain jenkins[16863]: 2022-10-21 04:06:05.247+0000 [id=26] INFO jenkins.InitReactorRunner$1#onAttained: Configuration for all jobs updated
10月 21 12:06:05 localhost.localdomain jenkins[16863]: 2022-10-21 04:06:05.321+0000 [id=43] INFO hudson.model.AsyncPeriodicWork#lambda$doRun$1: Started Download metadata
10月 21 12:06:05 localhost.localdomain jenkins[16863]: 2022-10-21 04:06:05.376+0000 [id=43] INFO hudson.model.AsyncPeriodicWork#lambda$doRun$1: Finished Download metadata. 48 ms
10月 21 12:06:05 localhost.localdomain jenkins[16863]: 2022-10-21 04:06:05.894+0000 [id=28] INFO jenkins.InitReactorRunner$1#onAttained: Completed initialization
10月 21 12:06:05 localhost.localdomain systemd[1]: Started Jenkins Continuous Integration Server.
10月 21 12:06:05 localhost.localdomain jenkins[16863]: 2022-10-21 04:06:05.922+0000 [id=20] INFO hudson.lifecycle.Lifecycle#onReady: Jenkins is fully up and running
[root@localhost ~]#


# 查看密码
[root@localhost ~]# cat /var/lib/jenkins/secrets/initialAdminPassword
d63a3493daee4a1645d7a105a0d24b5
[root@localhost ~]#

如果启不来报 没有权限 ,执行一下

[root@localhost ~]# chmod -R 777 /var/lib/jenkins/

CentOS 7上安装 Jenkins 2.346 -- yum 方式_CentOS_02

由于之前没卸载干净,设置过密码,所以这边直接跳进了登录界面

卸载 Jenkins

# 卸载jenkins服务
[root@localhost ~]# rpm -e jenkins
警告:/etc/sysconfig/jenkins 已另存为 /etc/sysconfig/jenkins.rpmsave
# 检查是否卸载成功
[root@localhost ~]# rpm -ql jenkins
未安装软件包 jenkins
[root@localhost ~]#



【版权声明】本文内容来自摩杜云社区用户原创、第三方投稿、转载,内容版权归原作者所有。本网站的目的在于传递更多信息,不拥有版权,亦不承担相应法律责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@moduyun.com

  1. 分享:
最后一次编辑于 2023年11月08日 0

暂无评论

推荐阅读
  4koL3J55wyKx   2023年11月13日   38   0   0 icogitCentOS
  9E2BTpjt8nym   2023年12月06日   36   0   0 WindowsgitCentOS
DGdJRDRdbXFV