Download first
jdk-11.0.14_linux-x64_bin.tar.gz installation package and apache-maven-3.6.3-bin.tar.gz installation package
yum install -y unzip zip download zip decompression tool (can also be ignored)
Then decompress the installation package through tar -zxvf jdk-11.0.14_linux-x64_bin.tar.gz -c /xx/xx (-c /xx/xx refers to the location of the decompressed file)
Then configure the environment variables
Execute the vim command to see if it is available.
rpm -qa|grep vim
If there are only one or two, download the vim command
Enter the rpm -qa|grep vim command to check the returned results. If three results are returned:
vim-minimal-7.0.109-6.el5
vim-common-7.0.109-7.2.el5
vim-enhanced-7.0.109-7.2.el5
It means that vim has been installed correctly. If one is missing, you need to install it separately.
2. Install one of them separately:
If one of the above three items is missing, such as vim-enhanced, use the command yum -y install vim-enhanced to install it:
yum -y install vim-enhanced
3. Reinstall all:
If none of the above three items are returned, you can directly use the yum -y install vim* command
yum -y install vim*
Then start editing environment variables and directly enter vim ~/.bash_profile to start editing.
export JAVA_HOME=/xxx/xxx/jdk-11.0.14
export PATH=$JAVA_HOME/bin:$PATH
export MAVEN_HOME=/xxx/xxx/apache-maven-3.6.3
export PATH=$MAVEN_HOME/bin:$PATH
After editing, enter source ~/.bash_profile to refresh the configuration file and then reopen a window.
Enter Java-version to display the version number and the configuration is successful.
Another recommended method is to create a new my_env.sh file in the /etc/profile.d/ directory and write the Java and maven environment variables in my_env.sh.
# JAVA_HOME
export JAVA_HOME=/opt/server/jdk-17.0.2
export PATH=$PATH:$JAVA_HOME/bin
#M2_HOME
export M2_HOME=/opt/server/apache-maven-3.6.3
export PATH=$PATH:$M2_HOME/bin
Then
source my_env.sh