Link to home
Start Free TrialLog in
Avatar of wsyy
wsyy

asked on

Install java 7, tomcat, etc. on CentOS

Hi,

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

Thanks
Avatar of Jayachandran Palanisamy
Jayachandran Palanisamy
Flag of India image

Hi,

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.
http://openjdk.java.net/install/index.html
(OR)
cd /usr/local/src
wget http://download.oracle.com/otn-pub/java/jdk/7u2-b13/jdk-7u2-linux-x64.rpm

Open in new window

(If your OS is 64bit)
wget http://download.oracle.com/otn-pub/java/jdk/7u2-b13/jdk-7u2-linux-i586.rpm

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.
http://docs.oracle.com/javase/7/docs/webnotes/install/linux/linux-jdk.html

To Install Ant:
wget http://apache.osuosl.org//ant/binaries/apache-ant-1.8.2-bin.tar.gz
To install check this URL.
http://ant.apache.org/manual/install.html#getBinary


Install Tomcat 7.x.x:
cd /usr/local/
wget http://apache.cc.uoc.gr/tomcat/tomcat-7/v7.0.23/bin/apache-tomcat-7.0.23.tar.gz
tar -zxvf apache-tomcat-7.0.23.tar.gz
rm apache-tomcat-7.0.23.tar.gz
cd apache-tomcat-7.0.23/bin
./startup.sh

Open in new window

You can find the version to download from the binary distribution HERE.
http://tomcat.apache.org/download-70.cgi


Next you must install tomcat native by downloading the source from here:
http://tomcat.apache.org/download-native.cgi
cd ~
mkdir installers && cd installers
wget http://apache.cc.uoc.gr//tomcat/tomcat-connectors/native/1.1.22/source/tomcat-native-1.1.22-src.tar.gz
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
make install

Open in new window


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

-Jay
Avatar of wsyy
wsyy

ASKER

Jay, thanks a bunch for providing so detailed info.

I wonder why I must install  tomcat native.
Avatar of wsyy

ASKER

Also,

*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"?
Avatar of wsyy

ASKER

[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?
Avatar of wsyy

ASKER

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 catalina.sh.

But I don't know why I should install the tomcat native and how to test if the native has been successfully installed.
Avatar of wsyy

ASKER

Jay,

I followed ur instructions. Now how can I test if tomcat native is there to work.
wsyy,

check the difference between various connectors.(Under "Which connector?" section)
http://www.springsource.com/files/uploads/tomcat/tomcatx-performance-tuning.pdf

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

Jay
ASKER CERTIFIED SOLUTION
Avatar of Jayachandran Palanisamy
Jayachandran Palanisamy
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial