Linux教程

002-Devops Practice-Jenkins,Maven

本文主要是介绍002-Devops Practice-Jenkins,Maven,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
  • install jenkins
    https://www.jenkins.io/download/
    https://hub.docker.com/r/jenkins/jenkins/tags?page=1&name=2.361.1
[root@devops ~]# docker pull jenkins/jenkins:2.361.1-lts
[root@devops ~]# cat devops/jenkins/docker-compose.yaml
version: '3.3'
services:
  jenkins:
    image: jenkins/jenkins:2.361.1-lts
    restart: unless-stopped
    privileged: true
    user: root
    ports:
      - 8080:8080
    container_name: jenkins
    volumes:
      - /root/devops/jenkins:/var/jenkins_home
      - /var/run/docker.sock:/var/run/docker.sock
      - /usr/bin/docker:/usr/bin/docker
[root@devops ~]# cd devops/jenkins/ && docker-compose up -d
[root@devops jenkins]# docker-compose logs
[root@devops ~]# docker exec -it jenkins cat /var/jenkins_home/secrets/initialAdminPassword
104544c40af646a3958275f8c5edef04

After setup complete,then install plugin: Publish Over SSH Git Parameter Kubernetes

  • install maven
    https://maven.apache.org/download.cgi
[root@devops devops]# wget https://dlcdn.apache.org/maven/maven-3/3.8.6/binaries/apache-maven-3.8.6-bin.tar.gz
[root@devops devops]# tar -zxvf apache-maven-3.8.6-bin.tar.gz && mv apache-maven-3.8.6 maven
[root@devops devops]# vim maven/conf/settings.xml   # appends below settings to xml file
  <mirrors>
    <mirror>
    <id>aliyunmaven</id>
    <mirrorOf>central</mirrorOf>
    <name>aliyun maven</name>
    <url>https://maven.aliyun.com/repository/public </url>
    </mirror>
  </mirrors>
  <profile>
    <id>jdk8</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>jdk8</activeProfile>
  </activeProfiles>
# we will need maven in jenkins later
  • install Jdk1.8
    https://www.oracle.com/java/technologies/javase/javase8-archive-downloads.html
[root@devops devops]# wget https://download.oracle.com/otn/java/jdk/8u202-b08/1961070e4c9b4e26a04e7f5a083f551e/jdk-8u202-linux-x64.tar.gz?AuthParam=1662820870_bc2da312076fc5255286e57081c6a475
[root@devops devops]# tar -zxvf jdk-8u202-linux-x64.tar.gz && mv jdk1.8.0_202 jdk8
# We will need jdk in jenkins later as well
[root@devops devops]# mv maven/ jdk8/ jenkins/ # move maven and jdk to jenkins home, jdk and maven can be found from jenkins dashboard
这篇关于002-Devops Practice-Jenkins,Maven的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!