Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm a complete linux beginner so please keep your answer understandable for a noob :) I wrote a little java servlet and, in order to run it, acquired a VPS which runs Centos 5.

now, in order to run my servlet I guess the first thing to do is to install the latest JRE. I have SSH access and googled the web for tutorials on how to install java through ssh but most of them are very old, have broken links, link to sun or are very confusing.

Can anyone give a simple step by step instruction on how to install the latest JRE through ssh?

and - could someone maybe also tell me how I can afterwards install my servlet and make sure that it's automatically run if the server is rebooted?

share|improve this question

2 Answers 2

First, get and install Java 1.6. It can be downloaded from Oracle: http://www.oracle.com/technetwork/java/javase/downloads/index.html

You can get either a binary file or a binary rpm file. The only difference is that one is installed directly and the other one using the rpm utility on Red Hat/CentOS. Go ahead with the binary (non-RPM) version.

Put the .bin file into /opt/java. This will also be the location where the JDKs are going to be installed.

In order to execute the binary files you must first make sure that they are executable by issuing the chmod command:

# chmod +x jdk-6u24-linux-x64.bin

Next install Java 1.6:

# ./ jdk-6u24-linux-x64.bin

Now you have Java available on the server. You need to set the environment variable JAVA_HOME and your path so that Java will be found and used correctly. Edit the file /etc/profile and add the following lines at the end:

export JAVA_HOME=/opt/java/jdk1.6.0_24
export PATH=$PATH:$JAVA_HOME/bin
share|improve this answer
    
hi and thanks. as i wrote i have only ssh access i can't just go to the webpage and download the install file –  Mat Mar 15 '11 at 12:53
    
While it's true that you can't open a graphical web browser, you can still download software. Your first option is to find the download link using your home computer, and then using "wget" on the server to download the software. Your second option is to download it on your home computer and then upload it to the server using SCP (or PSCP on Windows). –  Tom Purl Mar 15 '11 at 13:20

Here is a manual :) Java on Cent Os i think its better you read it first when you are a beginner.

share|improve this answer
    
hey! I saw this document already but it tells me to go to "download the proper package from sun" and then to " chmod that package to 755 to make it 'executable'". no idea what that means and it also seems to be outdated since sun is now oracle? also i can't download stuff through the browser i have only ssh access. one time i installed firefox on ubuntu and this was kind of a one-command thing (something like apt-get install firefox or so...) is there nothing comparable possible to install the jre? –  Mat Mar 15 '11 at 11:53
    
CentOS is different from Ubuntu. You should read something about the yum package manager. With yum you can install the necessary packages. You can see it in the manual. –  Stony Mar 15 '11 at 12:01
    
so can't you just tell me the proper command? will yum install java do? –  Mat Mar 15 '11 at 12:14
    
Yum is the package manager on CentOS. 98% of what you will install on a CentOS system will be installed using Yum. Therefore, like Stony said, you should first read up on how Yum works in general and then use it to install Java. –  Tom Purl Mar 15 '11 at 13:22
    
I think a bigger problem is that how Stephan says he have to go to the oracle site and download java and install it. –  Stony Mar 15 '11 at 13:59

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.