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

相关推荐
未济2 天前
linux 配置环境变量
linux
傲世仙尊2 天前
目录即文件-Ext文件系统收尾篇
linux·c语言
_艾伦 耶格尔.2 天前
进程间通信
linux
Liuqy-052 天前
Linux IO编程——静态库、动态库
linux
彧azz2 天前
Linux 环境下 Redis 学习总结:数据类型、持久化、锁、事务、主从与缓存问题
linux·redis·笔记·学习·面试
-梅2 天前
linux(8) 软硬链接
linux·运维·服务器
AIgorithmGEEK2 天前
[Linux]线程三部曲(上):一个执行流的诞生——从操作系统一路拆到 pthread_create
linux·线程·pid
琥珀色糖2 天前
SimlpeHttp
linux·服务器
qeen872 天前
【Linux】操作系统之进程介绍(二)
linux·笔记·学习·进程
Zenova EdgeOS2 天前
Linux ss 工业边缘网络分析实战
linux·python·边缘计算·工业网关