Install JDK on a Linux ECs instance
This article describes how to install JDK on a Linux ECs instance!
Environment: windows Server, Linux ECS (64-bit CentOS7), and JDK 8
Procedure:
1. Download JDK to a windows machine
Official Address: http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
Need to confirm your own Linux system bits, 32-bit download Linux x86 version (such as: jdk-8u45-linux-i586.tar.gz), 64-bit download Linux x64 version (such as: jdk-8u45-linux-x64.tar.gz)
2. Upload the JDK file to the Linux server.
Create a file directory java in the/usr/local/directory by Using ssh tools (none, such as WinSCP, upload the downloaded jdk package to the/usr/local/java directory.
3. decompress the JDK installation package
Decompress the JDK installation package through an ssh client (for example, SSH Secure Shell)
tar xvf jdk-8u45-linux-x64.tar.gz
4. Configure the JDK Environment
Edit the profile file in the/etc directory
Enter the following information at the end of the profile file, save and exit.
export JAVA_HOME=/usr/local/java/jdk1.8.0_45export JRE_HOME=/usr/local/java/jdk1.8.0_45/jreexport PATH=$PATH:/usr/local/java/jdk1.8.0_45/binexport CLASSPATH=./:/usr/local/java/jdk1.8.0_45/lib:/usr/local/java/jdk1.8.0_45/jre/lib
Vi ASSISTANT:
(1) line feed
Press esc + 'I "(letter), then press enter to wrap the line
(2) Save and exit/do not save and exit
Press esc + ':' (colon), enter q !, Press enter. Abandon the change and exit.
Press esc + ':' (colon), enter wq, and press Enter. Save changes and exit.
5. Restart the Linux System
Restart the system using ECs management tools
6. Check the installation status. java-version can check the jdk version!