JiaHe

相遇即是缘

Jenkins

yum安装

https://www.jenkins.io/doc/book/installing/linux/#red-hat-centos

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
sudo yum upgrade
sudo yum install jenkins java-11-openjdk-devel
sudo systemctl daemon-reload

rpm安装

wget https://mirrors.tuna.tsinghua.edu.cn/jenkins/redhat-stable/jenkins-2.164.2-1.1.noarch.rpm
rpm -ivh jenkins-2.164.2-1.1.noarch.rpm

Docker安装Jenkins

/home/docker/jenkins/docker-compose.yml
version: "3"
services:
jenkins:
image: jenkins/jenkins:lts
container_name: jenkins
restart: "always"
ports:
- "8080:8080"
- "50000:50000"
environment:
JAVA_OPTS: -Duser.timezone=Asia/Shanghai
volumes:
- /home/docker/jenkins/data:/var/jenkins_home
- /var/run/docker.sock:/var/run/docker.sock
- /usr/bin/docker:/usr/bin/docker
- /usr/local/jdk8u292-b10:/usr/local/jdk8u292-b10 # 挂载外部jdk路径,便于在jenkins中配置
- /usr/local/apache-maven-3.8.1:/usr/local/apache-maven-3.8.1 # 挂载外部maven路径,便于在jenkins中配置
# privileged: true
# user: root
# 准备好挂载的目录
mkdir -p /home/docker/jenkins/data
cd /home/docker/jenkins
docker-compose up -d