Install java 7, tomcat, etc. on CentOS


I would like to install Sun JDK 7, tomcat, ant, etc. on CentOS 5.5. Could anyone provide some instructions?

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jayachandran PalanisamyTechnical Consultant - LinuxCommented:

I hope following steps could help you.

Install JAVA:
yum install java-(version)

Open in new window

where (version) must be a valid version of the JDK.
cd /usr/local/src

Open in new window

(If your OS is 64bit)

Open in new window

(If you are running on 32bit)
rpm -ivh jdk-7u2-linux-x64.rpm

Open in new window

Note:  Read this doc to install Java.

To Install Ant:
To install check this URL.

Install Tomcat 7.x.x:
cd /usr/local/
tar -zxvf apache-tomcat-7.0.23.tar.gz
rm apache-tomcat-7.0.23.tar.gz
cd apache-tomcat-7.0.23/bin

Open in new window

You can find the version to download from the binary distribution HERE.

Next you must install tomcat native by downloading the source from here:
cd ~
mkdir installers && cd installers
tar -zxvf tomcat-native-1.1.22-src.tar.gz
rm tomcat-native-1.1.22-src.tar.gz
cd tomcat-native-1.1.22-src/jni/native
./configure --with-apr=/usr/bin/apr-1-config --with-java-home=/usr/local/java-1.7.2
*java-1.7.2 - your Java SDK installed path
make install

Open in new window

Next open up the (where it is probably located at /usr/share/apache-tomcat-7.0.23/bin/ and put export LD_LIBRARY_PATH="/usr/local/apr/lib" at the start of the file.

wsyyAuthor Commented:
Jay, thanks a bunch for providing so detailed info.

I wonder why I must install  tomcat native.
wsyyAuthor Commented:

*java-1.7.2 - your Java SDK installed path

I wonder if something is omitted here. The jdk path in my server is /opt/jdk

What should I will this "*java-1.7.2"?
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

wsyyAuthor Commented:
[root@cld01-01 native]# ./configure --with-apr=/usr/bin/apr-1-config --with-java-home=/opt/jdk1.7.0_02
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking for working mkdir -p... yes
Tomcat Native Version: 1.1.22
checking for chosen layout... tcnative
checking for APR... configure: error: the --with-apr parameter is incorrect. It must specify an install prefix, a build directory, or an apr-config file.

Jay, as u would see, the --with-apr parameter is incorrect. What is APR? How can I solve this?
wsyyAuthor Commented:
Jay, please forgone the above comments. I figured out to install apr by the following command:

 yum install apr-devel openssl-devel

Also, I have followed your suggestions to put the export LD_LIBRARY_PATH="/usr/local/apr/lib" the second line of the

But I don't know why I should install the tomcat native and how to test if the native has been successfully installed.
Jayachandran PalanisamyTechnical Consultant - LinuxCommented:
wsyyAuthor Commented:

I followed ur instructions. Now how can I test if tomcat native is there to work.
Jayachandran PalanisamyTechnical Consultant - LinuxCommented:

check the difference between various connectors.(Under "Which connector?" section)

APR/Native is the flexible one to use. If you  want to go others for specific reasons then you can proceed.

Jayachandran PalanisamyTechnical Consultant - LinuxCommented:

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.