阿里云ECS Centos8.0系统yum部署jenkins-2.277.3-1.1详情
一、系统环境描述:
1、阿里云ECS
2、系统版本Centos8.0,
内核Linux version 4.18.0-147.5.1.el8_1.x86_64 (mockbuild@kbuilder.bsys.centos.org) (gcc version 8.3.1 20190507 (Red Hat 8.3.1-4) (GCC))
3、Jenkins部署方式官方YUM源+KEY
4、Jenkins详细版本jenkins-2.277.3-1.1
5、JDK版本要求最好JDK1.8或以上,我这里用的jdk1.8.0.271
二、步骤:
1、检查JDK环境,如下命令查询是否安装
[root@it ~]# java -version
java version "1.8.0_271"
Java(TM) SE Runtime Environment (build 1.8.0_271-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.271-b09, mixed mode)
2、安装Jenkins,创建jenkins.repo仓库,导入公钥
[root@it ~]# sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo
--2021-04-22 10:52:50-- https://pkg.jenkins.io/redhat-stable/jenkins.repo
Resolving pkg.jenkins.io (pkg.jenkins.io)... 151.101.110.133, 2a04:4e42:1a::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.repo 100%[==============================================================>] 85 --.-KB/s in 0s
2021-04-22 10:52:51 (7.05 MB/s) - ‘/etc/yum.repos.d/jenkins.repo’ saved [85/85]
[root@it ~]# sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key ##导入公钥
3、安装Jenkins,执行如下命令,如下图所示表示安装成功
[root@it ~]# yum install jenkins -y
4、完善配置信息
[root@it ~]# vi /etc/sysconfig/jenkins
JENKINS_PORT="8089" ##修改自定义监听端口号,云服务器注意开启安全组放行,否则无法运行
[root@it ~]# echo $JAVA_HOME ##查看本机JDK安装路径
/usr/local/jdk1.8.0_271/bin/java
[root@it ~]# vi /etc/init.d/jenkins ##添加jdk运行路径至jenkins
5、启动、查看、重启、重载配置、开机自启等常用Jenkins命令依次(yum部署systemctl为标配),如下图所示,启动成功
[root@it ~]# systemctl start jenkins.service
[root@it ~]# systemctl status jenkins.service
[root@it ~]# systemctl daemon-reload
[root@it ~]# systemctl restart jenkins.service
[root@it ~]# systemctl enable jenkins.service
6、检查自定义端口是否启动监听状态
7、访问浏览器: http://IP:8089/ 出现如下视图
8、初始化,输入vi、cat出临时秘钥,继续...
[root@it ~]# cat /var/lib/jenkins/secrets/initialAdminPassword
0e588bf36e59e4e5693280d5e5a1de67798687687
然后直接选推荐安装的插件,或者直接下一步等待自动部署就完事儿
9、设置jenkin语言为中文
- 系统管理->插件管理->可用插件:安装Localization: Chinese (Simplified)插件,重启;
- 如果没有搜索到这个插件,就直接官网(https://github.com/jenkinsci/locale-plugin或者https://updates.jenkins.io/download/plugins/locale/)下载安装:
系统管理->插件管理->高级->上传插件,安装重启; - 系统管理->系统管理->locale language->输入zh_CN
10、卸载
[root@it ~]# rpm -e jenkins
warning: /etc/sysconfig/jenkins saved as /etc/sysconfig/jenkins.rpmsave
warning: /etc/init.d/jenkins saved as /etc/init.d/jenkins.rpmsave
[root@it ~]# systemctl stop jenkins
[root@it ~]# rpm -ql jenkins
[root@it ~]# find / -iname jenkins | xargs -n 1000 rm -rf
阿里云ECS Centos8.0系统yum部署jenkins-2.277.3-1.1详情
https://cn.10691.cn//archives/10022