Anolis系统下安装Jenkins

1.安装java、maven

bash 复制代码
yum install -y java-17-openjdk-devel  maven git wget 

2.配置环境变量

1.查看java和maven所在目录

bash 复制代码
[root@localhost ~]# which java
/usr/bin/java
[root@localhost bin]# ll /usr/bin/java
lrwxrwxrwx 1 root root 22 4月   1 17:20 /usr/bin/java -> /etc/alternatives/java
[root@localhost bin]# ll /etc/alternatives/java
lrwxrwxrwx 1 root root 66 4月   2 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.配置环境变量

bash 复制代码
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

bash 复制代码
[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

bash 复制代码
[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端口

bash 复制代码
firewall-cmd --zone=public --add-port=8080/tcp --permanent
systemctl restart firewalld   #重启

6.设置jenkins开机自启

bash 复制代码
[root@localhost ~]# systemctl status jenkins.service 
● jenkins.service - Jenkins Continuous Integration Server
   Loaded: 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 Server
   Loaded: loaded (/usr/lib/systemd/system/jenkins.service; enabled; vendor preset: disabled)
   Active: active (running) since Tue 2025-04-01 16:44:33 CST; 23s ago
 Main PID: 988053 (java)
    Tasks: 65 (limit: 99900)
   Memory: 1.8G
   CGroup: /system.slice/jenkins.service
           └─988053 /usr/bin/java -Djava.awt.headless=true -jar /usr/share/java/jenkins.war --webroot=/var/cache/jenkins/war --httpPort=8080

4月 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.查看默认登录密码

bash 复制代码
[root@localhost ~]# cat /var/lib/jenkins/secrets/initialAdminPassword
8a4c57a69f2046b78e18467cf1983299

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







9.Jenkins设置中文显示

点击 Dashboard>Manage Jenkins>Manager Plugin

下载

Localization: Chinese (Simplified)

Locale localization-support

10.下载插件

相关推荐
@郭小茶16 分钟前
docker-compose方式部署docker项目
运维·docker·容器
自由鬼28 分钟前
开源虚拟化管理平台Proxmox VE部署超融合
linux·运维·服务器·开源·虚拟化·pve
电星托马斯2 小时前
Linux系统CentOS 6.3安装图文详解
linux·运维·服务器·程序人生·centos
啞謎专家2 小时前
CentOS中挂载新盘LVM指南:轻松扩展存储空间,解决磁盘容量不足问题
linux·运维·服务器
s_little_monster2 小时前
【Linux】进程信号的捕捉处理
linux·运维·服务器·经验分享·笔记·学习·学习方法
一大Cpp2 小时前
Ubuntu与本地用户交流是两种小方法
linux·运维·ubuntu
小王不会写code2 小时前
CentOS 7 镜像源失效解决方案(2025年)
linux·运维·centos
zyplanke2 小时前
CentOS Linux升级内核kernel方法
linux·运维·centos
ghostwritten3 小时前
Docker Registry Clean
运维·docker·容器
niuniu_6663 小时前
简单的自动化场景(以 Chrome 浏览器 为例)
运维·chrome·python·selenium·测试工具·自动化·安全性测试