1、新建用户
个人习惯用户新用户去安装新技术插件,如果不喜欢可以省略。
# 新增加用户Jenkins,指定用户组为fordream,指定用户家目录为/home/jenkins
useradd -g fordream -d /home/jenkins jenkins
# 修改密码
passwd jenkins
2、安装jenkins
1.1 安装仓库
# 如果使用的是root用户,没必要用sudo
sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo
sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
注意:
如果已经导入过key,那么rpm –import命令会报错,无需理会即可。
1.2 安装
# 安装Jenkins,中途需要确认大小,输入y即可。
yum install jenkins
1.3 修改配置
(1)添加本地jdk配置目录
vi /etc/init.d/jenkins
修改
candidates="
/etc/alternatives/java
/usr/lib/jvm/java-1.8.0/bin/java
/usr/lib/jvm/jre-1.8.0/bin/java
/usr/lib/jvm/java-1.7.0/bin/java
/usr/lib/jvm/jre-1.7.0/bin/java
/usr/lib/jvm/java-11.0/bin/java
/usr/lib/jvm/jre-11.0/bin/java
/usr/lib/jvm/java-11-openjdk-amd64
/usr/bin/java
/usr/local/java/jdk1.8.0_231/bin/java # 此处添加本地jdk安装的java
"
**注意:**上面添加的是本地的java运行文件,不是安装地址或目录!
(2)修改Jenkins端口
vi /etc/sysconfig/jenkins
修改
JENKINS_PORT="8088" # 默认为8080,此处我修改为8088
1.4 安装记录
[root@localhost jenkins]# wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo
--2020-10-22 08:44:47-- https://pkg.jenkins.io/redhat-stable/jenkins.repo
Resolving pkg.jenkins.io (pkg.jenkins.io)... 151.101.230.133, 2a04:4e42:36::645
Connecting to pkg.jenkins.io (pkg.jenkins.io)|151.101.230.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 85
Saving to: ‘/etc/yum.repos.d/jenkins.repo’
100%[============================================================================================
版权声明:本文为yaozw0112原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。