Universal Method for Installing Java on Debian, Ubuntu, and CentOS

135

Where to Download Java

  1. Go to the Oracle website link and select the desired version of Java. This article will consider an example with Java 7:

    Image 1
    Image 1
  2. Among all available versions, you need to select for Linux x64, in .RPM format:

    Image 2
    Image 2
  3. You will be required to log in to your Oracle account. If you do not have one, please register:

    Image 3
    Image 3
  4. After you log into your account, the download of the selected Java will start automatically. Upload the downloaded file to your server using any convenient method such as SFTP/FTP.

How to Install Java

  1. Follow further instructions based on the operating system installed on your server:

    Debian and Ubuntu

    1. Update the packages: apt-get update
    2. Install Alien: apt-get install alien
    3. Install the previously downloaded Java in .RPM format: alien -i --scripts java_file.rpm. In the example, the command alien -i --scripts jdk-7u80-linux-x64.rpm is called, as the file is named jdk-7u80-linux-x64.rpm
    Image 4
    Image 4
    1. You can check the installed version of Java using the command java -version
    Image 5
    Image 5

    CentOS

    1. Update the packages: yum update
    2. Install the previously downloaded Java in .RPM format: rpm -ivh java_file.rpm. In the example, the command rpm -ivh jdk-7u80-linux-x64.rpm is called, as the file is named jdk-7u80-linux-x64.rpm
    3. You can check the installed version of Java using the command java -version
    Image 6
    Image 6
  2. Done! You are amazing!

We value your privacy

We use cookies and process your IP address to personalize content, detect your location for regional pricing, analyze site traffic, and show relevant ads. We share data with our analytics and advertising partners. Click "Accept All" to consent to all cookies, or "Reject All" to decline non-essential cookies. Some essential cookies will always be used for the site to function. Learn more in our Privacy Policy