1 安装java环境

1, 上传.tar.gz文件到usr/local位置

tar -zxvf jdk-8u341-linux-x64.tar.gz

2, 配置环境变量

vi /etc/profile
export JAVA_HOME=/usr/local/jdk8
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH

source /etc/profile
# 测试java环境
java -version

2 安装maven环境

1, 上传.tar.gz文件到usr/local位置

tar -zxvf apache-maven-3.6.3-bin.tar.gz

2, 修改配置setting.xml, 添加镜像仓库, 添加jdk编译版本

<mirror>
  <id>nexus-aliyun</id>
  <mirrorOf>central</mirrorOf>
  <name>Nexus aliyun</name>
  <url><http://maven.aliyun.com/nexus/content/groups/public></url>
</mirror>
<profile>
  <id>jdk18</id>
  <activation>
    <activeByDefault>true</activeByDefault>
    <jdk>1.8</jdk>
  </activation>
  <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>jdk18</activeProfile>
</activeProfiles>

3, 配置环境变量

# 修改配置文件
vi /etc/profile
# 添加环境变量
export MAVEN_HOME=/usr/local/maven
export PATH=$PATH:$MAVEN_HOME/bin
# 重新加载配置
source /etc/profile
# 测试maven命令
mvn -v

3 安装jekins

# 拉jenkins镜像
docker pull jenkins/jenkins:2.332.1

# 进入指定目录
cd /usr/local/docker/jenkins_docker

# 编写docker-compose.yml文件
vi docker-compose.yml
# 添加如下内容
version: "3.1"
services: 
  jenkins:
    image: jenkins/jenkins:2.332.1
    name: jenkins
    restart: always
    ports: 
      - 8080:8080
      - 50000:50000
    volumes: 
      - ./data/:/var/jenkins_home/
# 给映射的./data文件夹赋权
chmod -R 777 /data
# 启动jenkins
docker-compose up -d