Thursday, November 19, 2009

Installing Tomcat On 64 bit Linux

So am doing one project where I have to work on exposing spring bean as soap webservice, json, restful webservice and as ejb.

As tomcat being easy and free server to host, I went down to install it and run my project using tomcat.

I will put spring beans and other stuff later. I would start with the installation of the tomcat software on my ubuntu sorry kubuntu linux 64bit.

1. Get the tomcat binaries from tomcat download site.

2. Get the 64bit jdk from sun's java site. make sure you are downloading 64 bit version of the jdk. For tomcat you just need jre, but I am using jdk (it contains jre), the reason being I would be using the same to configure eclipse to use this jdk.

3. Make the jdk-6u17-linux-x64.bin executable. Depending on the release, the file name would be different.

chmod 755 jdk-6u17-linux-x64.bin
./jdk-6u17-linux-x64.bin


4. This will create the jdk folder and the required jar files.

5. Move the jdk folder to /opt folder. I prefer to do this as I keep all my installed software in /opt.

sudo mv jdk1.6.0_17 /opt

6. Now similarly extract the tomcat folder and put it in the /opt directory.

7. Now create a group named tomcat.

sudo groupadd tomcat

8. Now create a user named tomcat

sudo useradd -g tomcat -s /usr/sbin/nologin -m -d /home/tomcat tomcat

note that this user cannot login into a a shell, this is for security reasons. So no one can hack into and login into the system using tomcat id.

9. Now change the ownership of tomcat directory in /opt to tomcat.

sudo chown tomcat:tomcat -R tomcat.6.0.20

10. Now add yourself to the tomcat group, (required if you want to put the files in tomcat directory by copying, pasting)

usermod -G -a tomcat username

11. Now log out and login.

12. Browse to tomcat/bin directory. Open the setclasspath.sh file in your favorite text editor.

add variable following variables just under CLASSPATH = line.

JAVA_HOME=/opt/jdk1.6.0_17
JRE_HOME=${JAVA_HOME}/jre

Save the file.

13. Now run the command ./startup.sh. Your tomcat should be up and running. If not refer to the logs file under tomcat/logs directory for debugging.

to check if tomcat is up and running, open firefox or your favorite browser and go to url. http://localhost:8080/.

And you are all set now...

Hope this helps...

No comments: