安装jenkins

CentOS 7 安装 Jenkins

# 安装java
sudo yum install -y java-1.8.0-openjdk			# 根据jenkins 版本选择java8 或者java11
sudo yum install java-11-openjdk.x86_64 -y

# 安装jenkins
sudo curl https://pkg.jenkins.io/redhat-stable/jenkins.repo -o /etc/yum.repos.d/jenkins.repo
sudo yum install jenkins -y

# 启动
sudo systemctl enable jenkins.service --now

# 配置防火墙 firewall
sudo firewall-cmd --add-port=8080/tcp --permanent
sudo firewall-cmd --reload

war 包安装

yum install java-1.8.0-openjdk -y
useradd jenkins
wget https://mirrors.jenkins.io/war-stable/latest/jenkins.war -O /home/jenkins/jenkins.war

# 
cat > /home/jenkins/start.sh <<EOF
#!/bin/bash

HOST=0.0.0.0
PORT=8080
java -jar jenkins.war --httpListenAddress=$HOST --httpPort=$PORT &
EOF

# 
echo 'sh /home/jenkins/start.sh' >> /etc/rc.local

# 

yum 安装

sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo
sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key

yum install fontconfig java-11-openjdk
yum install jenkins

2.164 (2019-02) and newer: Java 8 or Java 11
2.54 (2017-04) and newer: Java 8
1.612 (2015-05) and newer: Java 7