jenkins部署

 

jenkins部署有很多种方式,我选择快捷简单方式

域名方式:

yum部署jenkins
1、安装JDK,已安装忽略
yum install -y java 

2、安装jenkins
# 添加Jenkins库到yum库,Jenkins将从这里下载安装。
wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo
rpm --import https://jenkins-ci.org/redhat/jenkins-ci.org.key
yum install -y jenkins
vi /etc/sysconfig/jenkins

找到修改端口号:
JENKINS_PORT="8080" #此端口不冲突可以不修改

systemctl enable jenkins && systemctl start jenkins && systemctl status jenkins

查看密码:
cat /var/jenkins/secrets/initialAdminPassword

 

docker部署

yum install -y epel-release
yum install -y yum-utils
yum-config-manager \
  --add-repo \
  https://download.docker.com/linux/centos/docker-ce.repo
yum install -y docker-ce-19.03.9 docker-ce-cli-19.03.9 containerd.io docker-compose

mkdir -p /etc/docker/
mkdir -p /data/docker
cat >/etc/docker/daemon.json  <<EOF
{
  "log-driver":"json-file",
  "log-opts": {"max-size":"200m", "max-file":"10"}
}
EOF
cat /etc/docker/daemon.json
systemctl enable docker && systemctl start docker
mkdir -p /data/jenkins
cd /data/jenkins
cat >/data/jenkins/jenkins.yml <<EOF
version: '3'
services:
  jenkins:
    image: jenkins/jenkins:lts
    container_name: jenkins
    restart: always
    ports:
      - 8080:8080
      - 50000:50000
    volumes:
      - /etc/localtime:/etc/localtime
      - /data/jenkins:/var/jenkins_home
      - /var/run/docker.sock:/var/run/docker.sock
      - /usr/bin/docker:/usr/bin/docker
EOF
#查看密码
docker logs jenkins | grep -A 3 password

 

posted @ 2022-01-02 23:13  缺个好听的昵称  阅读(18)  评论(0编辑  收藏  举报