官网: https://www.jenkins.io/
文中涉及的jenkins’s rpm链接: https://pan.baidu.com/s/1BSe62pGdJCtDUAimaniEMA?pwd=6666
一、Install & Check Java Env
Oracle官网下载Java: https://www.oracle.com/cn/
# 拷贝到Jenkins服务器
scp Downloads/jdk-8u391-linux-aarch64.tar.gz root@10.211.55.34:~
# 解压
mkdir -p /opt/java && tar -zxvf jdk-8u391-linux-aarch64.tar.gz -C /opt/java
# 配置
vim ~/.bash_profile
# 内容 BEGIN
export JAVA_HOME=/opt/java/jdk1.8.0_391
export JRE_HOME=/opt/java/jdk1.8.0_391/jre
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar
# 内容END
source ~/.bash_profile
[root@jenkins ~]# java -version
java version "1.8.0_391"
Java(TM) SE Runtime Environment (build 1.8.0_391-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.391-b13, mixed mode)
# 关闭防火墙
systemctl stop firewalld && systemctl disable firewalld
二、Add Jenkins Source & Install
Jenkins 2.357 及之后 LTS 版本开始,Jenkins 最低需要 Java 11。
scp Downloads/jenkins-2.249-1.1.noarch.rpm root@10.211.55.34:~
yum localinstall jenkins-2.249-1.1.noarch.rpm -y
# 修改jekins权限
vim /etc/sysconfig/jenkins
# JENKINS_USER="jenkins"
JENKINS_USER="root"
#JENKINS_PORT="8080"
JENKINS_PORT="80"
三、常用命令
# 启动
systemctl start jenkins
# 查看状态
systemctl status jenkins
# 设置开机启动
systemctl enable jenkins
四、测试访问
访问: http://jenkins.zhinian.com/
# 查看初始密码
[root@jenkins ~]# cat /var/lib/jenkins/secrets/initialAdminPassword
2bd6f5bda75a417983d38cdbc3db7271
这里我点击选择来安装
安装
保存并完成或选择使用admin登录,登录后改密码。
安装完成!
参考
https://mirrors.tuna.tsinghua.edu.cn/jenkins/redhat/
jenkins忽略升级警告: https://blog.csdn.net/DynastyRumble/article/details/105664566