Jenkins安装

系统配置

节点jenkins配置
[root@localhost ~]# hostnamectl set-hostname jenkins
[root@localhost ~]# ip a|grep inet|grep -v inet6
    inet 127.0.0.1/8 scope host lo
    inet 192.168.73.115/24 brd 192.168.73.255 scope global dynamic noprefixroute ens160
[root@localhost ~]# cat /etc/redhat-release 
Red Hat Enterprise Linux release 9.1 (Plow)
节点jenkins-node1配置
[root@localhost ~]# hostnamectl set-hostname jenkins-node1
[root@localhost ~]#  ip a|grep inet|grep -v inet6
    inet 127.0.0.1/8 scope host lo
    inet 192.168.73.116/24 brd 192.168.73.255 scope global dynamic noprefixroute ens160
[root@localhost ~]#  cat /etc/redhat-release 
Red Hat Enterprise Linux release 9.1 (Plow)
节点jenkins-node2配置
[root@localhost ~]# hostnamectl set-hostname jenkins-node2
[root@localhost ~]#  ip a|grep inet|grep -v inet6
    inet 127.0.0.1/8 scope host lo
    inet 192.168.73.117/24 brd 192.168.73.255 scope global dynamic noprefixroute ens160
[root@localhost ~]#  cat /etc/redhat-release 
Red Hat Enterprise Linux release 9.1 (Plow)

jenkins安装

包位置
https://github.com/jenkinsci/jenkins/releases/download/jenkins-2.440/jenkins.war
数据存储及启动脚本
#!/bin/bash

# 设置数存储目录
# set JENKINS_HOME=/data/jenkins/jenkinsdata

# 启动
nohup java -jar /data/jenkins/jenkins.war >> /data/jenkins/jenkins.log &
设置数存储目录
[root@jenkins jenkins]# pwd
/data/jenkins
[root@jenkins jenkins]#  mkdir -p /data/jenkins/jenkinsdata
[root@jenkins jenkins]# useradd -s /sbin/nologin jenkins
[root@jenkins jenkins]# chown -R jenkins:jenkins /data/jenkins/jenkinsdata
[root@jenkins jenkins]# echo "export JENKINS_HOME=/data/jenkins/jenkinsdata" >> ~/.bashrc
[root@jenkins jenkins]# source ~/.bashrc
启动jenkins
[root@jenkins jenkins]# yum -y install java-11-openjdk.x86_64 
[root@jenkins jenkins]# chmod 755 start.sh 
[root@jenkins jenkins]# sh -x start.sh 
[root@jenkins jenkins]# tail -f jenkins.log
初始密码
[root@jenkins jenkins]# cat /data/jenkins/jenkinsdata/secrets/initialAdminPassword
14293137df58473484a585224ced15ce
访问地址
http://192.168.73.115:8080
添加jenkins节点
从节点安装jdk
[root@jenkins-node1 data]# yum -y install java-11-openjdk.x86_64
[root@jenkins-node2 data]# yum -y install java-11-openjdk.x86_64
主要节点配置ssh连接的环境
# 创建 known_hosts 文件
[root@jenkins jenkins]# mkdir -p /root/.ssh
[root@jenkins jenkins]# touch /root/.ssh/known_hosts

# 添加远程服务器的公钥
[root@jenkins jenkins]# ssh-keyscan -H 192.168.73.116 >> /root/.ssh/known_hosts
[root@jenkins jenkins]# ssh-keyscan -H 192.168.73.117 >> /root/.ssh/known_hosts

# known_hosts 文件授权
[root@jenkins jenkins]# chmod 644 /root/.ssh/known_hosts

创建从节点ssh连接的凭证

请添加图片描述

添加从节点

请添加图片描述
请添加图片描述
请添加图片描述

以同样的步骤添加节点jenkins-node2
节点添加成功

请添加图片描述

  • 6
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值