当前位置: 首页 > news >正文

Anolis系统下安装Jenkins

1.安装java、maven

yum install -y java-17-openjdk-devel  maven git wget 

2.配置环境变量

1.查看java和maven所在目录

[root@localhost ~]# which java
/usr/bin/java
[root@localhost bin]# ll /usr/bin/java
lrwxrwxrwx 1 root root 22 41 17:20 /usr/bin/java -> /etc/alternatives/java
[root@localhost bin]# ll /etc/alternatives/java
lrwxrwxrwx 1 root root 66 42 10:02 /etc/alternatives/java -> /usr/lib/jvm/java-17-openjdk-17.0.14.0.7-3.0.2.an8.x86_64/bin/java
[root@localhost ~]# mvn -v
Apache Maven 3.5.4 (Red Hat 3.5.4-5)
Maven home: /usr/share/maven
Java version: 1.8.0_442, vendor: Red Hat, Inc., runtime: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.442.b06-2.0.2.an8.x86_64/jre
Default locale: zh_CN, platform encoding: UTF-8
OS name: "linux", version: "5.10.134-16.2.axs8.x86_64", arch: "amd64", family: "unix"
#如果存在多个java版本,切换自己需要的java版本执行
sudo alternatives --config java

2.配置环境变量

vi /etc/profile
添加以下内容:
JENKINS_JAVA_CMD="/usr/lib/jvm/java-17-openjdk-17.0.14.0.7-3.0.2.an8.x86_64/bin"
export MAVEN_HOME=/usr/share/maven
export PATH=$PATH:$MAVEN_HOME/bin

在这里插入图片描述

3.下载jenkins

[root@localhost ~]# wget https://repo.huaweicloud.com/jenkins/redhat-stable/jenkins-2.479.2-1.1.noarch.rpm
--2025-04-01 16:34:13--  https://repo.huaweicloud.com/jenkins/redhat-stable/jenkins-2.479.2-1.1.noarch.rpm
正在解析主机 repo.huaweicloud.com (repo.huaweicloud.com)... 116.130.221.26, 116.130.221.25, 116.130.221.22
正在连接 repo.huaweicloud.com (repo.huaweicloud.com)|116.130.221.26|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:90991760 (87M) [application/octet-stream]
正在保存至: “jenkins-2.479.2-1.1.noarch.rpm”jenkins-2.479.2-1.1.noarch.rpm            100%[======================================================================================>]  86.78M  45.0MB/s  用时 1.9s    2025-04-01 16:34:15 (45.0 MB/s) - 已保存 “jenkins-2.479.2-1.1.noarch.rpm” [90991760/90991760])[root@localhost ~]# 

4.安装jenkins

[root@localhost ~]# rpm -ivh jenkins-2.479.2-1.1.noarch.rpm 
警告:jenkins-2.479.2-1.1.noarch.rpm: 头V4 RSA/SHA512 Signature, 密钥 ID 45f2c3d5: NOKEY
准备中...                          ################################# [100%]
正在升级/安装...1:jenkins-2.479.2-1.1              ################################# [100%]
[root@localhost ~]# 

5.开启8080端口

firewall-cmd --zone=public --add-port=8080/tcp --permanent
systemctl restart firewalld   #重启

6.设置jenkins开机自启

