This is the 20th day of my participation in the August More Text Challenge

If you’re a Java developer, the first thing you do when you get a new server is install the JDK. At the same time, this operation may not be particularly common, but also more complex, most of the time are found on the Internet, but in view of the online environment, many are not easy to use, so this paper recorded the whole process of the main installation of the building, to ensure that there is no exception, please rest assured to refer to.

1. Download jdk8

Suggest not to download from the official website, thief pull card, the following provide Baidu network disk address, interested in can be used. Link: pan.baidu.com/s/1HJ4ymw84… Extraction code: PFM3

2. Transplant the installation package

Bvsshclient-8.35.exe is used here, the software has a file transplant interface, if necessary, please download. Attached baidu network disk address.

Links:Pan.baidu.com/s/1lr59nOX0…Extraction code: H9MR

1. Create a /usr/local/java\ folder

mkdir /usr/local/java
Copy the code

2. In the Windows directory on the left, double-click the /usr/local/java directory.

Creating folders can also be done in the SSH tool.

3. Unzip

1. Access the /usr/local/java folder.

cd /usr/local/java
Copy the code

2. Decompress the package: tar ZXVF name

tar zxvf jdk-8u191-linux-x64.tar.gz
Copy the code

3. Delete the compressed package: Run the rm -f command to delete the compressed package.

Then use the Tab key to automatically complete the file name

4. Configure environment variables

1. Edit the /etc/profile file

vi /etc/profile
Copy the code

Environment variables are configured as follows:

Export JAVA_HOME = / usr/local/Java/jdk1.8.0 _191 export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar export PATH=$PATH:$JAVA_HOME/binCopy the code

Note: The JAVA_HOME directory is where you actually unzipped the JDK, so don’t miswrite it

Press I to save esc and then :wq

5. The configuration takes effect

Note: The configuration modification does not take effect immediately. Run the following statement to make the command take effect immediately.

source /etc/profile
Copy the code

6. Verify the installation

java -version
Copy the code

The installation is successful if the version number is displayed.

7. Common commands

Save command

Press ESC to jump into command mode, then: :w Save the file without exiting vi :w file Save the changes to file separately without exiting vi :w! Save the file forcibly without launching vi :wq and exit vi :wq! Forcibly save the file and exit vi :q If the file is not saved, exit vi :q! Forcibly exit vi :e! Discard all changes and edit from the last time you saved the fileCopy the code

Java Operation Commands

Check the JDK version: Java -version Check the Java execution PATH: which Java Check the JAVA_HOME PATH: echo $JAVA_HOME Card PATH Content: echo $PATHCopy the code