centos(linux)安装jenkins

官网:https://pkg.jenkins.io/redhat/

jdk版本要和jenkins对上!

安装官网进行操作:

powershell 复制代码
 sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat/jenkins.repo
 sudo rpm --import https://pkg.jenkins.io/redhat/jenkins.io-2023.key

若出现如下错误:

powershell 复制代码
sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo
--2022-02-25 16:02:30--  https://pkg.jenkins.io/redhat-stable/jenkins.repo
正在解析主机 pkg.jenkins.io (pkg.jenkins.io)... 151.101.74.133, 2a04:4e42:11::645
正在连接 pkg.jenkins.io (pkg.jenkins.io)|151.101.74.133|:443... 已连接。
错误: 无法验证 pkg.jenkins.io 的由 "/C=US/O=Let's Encrypt/CN=R3" 颁发的证书:
  颁发的证书已经过期。
要以不安全的方式连接至 pkg.jenkins.io,使用"--no-check-certificate"。

则根据提示在命令中添加--no-check-certificate参数,如下:

powershell 复制代码
sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat/jenkins.repo --no-check-certificate
powershell 复制代码
yum install jenkins

如果安装过程中包Errno 256 No more mirrors to try

执行命令yum clean all

yum makecache

然后重新执行yum install jenkins

卸载步骤

powershell 复制代码
service jenkins stop
 
yum clean all
 
yum -y remove jenkins

find / -iname jenkins | xargs -n 1000 rm -rf

# find命令用来查找"/"下名称符合jenkins的文件
#   -name name, -iname name : 文件名称符合 name 的文件。iname 会忽略大小写
 
# xargs 命令 可以将管道或标准输入(stdin)数据转换成命令行参数,也能够从文件的输出中读取数据。
#   -n 选项 每次传递几个参数给其后面的命令执行

查看yum仓库中,软件包有哪些版本

powershell 复制代码
yum --showduplicates list jenkins

选2.164的能运行支持jdk8

powershell 复制代码
yum install jenkins-2.164

centos7用命令sudo dnf install jenkins安装jenkins时报错如下:

" Public key for jenkins-2.249.1-1.1.noarch.rpm is not installed "

新增 --nogpgcheck 参数,实现不检查Public Key而强制安装, 命令如下:

powershell 复制代码
yum install jenkins-2.164 --nogpgcheck

启动:
service和systemctl的区别
https://blog.csdn.net/qq_38173650/article/details/130119142

直接启动:

jenkins start

后台启动:

powershell 复制代码
service jenkins start
systemctl start jenkins # 启动jenkins服务
# 然后开启另外一个窗口,查看jenkins状态
systemctl status jenkins # 查看jenkins状态
systemctl stop jenkins # 关闭jenkins服务

访问地址:http://127.0.0.1:8080

http://hadoop102:8080/

参考:
https://blog.csdn.net/qq_34208844/article/details/87865672/

  1. 找到自己的java安装地址
    如果忘记自己的java安装地址, 通过下面命令找到
powershell 复制代码
which java
  1. 修改jenkins的配置文件
    执行命令, 打开jenkins配置文件
powershell 复制代码
vi /etc/init.d/jenkins 

jenkins服务默认监听8080端口,打开文件/usr/lib/systemd/system/jenkins.service,可以修改端口号

powershell 复制代码
Environment="JENKINS_PORT=8080"


账号密码:

dcs 123456

相关推荐
YXXY31315 小时前
线程的介绍(四)
linux
kTR2hD1qb17 小时前
从 Responses API 到 Chat Completions:一个模型网关的设计复盘
linux·前端
姓刘的哦18 小时前
大模型祛魅
linux
hj28625119 小时前
linux下一步学习内容
linux·运维
xier_ran20 小时前
【infra之路】Linux基础命令与系统排查
linux·运维·服务器
zh路西法20 小时前
【Linux 串口通信】基于 C++ 多线程的同步/异步串口实现
linux·运维·c++·python
c2385620 小时前
linux基础2
linux·运维·服务器
子兮曰20 小时前
WSL 配 GPU 用 Docker 的折腾指南(2026 年版)
linux·前端·后端
vortex520 小时前
Linux 默认 SUID 可执行文件详解
linux·运维
2023自学中21 小时前
Linux虚拟机 CMakeLists.txt:x86 与 ARM 双架构编译脚本
linux·c语言·c++·嵌入式