Step 2 of 10 Installing Java

Last updated on
30 April 2025

We are now going to install Java on the first remote Ubuntu Server.

Using your local home computer. Open TERMINAL. TERMINAL can be found under Ubuntu desktop panel menu > APPLICATIONS > TERMINAL
The TERMINAL window will open.
Type in the following command line. Then press RETURN key.

ssh root@10.1.2.3

(Note: In the above command replace “root” with your first server username and replace “10.1.2.3” with your first server IP address. This IP address is provided by your host provider.)
(Tips: You can copy and paste text or command line to TERMINAL using right click > Select COPY or PASTE)

You are now connected to your first remote server.

We will now update your repositories. Still in TERMINAL. Type in the following command line. Then press RETURN.

sudo apt-get update

Wait until TERMINAL returns the line “Reading package lists... Done ”. Then go to next step.

We will now install the latest updates if any. Still in TERMINAL. Type in the following command line. Then press RETURN.

apt-get upgrade

Wait. If any updates are available TERMINAL returns the line “Do you want to continue [Y/n]?”. Press Y key. Press RETURN key.

Wait until TERMINAL complete the update process. Then go to next step.

Still in TERMINAL. Type in the following command lines. Press RETURN key after each line. For now on we assume that you will press RETURN key after each command line.

sudo apt-get install sun-java6-jdk

Note that with updated repos you will be need the OPEN version of java6-jdk:

sudo apt-get install openjdk-6-jdk 

TERMINAL will return “Do you want to continue [Y/n]?”.
Press Y key. Then press RETURN key.

Wait until TERMINAL display a colour screen titled “Package configuration”.

Press the RIGHT ARROW key.

The word "OK" should now be highlighted in red.

Press RETURN key.

TERMINAL will ask “Do you agree with the DLJ licence terms?”.

Press the LEFT ARROW key.

“Yes” is now highlighted in red.

Press RETURN key.

You're now back to TERMINAL window. TERMINAL is now finishing installing Java. Wait until TERMINAL returns the line “ldconfig deferred processing now taking place ”.

Java is now installed.

We are now going to check the Java version.

In TERMINAL type in

java -version

Terminal will return your current Java package version. You need Java version 5 or higher otherwise it will NOT work. In my case I have the Java version 6 package (aka version 1.6.x):

java version "1.6.0_07" 
Java(TM) SE Runtime Environment (build 1.6.0_07-b06) 
Java HotSpot(TM) Client VM (build 10.0-b23, mixed mode, sharing) 

You have successfully installing Java on the first remote Ubuntu Server.

Help improve this page

Page status: Not set

You can: