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

相关推荐
想你依然心痛4 小时前
Linux用户空间与内核空间通信:netlink、ioctl、mmap 零拷贝与性能对比
linux·运维·服务器
做个文艺程序员5 小时前
Linux第12篇:性能监控与瓶颈分析——CPU/内存/IO/网络全维度
linux·运维·网络
HAPPY酷5 小时前
【ROS2】 Conda 环境搭建(命令行版)
linux·运维·python·ubuntu·机器人·conda
sukioe7 小时前
【无标题】
后端·docker·centos
hai3152475437 小时前
九章空间几何对照直译法:通用芯片 / 定制专用芯片 编译适配规则
linux·汇编·bash
ton_tom7 小时前
设备驱动程序编程-Linux2.6.10-kdb安装-32位
linux·运维·服务器
dddwjzx7 小时前
嵌入式Linux C应用编程入门——进程 ( 二 )
linux·嵌入式
jieyucx9 小时前
【系统安全铁律】解密 Linux 权限三色数字密码:chmod 最小化赋权与生产环境避坑指南
linux·安全·系统安全·权限·chmod·777
AOwhisky10 小时前
Linux(CentOS)系统管理入门笔记(第四期)——文件系统(下篇):文件与目录操作实战——cpmvmkdirrmln
linux·运维·笔记·centos·云计算·文件系统
岑梓铭10 小时前
考研408《操作系统》复习笔记,第四章《4.2.2 文件操作、文件共享、文件保护》
linux·考研·操作系统·文件系统·408