Centos7-Install-Java8-Maven-Git-Gradle

Centos 7.* Java environment deployment configuration record

  • Read reminder, permission root. Do not imitate the online environment.

File storage location.

  • opt
    • backup
    • javahome
    • mavenhome
    • gradlehome
mkdir -p /opt/{backup,javahome,mavenhome,gradlehome}

Related basic program installation

  • install wget
yum -y install wget

Basic environment installation

  • install jdk
  • install maven
  • install git
  • install gradle

Install JDK

  • Check if the system has a JDK environment installed
java -version
rpm -qa | grep java
  • Download the Jdk installation package
cd /opt/backup  //切换目录
wget -c xxx //下载
  • decompress jdk
tar -zxvf jdk-8u151-linux-x64.tar.gz
  • Move the unzipped file
 mv ./jdk1.8.0_151/ javahome/
  • Open profile configuration file
vi /etc/profile
  • add content
export JAVA_HOME=/opt/javahome/jdk1.8.0_151
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/tools.jar
  • refresh configuration information
source /etc/profile
  • Check if the environment is configured successfully
java -version
java version "1.8.0_151"
Java(TM) SE Runtime Environment (build 1.8.0_151-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12, mixed mode)
  • The above content shows that the basic installation of the environment is successful.

Install Maven

  • Download the Mavan installation package

No source code, download the compiled one. Binary tar.gz archive

Unzip it and find that the one with the pom file is the source code.

cd /opt/backup  //切换目录
wget -c xxx
  • Unzip Maven
tar -zxvf apache-maven-3.5.0-bin.tar.gz
  • move files
mv ./apache-maven-3.5.0/ mavenhome/
  • Configure environment variables
export MAVEN_HOME=/opt/mavenhome/apache-maven-3.5.0
export PATH=${PATH}:${MAVEN_HOME}/bin
  • refresh configuration information
. /etc/profile
  • Check if the installation was successful
mvn -version

install git

  • source installation
yum -y install git
  • Check the installation
[root@localhost ~]# git version
git version 1.8.3.1
  • See the release notes that the installation was successful

Install Gradle

In terms of syntax, it is based on Groovy language ( Groovy is a JVM-based agile development language, which can be simply understood as a weakly typed version of strongly typed language java), and in project management, it is a project automation construction tool based on the concepts of Ant and Maven

  • download
cd /opt/backup  //切换目录
wget -c https://downloads.gradle.org/distributions/gradle-4.0.1-all.zip
  • decompress
unzip -d gradle-4.0.1-all.zip

Install it without unzip

yum -y install unzip
  • move files
mv ./gradle-4.0.1/ gradlehome/
  • Configure environment variables
vim /etc/profile
//添加
export GRADLE_HOME=/opt/gradlehome/gradle-4.0.1
export PATH=${PATH}:${GRADLE_HOME}/bin
  • Refresh the configuration to make it effective
source /etc/profile
  • Check if the installation was successful
gradle -v
[root@localhost opt]# gradle -v
  ------------------------------------------------------------
 Gradle 4.0.1
  ------------------------------------------------------------
Build time:   2017-07-07 14:02:41 UTC
Revision:     38e5dc0f772daecca1d2681885d3d85414eb6826
Groovy:       2.4.11
Ant:          Apache Ant(TM) version 1.9.6 compiled on June 29 2015
JVM:          1.8.0_161 (Oracle Corporation 25.161-b12)
OS:           Linux 3.10.0-514.el7.x86_64 amd64

END

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325145149&siteId=291194637
Recommended