Home > Compute, Configure, Elastic Cloud Compute (EC2), How-to, Install, Linux > Install JAVA on Linux using rpm files

Install JAVA on Linux using rpm files

Steps for installing JAVA (JDK 6) on linux using rpm files:

1. Log into the linux shell and become root user by running the command

su –i

2. Change directory.

cd /opt

3. Please search at http://www.oracle.com/technetwork/java/javase/downloads/index.html for newer versions to download.

You can download to any directory you choose; it does not have to be the directory where you want to install the JDK. Before you download the file, notice its byte size provided on the download page on the web site. Once the download has completed, compare that file size to the size of the downloaded file to make sure they are equal.

To download use one of the below commands, depending on the server’s architecture (32/64 bit) :
64 bit:
wget http://download.oracle.com/otn-pub/java/jdk/6u31-b04/jdk-6u31-linux-x64-rpm.bin

32 bit:
wget http://download.oracle.com/otn-pub/java/jdk/6u31-b04/jdk-6u31-linux-i586-rpm.bin

4. Make sure that execute permissions are set in the self-extracting binary.
Enter ls –la to see the permissions for the file.

5. Run below command to grant execute permission to the file:

chmod a+x <<name-of-rpm-file-downloaded-earlier>>
For e.g.:
chmod +x jdk-6u25-linux-x64-rpm.bin\?e\=1306317438\&h\=294de0d36f54e28dd65fc8370e3c406d

6. Change directory to the location where you would like the files to be installed. The next step installs the JDK into the current directory.

7. Execute the downloaded file, prepended by the path to it.
For example, if the file is in the current directory, prepend it with “./”  :
For e.g.:


8. The binary code license is displayed, and you are prompted to agree to its terms.

9. Check if java is installed using command

java -version

The java version must be displayed correctly. You may also want to run commands like java or javac to check if installation is proper.

10. Execute below command to test if the JAVA_HOME environment variable is set.


It must display the location where java is installed.

11.  Delete the bin and rpm files if you want to save disk space.

rm -rf sun*


  1. May 20, 2012 at 7:50 am

    I’ve read some just right stuff here. Definitely price bookmarking for revisiting. I wonder how much effort you place to make this kind of excellent informative website.

    • May 20, 2012 at 3:19 pm

      Thank you. Hope this helps you in anyway. 🙂

  2. May 29, 2012 at 2:20 pm

    My brother suggested I might like this blog. He used to be entirely right. This publish truly made my day. You cann’t believe simply how much time I had spent for this information! Thanks!

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: