Gitlab安装
虚拟机可以关闭防火墙systemctl stop firewalld
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 cd /usr/local mkdir docker cd docker mkdir gitlab_docker docker search gitlab docker pull gitlab/gitlab-ce vim docker-compose.yml docker-compose up -d docker-compose logs -f # 进入容器内部查看初始密码 docker exec -it gitlab bash cat /etc/gitlab/initial_root_password
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 version: '3.1' services: gitlab: image: 'gitlab/gitlab-ce:latest' container_name: gitlab restart: always environment: GITLAB_OMNIBUS_CONFIG: | external_url '宿主机ip:8929' gitlab_rails['gitlab_shell_ssh_port'] = 2224 ports: - '8929:8929' - '2224:2224' volumes: - './config:/etc/gitlab' - './logs:/var/log/gitlab' - './data:/var/opt/gitlab'
Maven安装 1 2 3 tar -zxvf jdk.tar.gz -C /usr/local tar -zxvf maven.tar.gz -C /usr/local
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 <mirror > <id > alimaven</id > <name > aliyun maven</name > <url > http://maven.aliyun.com/nexus/content/groups/public/</url > <mirrorOf > central</mirrorOf > </mirror > <mirror > <id > alimaven</id > <mirrorOf > central</mirrorOf > <name > aliyun maven</name > <url > http://maven.aliyun.com/nexus/content/repositories/central/</url > </mirror > <profile > <id > jdk8</id > <activeByDefault > true</activeByDefault > <jdk > 1.8</jdk > <properties > <maven.compiler.source > 1.8</maven.compiler.source > <maven.compiler.target > 1.8</maven.compiler.target > <maven.compiler.compilerVersion > 1.8</maven.compiler.compilerVersion > </properties > </profile > <activeProfiles > <activeProfile > jdk8</activeProfile > </activeProfiles >
Jenkins安装 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 # 去官网(jenkins.io)中寻找到Jenkins的LTS版本 docker pull jenkins/jenkins:2.332.2-lts(实时更新) cd /usr/local mkdir docker cd docker mkdir jenkins_docker cd jenkins_docker vim docker-compose.yml docker-compose up -d # 查看日志会发现data没有权限写文件 docker logs -f jenkins # 修改data权限 chmod -R 777 data docker-compose restart # 再次查看日志可以看到初始化密码 docker logs -f jenkins
1 2 3 4 5 6 7 8 9 10 version: "3.1" services: jenkins: image: jenkins/jenkins:2.332.2-lts container_name: jenkins ports: - 8080 :8080 - 50000 :50000 volumes: - ./data/:/var/jenkins_home/
第一次运行Jenkins初始化会花费很长时间 宿主机ip:8080
,Jenkins首次安装推荐插件出错 No such plugin: cloudbees-folder
Jenkins首次安装推荐插件出错 No such plugin: cloudbees-folder 超详细解决方案
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 <?xml version='1.1' encoding='UTF-8'?> <sites > <site > <id > default</id > <url > https://updates.jenkins.io/update-center.json</url > </site > </sites > <?xml version='1.1' encoding='UTF-8'?> <sites > <site > <id > default</id > <url > http://mirror.esuni.jp/jenkins/updates/update-center.json</url > </site > </sites >
1 2 3 4 5 # 再次重启Jenkins容器,访问Jenkins docker-compose restart # 查看密码登录Jenkins,并登录下载插件 docker exec -it jenkins\ cat /var/jenkins_home/secrets/initialAdminPassword
进入Jenkins后安装 Git Parameter
和 Publish Over SSH
插件
1 2 3 4 # 通过数据卷将jdk和maven映射到/var/jenkins_home/中 cd /usr/local/docker/jenkins_docker/data mv /usr/local/jdk ./ mv /usr/local/maven ./
配置jdk
配置maven
配置OpenSSL