Had to do a fresh install of Sun’s Java on a remote Ubuntu machine this weekend. It’s pretty easy to do in a graphical environment, but I only had ssh access. Since I couldn’t find a set of instructions on how to install Sun’s Java from the command line, I thought I’d put together my own how-to.
You’ll use the apt-get command to grab the Sun java .deb files and install them. It works just like a command-line version of the Synaptic Package Manager you probably used to install software from the graphical environment.
But apt-get doesn’t know how to find the Sun Java files unless you add some sources to its repositories: a list of all the places apt-get looks for software.
Once you’ve added the repositories to the source list for apt-get, one command will install everything for you. Here’s a step-by-step way to do it:
- Type “nano /etc/apt/sources.list” to open a command-line text editor to edit the list of repositories apt-get will look through.
- You’ll see some lines, starting with “deb” or “deb-src” already in the file. Add the following lines to the file:
deb http://us.archive.ubuntu.com/ubuntu/ hardy universe
deb-src http://us.archive.ubuntu.com/ubuntu/ hardy universe
deb http://us.archive.ubuntu.com/ubuntu/ hardy-updates universe
deb-src http://us.archive.ubuntu.com/ubuntu/ hardy-updates universe
deb http://us.archive.ubuntu.com/ubuntu/ hardy multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ hardy multiverse
deb http://us.archive.ubuntu.com/ubuntu/ hardy-updates multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ hardy-updates multiverse - Press Ctrl-O to save the file. Press Return to agree to name the file sources.list, then press Ctrl-X to leave the editor.
- Type: “apt-get update”
- Type: “apt-get install sun-java6-jdk”
That should do it!
Hello, I can’t understand how to add your blog ( mindbat.com ) in my rss reader
————————
ad: http://cigace.ru/
LikeLike
I’ve just done some site re-organizing. You should see a link at the bottom of the page now to my RSS feed. Does that work?
LikeLike
Fantastic, this is the only properly working tutorial for installing Java on a new VPS that I’ve been able to find.
LikeLike
when i try to save the file it says Permission Denied!
Help!
LikeLike
Rick: you probably don’t have the right permissions to edit the file.
Try using “sudo nano /etc/apt/sources.list” in step one, and follow the directions from there.
LikeLike