环境配置:
系统:CentOS 8
JAVA:1.8.0 【安装教程】
安装1、配置本地Yum安装源
wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo
[root@CentOS8 ~]# wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo --2021-11-29 16:21:26-- https://pkg.jenkins.io/redhat-stable/jenkins.repo Resolving pkg.jenkins.io (pkg.jenkins.io)... 151.101.110.133, 2a04:4e42:11::645 Connecting to pkg.jenkins.io (pkg.jenkins.io)|151.101.110.133|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 85 Saving to: ‘/etc/yum.repos.d/jenkins.repo’ /etc/yum.repos.d/jenkins 100%[================================>] 85 --.-KB/s in 0s 2021-11-29 16:21:28 (7.73 MB/s) - ‘/etc/yum.repos.d/jenkins.repo’ saved [85/85]
2、导入秘钥
rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
[root@CentOS8 ~]# rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
3、安装
yum install jenkins
[root@CentOS8 ~]# yum install jenkins Repository epel is listed more than once in the configuration Jenkins-stable 8.7 kB/s | 21 kB 00:02 Dependencies resolved. ================================================================================================================ Package Architecture Version Repository Size ================================================================================================================ Installing: jenkins noarch 2.303.3-1.1 jenkins 69 M Installing dependencies: daemonize x86_64 1.7.8-1.el8 epel 27 k Transaction Summary ================================================================================================================ Install 2 Packages Total download size: 69 M Installed size: 69 M
4、查看安装目录
rpm -ql jenkins
[root@CentOS8 ~]# rpm -ql jenkins /etc/init.d/jenkins /etc/logrotate.d/jenkins /etc/sysconfig/jenkins /usr/lib/jenkins /usr/lib/jenkins/jenkins.war /usr/sbin/rcjenkins /var/cache/jenkins /var/lib/jenkins /var/log/jenkins
5、启动jenkins服务并设置开机启动
systemctl start jenkins
systemctl enable jenkins
[root@CentOS8 ~]# systemctl start jenkins [root@CentOS8 ~]# systemctl enable jenkins jenkins.service is not a native service, redirecting to systemd-sysv-install. Executing: /usr/lib/systemd/systemd-sysv-install enable jenkins
卸载
# 停止jenkins服务
[root@CentOS8 ~]# systemctl stop jenkins
# 停止jenkins开机启动服务
[root@CentOS8 ~]# systemctl disable jenkins
# yum卸载jenkins
[root@CentOS8 ~]# yum -y remove jenkins
# 删除jenkins相关文件
[root@CentOS8 ~]# rm -rf /var/{lib,log,cache}/jenkins /usr/lib/jenkins /root/.jenkins
[root@CentOS8 ~]# rm -rf `sudo find /{etc,var,run} -name "jenkins*"`



