![](./write-blog/images/209650169-installing-and-configuring-jdk.png)
How to Install and Configure JDK: Step-by-Step Guide
Table of Content:
Installing from a Package on Linux
Step 1 : Become root.
If you're using an RPM-based Linux system (such as SuSE or RedHat), you can install the Java Development Kit from an RPM package. Make sure you've downloaded the You'll need to su to root (su root) so that you have the correct permission to install the package.
The file you downloaded should end with ".rpm"
This method assumes you know how to use basic Unix shell commands.
![](http://www.atnyla.com/library/images-tutorials/Installing from a Package on Linux1.jpg)
Step 2 : Remove earlier JDK package installations.
- rpm -e
![](http://www.atnyla.com/library/images-tutorials/Installing from a Package on Linux2.jpg)
Step 3 : Install the new package.
You'll be using the "rpm" command again, but this time with different flags:
-
rpm -ivh jdk-7u
-linux-x64.rpm (replace "jdk-7u-linux-x64.rpm" with the actual package name)
![](http://www.atnyla.com/library/images-tutorials/Installing from a Package on Linux3.jpg)
Step 4 : Delete the .rpm file.
When the package is finished installing, you'll be returned to the command line. If you want to conserve disk space, you can delete the downloaded package file with the
rm command.![](http://www.atnyla.com/library/images-tutorials/Installing from a Package on Linux4.jpg)
Installing from an Archive on Linux or Solaris
Step 1 : Open a terminal window.
If you downloaded an archived tarball of the JDK (it ends with *.tar.gz), use this method to complete the installation.
This method assumes you know how to use basic Unix shell commands.
If you downloaded a .rpm package file instead of a tarball, see Installing the JDK from a Package on Linux.
After downloading the Java Software Development Kit installer, double-click the downloaded file in the Downloads window of your web browser or in Finder.
![](http://www.atnyla.com/library/images-tutorials/Installing from an Archive on Linux or Solaris1.jpg)
Step 2 : Navigate to the directory where you'd like to install the JDK.
JDK in any directory for which you have "write" permissions. Note that only the root user can install the JDK to a system directory.
![](http://www.atnyla.com/library/images-tutorials/Installing from an Archive on Linux or Solaris2.jpg)
Step 3 : Move the *.tar.gz file to your current directory.
Use the mv command to get the archive file into the correct directory.
![](http://www.atnyla.com/library/images-tutorials/Installing from an Archive on Linux or Solaris3.jpg)
Step 4 : Unzip and install the JDK.
The command is different depending on your operating system (and in the case of Solaris, the processor type). Once installed, a new directory called "jdk
![](http://www.atnyla.com/library/images-tutorials/Installing from an Archive on Linux or Solaris4.jpg)
Step 5 : Delete the *.tar.gz file.
Use the rm command to delete the archive file if you want to conserve disk space.
![](http://www.atnyla.com/library/images-tutorials/Installing from an Archive on Linux or Solaris5.jpg)