当前位置:网站首页>jenkins搭建部署详细步骤
jenkins搭建部署详细步骤
2022-07-29 23:27:00 【机灵的小小子】
简介
Jenkins是一个开源软件项目,是基于Java开发的一种持续集成工具,用于监控持续重复的工作,旨在提供一个开放易用的软件平台,使软件项目可以进行持续集成。
功能
Jenkins功能包括:
1、持续的软件版本发布/测试项目。
2、监控外部调用执行的工作。
安装环境
关闭selinux和防火墙
sed -ri '/^[^#]*SELINUX=/s#=.+$#=disabled#' /etc/selinux/config
# systemctl stop firewalld
# systemctl disable firewalld
# 安装依赖包
yum -y install curl policycoreutils openssh-server openssh-clients postfix
#Jenkins安装配置
yum install fontconfig java-11-openjdk -y
wget https://repo.huaweicloud.com/jenkins/redhat-stable/jenkins-2.222.1-1.1.noarch.rpm
rpm -ivh jenkins-2.222.1-1.1.noarch.rpm
wget https://mirrors.tuna.tsinghua.edu.cn/jenkins/redhat/jenkins-2.360-1.1.noarch.rpm
rpm -ivh jenkins-2.360-1.1.noarch.rpm
查看java版本 版本必须为17至11的版本,否则Jenkins会报错启动不来
[[email protected] ~]# java -version
openjdk version "1.8.0_131"
OpenJDK Runtime Environment (build 1.8.0_131-b12)
OpenJDK 64-Bit Server VM (build 25.131-b12, mixed mode)
[[email protected] ~]# alternatives --config java
共有 2 个提供“java”的程序。
选项 命令
-----------------------------------------------
*+ 1 java-1.8.0-openjdk.x86_64 (/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.131-11.b12.el7.x86_64/jre/bin/java)
2 java-11-openjdk.x86_64 (/usr/lib/jvm/java-11-openjdk-11.0.15.0.9-2.el7_9.x86_64/bin/java)
按 Enter 保留当前选项[+],或者键入选项编号:2
[[email protected] ~]# vi /etc/profile.d/java.sh
JAVA_HOME="/usr/lib/jvm/java-11-openjdk"
[[email protected] ~]# source /etc/profile
[[email protected] ~]# echo $JAVA_HOME
/usr/lib/jvm/java-11-openjdk
[[email protected] ~]#
启动jenkins服务
[[email protected] ~]# systemctl start jenkins
[[email protected] ~]# systemctl status jenkins.service
● jenkins.service - LSB: Jenkins Automation Server
Loaded: loaded (/etc/rc.d/init.d/jenkins; bad; vendor preset: disabled)
Active: active (running) since 四 2022-07-28 17:02:02 CST; 9s ago
Docs: man:systemd-sysv-generator(8)
Process: 1817 ExecStart=/etc/rc.d/init.d/jenkins start (code=exited, status=0/SUCCESS)
CGroup: /system.slice/jenkins.service
└─1838 /etc/alternatives/java -Dcom.sun.akuma.Daemon=daemonized -Djava.awt.headless=true -DJENKINS...
7月 28 17:02:02 localhost.localdomain systemd[1]: Starting LSB: Jenkins Automation Server...
7月 28 17:02:02 localhost.localdomain runuser[1822]: pam_unix(runuser:session): session opened for user j...=0)
7月 28 17:02:02 localhost.localdomain systemd[1]: Started LSB: Jenkins Automation Server.
7月 28 17:02:02 localhost.localdomain jenkins[1817]: Starting Jenkins [ 确定 ]
Hint: Some lines were ellipsized, use -l to show in full.
[[email protected] ~]#
查看端口是否起来
[[email protected] ~]# netstat -lnput
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp6 0 0 :::8080 :::* LISTEN 1838/java
查看初始密码
[email protected] ~]# cat /var/lib/jenkins/secrets/initialAdminPassword
563e90d361c34317823ddb764d9b2ec6
用IE浏览器打开 http://192.168.100.10:8080
提示选择安装插件,这里不选择安装任何插件,因为安装源在国外的网站,速度是十分慢还可能失败,后面配置安装插件的源
选择无,然后安装
创建管理员用户
会跳转到首页
插件配置
Jenkins->Manage Jenkins->Manage Plugins,点击Available,点击这里是为了把Jenkins官方的插件列表下载到本地,
往下拉
Manage Plugins点击Advanced,把Update Site改为国内插件下载地址
https://mirrors.tuna.tsinghua.edu.cn/jenkins/updates/update-center.json
修改
cd /var/lib/jenkins/updates
sed -i 's/http:\/\/updates.jenkinsci.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
[[email protected] ~]# cd /var/lib/jenkins/updates/
[[email protected] updates]# ls
default.json hudson.tasks.Maven.MavenInstaller
[[email protected] updates]# sed -i 's/http:\/\/updates.jenkinsci.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
[[email protected] updates]#
在浏览器输入: http://192.168.100.10:8080/restart ,重启Jenkins
重启中
汉化版本,搜索一个中文的插件,勾上,然后安装
开始下载汉化包,下载完成后重启Jenkins
汉化完成
然后点击自己想要的插件安装
取消告警
版本升级,因为有些插件安装不上去需要升级版本才能安装,下载Jenkins.war 文件
[[email protected] ~]# ps -aux | grep jenkins
jenkins 2937 12.6 31.9 3795520 1239792 ? Ssl 15:37 4:10 /etc/alternatives/java -Djava.awt.headless=true -DJENKINS_HOME=/var/lib/jenkins -jar /usr/lib/jenkins/jenkins.war --logfile=/var/log/jenkins/jenkins.log --webroot=/var/cache/jenkins/war --httpPort=8080 --debug=5 --handlerCountMax=100 --handlerCountMaxIdle=20
root 3441 0.0 0.0 112676 980 pts/1 S+ 16:11 0:00 grep --color=auto jenkins
[[email protected] ~]# systemctl stop jenkins #停止jenkins服务
[[email protected] ~]# cd /usr/lib/jenkins/ #进入jenkins.war运行路径
[[email protected] jenkins]# ls
jenkins.war
[[email protected] jenkins]# mv jenkins.war jenkins.war.bak #备份旧版本的jenkins.war
[[email protected] jenkins]# rz 上传新版本的Jenkins.war
[[email protected] jenkins]# ls
jenkins.war jenkins.war.bak
[[email protected] jenkins]# systemctl start jenkins #启动Jenkins
升级成功 更新到最新版本
安装插件 下载后缀为hpi结尾的文件 https://repo.huaweicloud.com/jenkins/plugins/github/latest/https://repo.huaweicloud.com/jenkins/plugins/github/latest/
上传插件
这样插件安装完成后重启,其他插件安装同样如此
jenkins的plugins目录下就会看到添加的插件,查看自己更新的插件
[[email protected] ~]# ls /var/lib/jenkins/plugins/ | grep git
git
git.bak
git-client
git-client.jpi
github
github-api
github-api.jpi
github.bak
github.jpi
git.jpi
[[email protected] ~]# cd /var/lib/jenkins/plugins/
[[email protected] plugins]# ls
apache-httpcomponents-client-4-api github.jpi jsch.jpi snakeyaml-api
apache-httpcomponents-client-4-api.jpi git.jpi localization-support snakeyaml-api.jpi
bouncycastle-api instance-identity localization-support.jpi ssh-credentials
bouncycastle-api.jpi instance-identity.bak localization-zh-cn ssh-credentials.jpi
caffeine-api instance-identity.jpi localization-zh-cn.jpi sshd
caffeine-api.jpi jackson2-api mailer sshd.bak
credentials jackson2-api.jpi mailer.bak sshd.jpi
credentials-binding jakarta-activation-api mailer.jpi structs
credentials-binding.jpi jakarta-activation-api.jpi mina-sshd-api-common structs.jpi
credentials.jpi jakarta-mail-api mina-sshd-api-common.jpi token-macro
display-url-api jakarta-mail-api.jpi mina-sshd-api-core token-macro.jpi
display-url-api.jpi javax-activation-api mina-sshd-api-core.jpi trilead-api
git javax-activation-api.bak okhttp-api trilead-api.bak
git.bak javax-activation-api.jpi okhttp-api.jpi trilead-api.jpi
git-client javax-mail-api plain-credentials workflow-scm-step
git-client.jpi javax-mail-api.bak plain-credentials.jpi workflow-scm-step.jpi
github javax-mail-api.jpi scm-api workflow-step-api
github-api jaxb scm-api.jpi workflow-step-api.jpi
github-api.jpi jaxb.jpi script-security
github.bak jsch script-security.jpi
[[email protected] plugins]#
[[email protected] plugins]#
边栏推荐
- Mysql内外连接
- 接口性能测试方案设计方法有哪些?要怎么去写?
- 1326. 灌溉花园的最少水龙头数目 动态规划
- WeChat applet sliding navigation bar (how to set the floating window of the webpage)
- 容器化数据库必经之道
- BGP Federal Comprehensive Experiment
- Jsp使用<c:forEach>遍历List集合「建议收藏」
- devops学习(八) 搭建镜像仓库---jenkins推送镜像
- The latest Gansu construction welder (construction special operation) simulation question bank and answer analysis in 2022
- MySQL Interview Questions: Detailed Explanation of User Amount Recharge Interview Questions
猜你喜欢
MySQL事务(transaction) (有这篇就足够了..)
Qt uses QSortFilterProxyModel for sorting and filtering in QML
信用卡又一新规来袭!菊风用科技助推金融行业提升服务质效
DNA脱氧核糖核酸修饰四氧化三铁|DNA修饰氧化锌|使用方法
Design for failure常见的12种设计思想
JetsonNano学习(五)JetsonNano 安装 PyTorch 及 Torchvision
【无标题】清空吗
容器化数据库必经之道
DFS对树的遍历及一些优化
Apache Doris 1.1 特性揭秘:Flink 实时写入如何兼顾高吞吐和低延时
随机推荐
MySQL【基本select语句】
2022年最新甘肃建筑施工焊工(建筑特种作业)模拟题库及答案解析
idea设置自动去除未引用(不再引用)的引用
【小程序项目开发-- 京东商城】uni-app之自定义搜索组件(下) -- 搜索历史
MySQL六脉神剑,SQL通关大总结
DFS对树的遍历及一些优化
单片机ds1302时钟程序(51单片机液晶显示程序)
WLAN笔记
JetsonNano learning (5) JetsonNano installs PyTorch and Torchvision
地狱挖掘者系列#1
超分之RVRT
MQTT over QUIC: The Next-Generation IoT Standard Protocol Brings New Impetus to Messaging Scenarios
2022年最新甘肃建筑八大员(材料员)模拟考试试题及答案
Another new rule for credit cards is coming!Juphoon uses technology to boost the financial industry to improve service quality and efficiency
【leetcode】50. Pow(x, n)(中等)(快速幂)
DNA修饰的上转换纳米材料|聚胞苷酸Poly-C DNA修饰的氧化石墨烯|解析说明
DNA脱氧核糖核酸修饰四氧化三铁|DNA修饰氧化锌|使用方法
Brute force recursion to dynamic programming 03 (knapsack problem)
Allure环境部署与生成+Allure内容增强
Override and customize dependent native Bean methods