Mac M1 Parallels CentOS7.9 Install Jenkins

官网: https://www.jenkins.io/

一、Install & Check Java Env

Oracle官网下载Java: https://www.oracle.com/cn/

# 拷贝到Jenkins服务器
scp Downloads/jdk-8u391-linux-aarch64.tar.gz [email protected]:~

# 解压
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 Rpm & Install

Jenkins 2.357 及之后 LTS 版本开始,Jenkins 最低需要 Java 11。
Jenkins下载地址: https://mirrors.jenkins-ci.org/redhat/

wget https://mirrors.jenkins-ci.org/redhat/jenkins-2.345-1.1.noarch.rpm --no-check-certificate

# 卸载需要rm -rf /var/lib/jenkins/* && rm -rf /etc/sysconfig/jenkins/*
yum localinstall jenkins-2.345-1.1.noarch.rpm -y
# 修改jekins权限
vim /etc/sysconfig/jenkins

# JENKINS_USER="jenkins"
JENKINS_USER="root"

#JENKINS_PORT="8080"
JENKINS_PORT="80"

gpasswd -a root jenkins

vim /usr/lib/systemd/system/jenkins.service
User=root
Environment="JENKINS_PORT=80"
systemctl daemon-reload
systemctl restart jenkins

三、常用命令

# 启动
systemctl start jenkins
 
# 查看状态
systemctl status jenkins
 
# 设置开机启动
systemctl enable jenkins

# 查看日志
journalctl -u jenkins

四、测试访问

访问: http://jenkins.zhinian.com/

# 查看初始密码
[root@jenkins ~]# cat /var/lib/jenkins/secrets/initialAdminPassword
554747f64c1546b19388c65b3c990a3b

这里我点击选择来安装

安装
Mac M1 Parallels CentOS7.9 Install Jenkins_第1张图片

保存并完成或选择使用admin登录,登录后改密码。



安装完成!

Manage Jenkins → Configure System → Administrative monitors configuration
取消Update更新警告,Save、Apply

cd /var/lib/jenkins/updates
sed -i 's/http:\/\/updates.jenkins-ci.org\/download/https:\/\/mirrors.tuna.tsinghua.edu.cn\/jenkins/g' default.json && sed -i 's/http:\/\/www.google.com/https:\/\/www.baidu.com/g' default.json
# Plugin Manager URL替换
# https://mirrors.tuna.tsinghua.edu.cn/jenkins/updates/update-center.json
systemctl restart jenkins

参考
https://mirrors.tuna.tsinghua.edu.cn/jenkins/redhat/
jenkins忽略升级警告: https://blog.csdn.net/DynastyRumble/article/details/105664566

你可能感兴趣的:(macos,jenkins,运维)