1. Installation operation
We can use the xftp tool to upload the Java environment compressed package to the opt directory of the server, create a java directory in the opt directory, and set all permissions to the directory.
We can use xftp to operate through the interface UI interface, or through the command line.
Operation via shell command:
sudo mkdir java
sudo chown root java
sudo chgrp root java
Execute the command to extract the installation package of java13 to the /opt/java/ directory:
tar -zxvf jdk-13.0.1_linux-x64_bin.tar.gz -C /opt/java/
After decompression, you can see through xftp that a new jdk-13.0.1 directory has been added to the Java directory.
2. Configure environment variables
Modify/etc/profile file: execute vim command:
sudo vim /etc/profile
Append the following content below the file:
#set java environment
export JAVA_HOME=/opt/java/jdk-13.0.1
export PATH=${JAVA_HOME}/bin:${PATH}
Then save and exit
EnableJava environment to take effect, execute the command:
source /etc/profile
3. Check the installation results
Finally, execute the following command to confirm whether the Java environment is installed successfully:
java -version