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?
Best Answer
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:
Next install Java 1.6:
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: