您的位置 首页 k8s

ubuntu安装jenkins (kubectl客户端安装)

ubuntu安装jenkins

Jenkins的安裝方式:
https://www.jenkins.io/doc/book/installing/

ubunut二进制部署Jenkins环境

1.设置字符集环境,方式后期Jenkins汉化

localectl set-locale LANG=en_US.UTF-8
echo $LANG

2.修改软件源

cat /etc/apt/sources.list
deb https://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse

deb https://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse

deb https://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse

# deb https://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
# deb-src https://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse

deb https://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse

参考链接:
https://developer.aliyun.com/mirror/ubuntu

3.部署jdk环境

netplan apply
apt-get update 
apt-get -y install openjdk-11-jdk-headless

检查一下:

java --version

4.安装Jenkins

apt-get install net-tools

 

dpkg -i jenkins_2.375.3_all.deb

jenkins集成k8s: https://url69.ctfile.com/d/253469-56666474-f8449b?p=2206 (访问密码: 2206)

 

5.查看Jenkins的初始化密码

systemctl status jenkins.service 

cat /var/lib/jenkins/secrets/initialAdminPassword
df639e8e9773456e92a5ce07ba54cc7b

 

6.访问Jenkins的webUI并使用上一步的密码进行登录

http://10.0.0.212:8080/

 

7.初始化密码

admin, 1

8.修改时区

9.修改Jenkins的运行账号

grep User /lib/systemd/system/jenkins.service
grep Group /lib/systemd/system/jenkins.service
sed -i '/User=/s#jenkins#root#' /lib/systemd/system/jenkins.service
sed -i '/Group=/s#jenkins#root#' /lib/systemd/system/jenkins.service

10.重启Jenkins验证运行用户是否修改成功

 systemctl daemon-reload
systemctl restart jenkins.service 

验证是否成功:

ps -ef | grep jenkins

 

11.修改Jenkins国内的镜像源

sed -i.bak 's#updates.jenkins.io/download#mirrors.tuna.tsinghua.edu.cn/jenkins#g' /var/lib/jenkins/updates/default.json
sed -i 's#www.google.com#www.baidu.com#g' /var/lib/jenkins/updates/default.json

12.将升级站点URL替换成国内的镜像地址

参考链接:
https://mirrors.tuna.tsinghua.edu.cn/jenkins/updates/

https://mirrors.tuna.tsinghua.edu.cn/jenkins/updates/update-center.json

 

systemctl restart jenkins.service 

13.配置Jenkins汉化

安装相关的插件:

dingtalk

git

webhook

ansible

 

 

pipeline

 

测试:

 

备注:

kubectl客户端安装 这一操作步骤忘记写了 。

欢迎来撩 : 汇总all

白眉大叔

关于白眉大叔linux云计算: 白眉大叔

热门文章