1 软件版本
2 基础环境安装
2.1 docker 安装
yum install -y docker-ce-20.10.16
systemctl start docker && systemctl enable docker
docker version
2.2 docker-compose 安装
curl -L https://get.daocloud.io/docker/compose/releases/download/1.29.2/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
# chmod +x /usr/local/bin/docker-compose
验证命令是否安装成功
# docker-compose version
2.3 java 安装
mkdir /usr/local/java && tar -zxvf jdk-8u211-linux-x64.tar.gz -C /usr/local/java/
vim /etc/profile (添加如下配置)
export JAVA_HOME=/usr/local/java/jdk1.8.0_211
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin
验证jdk 版本
[root@localhost ~]# java -version
java version "1.8.0_211"
Java(TM) SE Runtime Environment (build 1.8.0_211-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.211-b12, mixed mode)
2.4 Nodejs 安装
wget https://nodejs.org/download/release/v14.0.0/node-v14.0.0-linux-x64.tar.gz
tar xvf node-v14.0.0-linux-x64.tar.gz -C /usr/local/
cd /usr/local/ && mv node-v14.0.0-linux-x64 node
vim /etc/profile (添加如下配置)
export NODE_HOME=/usr/local/node
export PATH=$NODE_HOME/bin:$PATH
2.5 maven安装
wget https://dlcdn.apache.org/maven/maven-3/3.8.5/binaries/apache-maven-3.8.5-bin.tar.gz
# tar xvf apache-maven-3.8.5-bin.tar.gz -C /usr/local/
# cd /usr/local/ && mv apache-maven-3.8.5 maven3
# vim /etc/profile (添加如下配置)
export M3_HOME=/usr/local/maven3
export PATH=$PATH:$JAVA_HOME/bin:$M3_HOME/bin
2.6 gitlab安装
安装 Gitlab 所需组件
yum install -y curl policycoreutils openssh-server openssh-clients postfix policycoreutils-python
安装 Gitlab
wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-12.0.2-ce.0.el7.x86_64.rpm
yum -y localinstall gitlab-ce-12.0.2-ce.0.el7.x86_64.rpm
配置Gitlab访问地址
[root@localhost ~]# cat /etc/gitlab/gitlab.rb |grep ^external
external_url 'http://192.168.10.89'
改成实际IP地址,然后重置Gitlab
gitlab-ctl reconfigure
gitlab-ctl status
首次登录 Gitlab
使用重置后的密码登录GitLab
设置中文界面
配置新建项目,添加文件
配置免密克隆
ssh-keygen -t rsa
cat .ssh/id_rsa.pub
验证(克隆过程中不需要输入密码即可)
3 jenkins安装
1、创建/data/jenkins/data目录
# mkdir -p /data/jenkins/data
2、在/data/jenkins/目录下添加docker-compose.yml文件,文件内容如下
[root@localhost jenkins]# cat docker-compose.yml
version: '3.1'
services:
jenkins:
#image: jenkins/jenkins:lts
image: jenkins:2.340
volumes:
- /data/jenkins/data:/var/jenkins_home
- /run/docker.sock:/var/run/docker.sock
- /usr/bin/docker:/usr/bin/docker
- /usr/local/maven3:/usr/local/maven3
- /usr/local/node:/usr/local/node
- /usr/local/java/jdk1.8.0_211:/opt/java/openjdk
ports:
- "8080:8080"
- "50000:50000"
restart: always
container_name: jenkins
user: root
environment:
JAVA_OPTS: '-Djava.util.logging.config.file=/var/jenkins_home/log.properties'
TZ : 'Asia/Shanghai'
启动jenkins
# docker-compose up -d
标签:bin,CI,compose,GitLab,usr,jenkins,Jenkins,docker,local From: https://www.cnblogs.com/vzhangxk/p/17297217.html