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

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

黑蛋同志

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值