[root@localhost ~]# systemctl status jenkins.service 
● jenkins.service - Jenkins Continuous Integration ServerLoaded: loaded (/usr/lib/systemd/system/jenkins.service; disabled; vendor preset: disabled)Active: inactive (dead)
[root@localhost ~]# systemctl start jenkins.service 
[root@localhost ~]# systemctl enable jenkins.service 
Synchronizing state of jenkins.service with SysV service script with /usr/lib/systemd/systemd-sysv-install.
Executing: /usr/lib/systemd/systemd-sysv-install enable jenkins
Created symlink /etc/systemd/system/multi-user.target.wants/jenkins.service → /usr/lib/systemd/system/jenkins.service.
[root@localhost ~]# systemctl status jenkins.service 
● jenkins.service - Jenkins Continuous Integration ServerLoaded: loaded (/usr/lib/systemd/system/jenkins.service; enabled; vendor preset: disabled)Active: active (running) since Tue 2025-04-01 16:44:33 CST; 23s agoMain PID: 988053 (java)Tasks: 65 (limit: 99900)Memory: 1.8GCGroup: /system.slice/jenkins.service└─988053 /usr/bin/java -Djava.awt.headless=true -jar /usr/share/java/jenkins.war --webroot=/var/cache/jenkins/war --httpPort=80804月 01 16:44:11 localhost.localdomain jenkins[988053]: Please use the following password to proceed to installation:
4月 01 16:44:11 localhost.localdomain jenkins[988053]: 8a4c57a69f2046b78e18467cf1983299
4月 01 16:44:11 localhost.localdomain jenkins[988053]: This may also be found at: /var/lib/jenkins/secrets/initialAdminPassword
4月 01 16:44:11 localhost.localdomain jenkins[988053]: *************************************************************
4月 01 16:44:33 localhost.localdomain jenkins[988053]: 2025-04-01 08:44:33.685+0000 [id=57]        INFO        jenkins.InitReactorRunner$1#onAttained: Completed initiali>
4月 01 16:44:33 localhost.localdomain jenkins[988053]: 2025-04-01 08:44:33.719+0000 [id=30]        INFO        hudson.lifecycle.Lifecycle#onReady: Jenkins is fully up an>
4月 01 16:44:33 localhost.localdomain systemd[1]: Started Jenkins Continuous Integration Server.
4月 01 16:44:35 localhost.localdomain jenkins[988053]: 2025-04-01 08:44:35.914+0000 [id=83]        INFO        h.m.DownloadService$Downloadable#load: Obtained the update>
4月 01 16:44:35 localhost.localdomain jenkins[988053]: 2025-04-01 08:44:35.915+0000 [id=83]        INFO        hudson.util.Retrier#start: Performed the action check upda>
4月 01 16:44:35 localhost.localdomain jenkins[988053]: 2025-04-01 08:44:35.916+0000 [id=83]        INFO        hudson.model.AsyncPeriodicWork#lambda$doRun$1: Finished Do>[root@localhost ~]# 

7.查看默认登录密码

[root@localhost ~]# cat /var/lib/jenkins/secrets/initialAdminPassword
8a4c57a69f2046b78e18467cf1983299

8.浏览器访问Jenkins登录(访问连接:http://IP:8080)

在这里插入图片描述
因为没有配置Jenkins的yum源,所以我们选择插件来安装
默认选择无,安装完成后在下载插件
输入用户名和密码,点击保存并完成
点击保存并完成
点击开始使用Jenkins
已完成安装Jenkins,下面来设置中文显示和安装所需的插件

9.Jenkins设置中文显示

点击 Dashboard>Manage Jenkins>Manager Plugin
下载
Localization: Chinese (Simplified)
Locale localization-support
在这里插入图片描述

10.下载插件


http://www.mrgr.cn/news/96784.html

相关文章:

  • 检查是否存在占用内存过大的SQL
  • Unity中 粒子系统使用整理(一)
  • Vue3.5 企业级管理系统实战(十二):组件尺寸及多语言实现
  • Cesium学习(未完继续)
  • 虚幻5入门
  • 【目标检测】【深度学习】【Pytorch版本】YOLOV2模型算法详解
  • vue3使用v-md-editor完成Markdown内容展示
  • 01_使用Docker将Coding上项目部署到k8s平台
  • 编译玄铁处理器RISC-V指令测试用例
  • EasyExcel导出导入excel工具类
  • Go+Gin实现安全多文件上传:带MD5校验的完整解决方案
  • MySQL 进阶 面经级
  • 一起学习大语言模型-常用命令及模型介绍
  • 2023第十四届蓝桥杯大赛软件赛省赛C/C++ 大学 B 组(真题题解)(C++/Java题解)
  • 41、当你在 index.html 中引用了一个公共文件(比如 common.js),修改这个文件后,用户访问页面时仍然看到旧内容,因为浏览器缓存了旧版本
  • Kafka 4.0入门到熟练
  • 41.C++哈希6(哈希切割/分片/位图/布隆过滤器与海量数据处理场景)
  • ML 聚类算法 dbscan|| OPTICS
  • 【C++】vector常用方法总结
  • Springboot学习笔记3.28