一、JDK安装
1、查询yum下所有的java版
yum list java*
2、安装1.8免费版
yum install java-1.8.0-openjdk.x86_64
3、配置java环境
vim etc/profile
#set java environment
JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.232.b09-0.el7_7.x86_64
JRE_HOME=$JAVA_HOME/jre
CLASS_PATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib
PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
export JAVA_HOME JRE_HOME CLASS_PATH PATH
二、安装jenkins
wget -O https://repo.huaweicloud.com/jenkins/redhat-stable/jenkins-2.277.3-1.1.noarch.rpmhttps://mirrors.tuna.tsinghua.edu.cn/jenkins/redhat-stable/jenkins-2.319.3-1.1.noarch.rpm --no-check-certificate
rpm -ivh jenkins-2.319.3-1.1.noarch.rpm
此时会报缺少daemonize依赖,所以安装以下
yum install epel-release # repository that provides 'daemonize'
yum install -y daemonize
再执行rpm -ivh jenkins-2.319.3-1.1.noarch.rpm
修改用户和端口
vi /etc/sysconfig/jenkins
JENKINS_USER="root" //访问的用户
JENKINS_PORT="8088"
启动并查看状态
systemctl start jenkins
systemctl status jenkins
在浏览器中输入地址进行访问:http://81.70.34.26:8088/
因为jenkins插件需要连接默认官网下载,速度非常慢,而且会失败,所以我们暂时先跳出插件安装,选择【选择插件来安装】
选择无
设置用户名和密码和登录
注意:设置完用户名和密码后首次登录可能会出现空白页的问题 ,重启即可解决问题
https:ip:8088/restart
cat /var/lib/jenkins/secrets/initialAdminPassword
三、jenkins插件管理
1、jenKins下载地址更新
sed -i 's/http:\/\/updates.jenkins-ci.org\/download/https:\/\/mirrors.tuna.tsinghua.edu.cn\/jenkins/g' default.json
sed -i 's/http:\/\/www.google.com/https:\/\/www.baidu.com/g' default.json
https://mirrors.tuna.tsinghua.edu.cn/jenkins/updates/update-center.json
输入密码继续
卸载jenkins 1、rpm卸载 rpm -e jenkins 2、检查是否卸载成功 rpm -ql jenkins 3、彻底删除残留文件: find / -iname jenkins | xargs -n 1000 rm -rf