centos6.9安装Jenkins服务
1.安装javajdk,默认centos6.9只能下载到java8,安装成功后Jenkins会有一堆插件用不了,使用这里手动安装java17,在官网找对应安装包
https://www.oracle.com/java/technologies/downloads/#java17
这里下载了jdk-17_linux-x64_bin.rpm格式
rpm -ivh 文件名
java -version 查看下版本,有输出就安装成功了
设置JAVA_HOME:为了方便使用Java 17,您可以设置JAVA_HOME环境变量。编辑/etc/profile
文件,并在文件末尾添加以下行:
export JAVA_HOME=/usr/java/jdk-17
export PATH=$JAVA_HOME/bin:$PATH
保存文件并退出。然后运行以下命令以使更改生效:
source /etc/profile
至此java环境安装成功
安装Jenkins
2. 添加Jenkins仓库的GPG密钥:
```
sudo rpm --import https://pkg.jenkins.io/redhat/jenkins.io.key
```
3. 添加Jenkins仓库到yum源列表:
```
sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo
```
4. 导入Jenkins仓库的GPG密钥:
```
sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
```
6. 安装Jenkins:
```
sudo yum install jenkins
注意这里默认会装上最新的,根据你本地的环境可能会下不了,我安装的时候就报错了
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | Resolving Dependencies --> Running transaction check ---> Package jenkins.noarch 0:2.426.1-1.1 will be installed --> Processing Dependency: systemd for package: jenkins-2.426.1-1.1.noarch --> Processing Dependency: systemd for package: jenkins-2.426.1-1.1.noarch --> Finished Dependency Resolution Error: Package: jenkins-2.426.1-1.1.noarch (jenkins) Requires: systemd You could try using --skip-broken to work around the problem ** Found 40 pre-existing rpmdb problem(s), 'yum check' output follows: mysql1-5.6.39-1.x86_64 has missing requires of perl(lib::mtr_gcov.pl) mysql1-5.6.39-1.x86_64 has missing requires of perl(lib::mtr_gprof.pl) mysql1-5.6.39-1.x86_64 has missing requires of perl(lib::mtr_io.pl) mysql1-5.6.39-1.x86_64 has missing requires of perl(lib::mtr_misc.pl) mysql1-5.6.39-1.x86_64 has missing requires of perl(lib::mtr_process.pl) mysql1-5.6.39-1.x86_64 has missing requires of perl(lib::v1/mtr_cases.pl) mysql1-5.6.39-1.x86_64 has missing requires of perl(lib::v1/mtr_gcov.pl) mysql1-5.6.39-1.x86_64 has missing requires of perl(lib::v1/mtr_gprof.pl) mysql1-5.6.39-1.x86_64 has missing requires of perl(lib::v1/mtr_im.pl) mysql1-5.6.39-1.x86_64 has missing requires of perl(lib::v1/mtr_io.pl) mysql1-5.6.39-1.x86_64 has missing requires of perl(lib::v1/mtr_match.pl) mysql1-5.6.39-1.x86_64 has missing requires of perl(lib::v1/mtr_misc.pl) mysql1-5.6.39-1.x86_64 has missing requires of perl(lib::v1/mtr_process.pl) mysql1-5.6.39-1.x86_64 has missing requires of perl(lib::v1/mtr_report.pl) mysql1-5.6.39-1.x86_64 has missing requires of perl(lib::v1/mtr_stress.pl) mysql1-5.6.39-1.x86_64 has missing requires of perl(lib::v1/mtr_timer.pl) mysql1-5.6.39-1.x86_64 has missing requires of perl(lib::v1/mtr_unique.pl) mysql1-5.6.39-1.x86_64 has missing requires of perl(mtr_io.pl) mysql1-5.6.39-1.x86_64 has missing requires of perl(mtr_misc.pl) mysql1-5.6.39-1.x86_64 has missing requires of perl(mtr_process.pl) mysql2-5.6.39-1.x86_64 has missing requires of perl(lib::mtr_gcov.pl) mysql2-5.6.39-1.x86_64 has missing requires of perl(lib::mtr_gprof.pl) mysql2-5.6.39-1.x86_64 has missing requires of perl(lib::mtr_io.pl) mysql2-5.6.39-1.x86_64 has missing requires of perl(lib::mtr_misc.pl) mysql2-5.6.39-1.x86_64 has missing requires of perl(lib::mtr_process.pl) mysql2-5.6.39-1.x86_64 has missing requires of perl(lib::v1/mtr_cases.pl) mysql2-5.6.39-1.x86_64 has missing requires of perl(lib::v1/mtr_gcov.pl) mysql2-5.6.39-1.x86_64 has missing requires of perl(lib::v1/mtr_gprof.pl) mysql2-5.6.39-1.x86_64 has missing requires of perl(lib::v1/mtr_im.pl) mysql2-5.6.39-1.x86_64 has missing requires of perl(lib::v1/mtr_io.pl) mysql2-5.6.39-1.x86_64 has missing requires of perl(lib::v1/mtr_match.pl) mysql2-5.6.39-1.x86_64 has missing requires of perl(lib::v1/mtr_misc.pl) mysql2-5.6.39-1.x86_64 has missing requires of perl(lib::v1/mtr_process.pl) mysql2-5.6.39-1.x86_64 has missing requires of perl(lib::v1/mtr_report.pl) mysql2-5.6.39-1.x86_64 has missing requires of perl(lib::v1/mtr_stress.pl) mysql2-5.6.39-1.x86_64 has missing requires of perl(lib::v1/mtr_timer.pl) mysql2-5.6.39-1.x86_64 has missing requires of perl(lib::v1/mtr_unique.pl) mysql2-5.6.39-1.x86_64 has missing requires of perl(mtr_io.pl) mysql2-5.6.39-1.x86_64 has missing requires of perl(mtr_misc.pl) mysql2-5.6.39-1.x86_64 has missing requires of perl(mtr_process.pl)说是我的mysql环境有问题,搞来搞去没成功 |
解决方法:到Jenkins仓库官网看下https://pkg.jenkins.io/redhat-stable/ 有什么版本可以用
sudo yum install jenkins-2.361.1
指定这个版本我就安装成功了
```
7. 启动Jenkins服务:
```
sudo service jenkins start
```
8. 配置Jenkins服务开机自启动:
```
sudo chkconfig jenkins on
```
9. 打开防火墙端口,允许Jenkins流量通过:
```
sudo firewall-cmd --zone=public --add-port=8080/tcp --permanent
sudo firewall-cmd --reload
```
10. 完成安装后,通过以下URL访问Jenkins Web界面:
```
http://your_server_ip:8080
```
11. 在首次访问时,您将需要提供Jenkins管理员密码。您可以通过以下命令找到该密码:
```
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
```
复制密码并粘贴到Jenkins Web界面中进行验证。
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· DeepSeek 开源周回顾「GitHub 热点速览」
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了