jenkins安装
wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo rpm --import http://pkg.jenkins-ci.org/redhat/jenkins-ci.org.key yum install jenkins
也可以去官网下载jenkis的rmp包,官网下载地址(http://pkg.jenkins-ci.org/redhat-stable/)--> 或https://www.jenkins.io/download/
wget http://pkg.jenkins-ci.org/redhat-stable/jenkins-2.138.2-1.1.noarch.rpm rpm -ivh jenkins-2.150-1.1.noarch.rpm
查看安装文件位置
[root@danny src]# rpm -ql jenkins /etc/init.d/jenkins /etc/logrotate.d/jenkins /etc/sysconfig/jenkins /usr/lib/jenkins /usr/lib/jenkins/jenkins.war //升级备份时只需要备份此处即可,升级也是通过下载最新war包替换此处,如:tar -zvf jenkins.tar.gz /usr/lib/jenkins /usr/sbin/rcjenkins /var/cache/jenkins /var/lib/jenkins /var/log/jenkins
修改Jenkins配置文件(修改端口)
vim /etc/sysconfig/jenkins
修改启动文件jdk安装路径
vim /etc/init.d/jenkins
启动jenkins
[root@izm5edykqg8tzid352ga0iz src]# service jenkins start
Starting jenkins (via systemctl): [ OK ]
网页访问
IP+端口
之后按网页步骤安装即可
补充:2022-02-08
jenkins快速通过yum安装
环境:centos7.9 jdk1.8 jenkins 2.319
# 关闭selinux、防火墙 [root@jenkins-master ~]# setenforce 0 [root@jenkins-master ~]# systemctl disable firewalld [root@jenkins-master ~]# systemctl stop firewalld # 添加jenkins的官方yum源 [root@jenkins-master ~]# wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo [root@jenkins-master ~]# rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key # 安装java环境 [root@jenkins-master ~]# yum -y install java [root@jenkins-master ~]# yum -y install jenkins # 修改插件的源地址,默认官方地址,部分插件不可访问,这里换成清华的源 [root@jenkins-master ~]# sed -i 's/http:\/\/updates.jenkins-ci.org\/download/https:\/\/mirrors.tuna.tsinghua.edu.cn\/jenkins/g' /var/lib/jenkins/updates/default.json && sed -i 's/http:\/\/www.google.com/https:\/\/www.baidu.com/g' /var/lib/jenkins/updates/default.json # 启动jenkins [root@jenkins-master ~]# systemctl restart jenkins
备注:新版的jenkins好像要求jdk11以上
例:实验安装jenkins-2.401.2
需要安装使用jdk11 (jenkins安装还是使用上面的安装方式)
yum install java-11-openjdk-devel -y
可修改jenkins启动用户为root
vim /etc/sysconfig/jenkins
vim /usr/lib/systemd/system/jenkins.service #工作目录也在这里面修改
好记性不如烂笔头,最难不过坚持