1. Copy the JDK to the installation directory
(1) Assuming that the JDK installation file is on the desktop, the installation directory that we specified is:/usr/local/java. However, after the system installed in the/usr/local and there is no Java directory, which requires us to create a Java folder, (1)
(2) switch to the desktop, perform the copy, (2)
2. Installing the JDK
(1) switch to root user, (3)
(Note: If the authentication fails because of a forgotten password, you can first modify the root user password, then perform step (1), modify the root user password (4))
(2) running Jdk-6u30-linux-i586.bin, (5)
(Note: There may still be no execute permission at this time, because in Linux, the default permissions of the file is 644, even if the primary user does not have permission to execute, then we need to change their permissions, if you want to know the permissions of a file, you can go to the folder where the file is located, execute the command Ls–la view. Here to change the permissions of the Jdk-6u30-linux-i586.bin file to 777, that is, the owner of the file, the group of users and other users have all the permissions to the file, of course, it is not recommended to set the permissions on the system files, because this will undermine the security of Linux. )
Change Jdk-6u30-linux-i586.bin permissions, (6)
Change the permissions before performing step (2), when you see the situation, the installation is successful.
(3) At this time in the/usr/local/java directory, there is a jdk1.6.0_30 folder., you can check, (8)
3. Configure Environment variables
(1) Open/etc/profile file, (9)
(2) Add the following variables:
Java code
- #/etc/profile:system-wide. profile file for the Bourne Shell (Sh (1))
- # and Bourne compatible shells (Bash (1), Ksh (1), Ash (1), ...).
- #set Java Environment
- Export JAVA_HOME=/USR/LOCAL/JAVA/JDK1. 6. 0_30
- Export JRE_HOME=/USR/LOCAL/JAVA/JDK1. 6. 0_30/jre
- Export classpath=.: $JAVA _home/lib: $JRE _home/lib: $CLASSPATH
- Export path= $JAVA _home/bin: $JRE _home/bin: $JAVA _home: $PATH
(Note: For the convenience of future cluster work, it is recommended that each machine's Java environment is best consistent.) )
After you change the/etc/profile file generally, you need to restart the machine to take effect. Here is a method that does not have to be restarted to make it effective, (10)
(3) See if the Java environment variable is configured successfully, (11)
(Note: If the result is as shown, your Java installation is successful.) )
Install configuration JDK under Linux, detailed steps and graphics