Help Center/ CodeArts Repo/ User Guide/ Managing Agent Pools/ Installing JDK, Git, and Docker on a Linux Host
Updated on 2026-01-28 GMT+08:00

Installing JDK, Git, and Docker on a Linux Host

Installing JDK

The following procedure uses jdk-8u144-linux-x64.tar.gz as an example to describe how to install JDK on a Linux host.

  1. Download the JDK from the official website and upload it to the Linux host.
  2. Run the following commands in sequence to decompress the source code package:

    1. Creating the java folder in /usr/local: sudo mkdir /usr/local/java
    2. Copying the downloaded package to java: cp jdk-8u144-linux-x64.tar.gz /usr/local/java
    3. Going to java: cd /usr/local/java
    4. Decompressing the package: sudo tar -xvf jdk-8u144-linux-x64.tar.gz
    5. Deleting the package: sudo rm jdk-8u144-linux-x64.tar.gz

  3. Set JDK environment variables.

    Modify /etc/profile, which is an environment variable shared by all users.

    1. Run the sudo vim /etc/profile command to open the /etc/profile file.
    2. Add the following code segment to the end of the file:
      export JAVA_HOME=/usr/local/java/jdk1.8.0_144
      export JRE_HOME=/usr/local/java/jdk1.8.0_144/jre
      export CLASSPATH=.:$JAVA_HOME/LIB/DT.JAR:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib:$CLASSPATH
      export PATH=$JAVA_HOME/bin:$PATH

      When adding the preceding code, pay attention to the following:

      • Do not add spaces before or after an equal sign (=).
      • Separate variables with colons (:), not semicolons (;).
    3. Press Esc, enter :wq!, and press Enter to save the modified file.
    4. Reload the /etc/profile file.
      source /etc/profile

  4. Run the java -version command to check whether the installation is successful.

    If the following information is displayed, installation is successful.

Installing Git

The following procedure uses git-1.8.3.1-23.el7_8.x86_64.rpm as an example to describe how to install Git on a Linux host.

  1. Download Git from the official website and upload it to the Linux host.
  2. Run the rpm -ivh git-1.8.3.1-23.el7_8.x86_64.rpm --nodeps command to decompress the source code package.
  3. Run the git --version command to check whether the installation is successful.

    If the following information is displayed, installation is successful.

Installing Docker

The following procedure uses docker-19.03.15.tgz as an example to describe how to install Docker on a Linux host.

  1. Download Docker from the official website and upload it to the Linux host.
  2. Run the following commands in sequence to decompress the source code package:

    1. Decompressing the package: tar zxvf docker-19.03.15.tgz
    2. Moving the docker package to /usr/bin/: mv ./docker/* /usr/bin/

  3. Modify the configuration file as follows:

    1. Run the vim /usr/lib/systemd/system/docker.service command to open the docker.service file.
    2. Press I and copy the following content to the file:
      [Unit]
      Description=Docker Application Container Engine
      Documentation=https://docs.docker.com
      After=network-online.target firewalld.service
      Wants=network-online.target
      
      [Service]
      Type=notify
      # the default is not to use systemd for cgroups because the delegate issues still
      # exists and systemd currently does not support the cgroup feature set required
      # for containers run by docker
      ExecStart=/usr/bin/dockerd
      ExecReload=/bin/kill -s HUP $MAINPID
      # Having non-zero Limit*s causes performance problems due to accounting overhead
      # in the kernel. We recommend using cgroups to do container-local accounting.
      LimitNOFILE=infinity
      LimitNPROC=infinity
      LimitCORE=infinity
      # Uncomment TasksMax if your systemd version supports it.
      # Only systemd 226 and above support this version.
      #TasksMax=infinity
      TimeoutStartSec=0
      # set delegate yes so that systemd does not reset the cgroups of docker containers
      Delegate=yes
      # kill only the docker process, not all processes in the cgroup
      KillMode=process
      # restart the docker process if it exits prematurely
      Restart=on-failure
      StartLimitBurst=3
      StartLimitInterval=60s
      
      [Install]
      WantedBy=multi-user.target
    3. Press Esc, enter :wq!, and press Enter to save the modified file.

  4. Run the following commands in sequence to restart Docker.

    systemctl daemon-reload

    systemctl enable docker.service

    systemctl restart docker.service

  5. Run the docker -v command to check whether the installation is successful.

    If the following information is displayed, installation is successful.