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.下载插件

相关推荐
码农101号3 小时前
Linux中shell编程表达式和数组讲解
linux·运维·服务器
powerfulzyh4 小时前
非Root用户启动SSH服务经验小结
运维·ssh
云道轩4 小时前
升级centos 7.9内核到 5.4.x
linux·运维·centos
爱学习的小道长4 小时前
Ubuntu Cursor升级成v1.0
linux·运维·ubuntu
EelBarb4 小时前
seafile:ubuntu搭建社区版seafile12.0
linux·运维·ubuntu
402 Payment Required4 小时前
serv00 ssh登录保活脚本-邮件通知版
运维·chrome·ssh
小柏ぁ4 小时前
calico/node is not ready: BIRD is not ready: BGP not established with xxx
运维·docker·kubernetes
Mintimate5 小时前
云服务器 Linux 手动 DD 安装第三方 Linux 发行版:原理与实战
linux·运维·服务器
RussellFans5 小时前
Linux 环境配置
linux·运维·服务器
三劫散仙6 小时前
kubernetes jenkins pipeline优化拉取大仓库性能指定分支+深度
容器·kubernetes·jenkins