Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 02-07-2006, 04:03 AM   #1
LQ Newbie
Registered: Feb 2006
Distribution: FC4
Posts: 5

Rep: Reputation: 0
getting Tomcat to run on boot in Fedora 4


I've installed Tomcat and Java successfully on my Fedora Core 4 system. I can run and see the default Tomcat page on

I now want Tomcat to run on boot, so I've been looking around at how to do this and I've ended up doing the following:

1. Added the following lines to /etc/rc.d/rc.local:

#start Tomcat
sh /home/phil/apache-tomcat-5.5.15/bin/

2. Created a symbolic link called "K06tomcat" in /etc/rc.d/rd5.d which points to "/home/phil/apache-tomcat-5.5.15/bin/" - the idea here is that this gets called on shutdown to stop Tomcat - actually, this is a side issue, is this an appropriate way to do this? - I picked the lowest number available (i.e. from K01, K02...) to name the link with hoping it would get called as soon as possible.

3. Added the following lines to /etc/profile (above the already existing 'export' command):


4. Added the following line to ~/.bash_profile:

export JAVA_HOME=/usr/java/jdk1.5.0_06

When Fedora starts up, I get the error message complaining that "neither JAVA_HOME nor JRE_HOME" are defined - this comes from, so somehow the environment variables are not being set by either of the two scripts before this is executed, or it's not 'in scope' or something?

For the record, if I hardcode JAVA_HOME in to the top of, Tomcat works ok on boot, but I don't want to do that, I want it to use the environment variables.
Old 02-07-2006, 08:52 AM   #2
LQ Newbie
Registered: Feb 2006
Location: Wales
Distribution: Fedora, SuSE, CentOS, Ubuntu
Posts: 13

Rep: Reputation: 0
use the following:
(save this as /etc/init.d/tomcat)
# chkconfig: 3 90 90
# description:Tomcat JSP server
export JAVA_HOME=/usr/local/java
export CATALINA_OPTS="-Xms128m -Xmx756m -Djava.awt.headless=true"
rm -rf /usr/local/tomcat/work/Catalina/localhost/mimecast
case "$1" in
echo -n "Starting Tomcat:"
cd /usr/local/tomcat/bin/
echo -n "Stopping Tomcat"
cd /usr/local/tomcat/bin/
$0 stop
$0 start
echo "Usage:$0{start|stop|restart}"
exit 1
exit 0

Ok, in this startup script I have specified what my java environment variable is (/usr/local/java) as I do not use the default system java.
I install java into /usr/java/j2sdk etc, then symlink to /usr/local/java as that way I can add new java, change my symlink, test and if not good just chnage the symlink again...

export CATALINA_OPTS="-Xms128m -Xmx756m -Djava.awt.headless=true"
This line says: run with 128MB RAM, but use a MAX of 756MB RAM, and that it must run as a daemon.

You will also not that I (again, symlink is your friend) symlink /usr/local/tomcat to /usr/local/jakarta_tomcat....etc
Again this is so I can upgrade tomcat with a very very short downtime and very easy rollback in the advent of a problem.

Don't forget to add tomcat to your startup using chkconfig (chkconfig --add tomcat; chkconfig --level 3 tomcat on) , and don't forget to change the permissions of the file /etc/init.d/tomcat, this must be 755 (chmod 755 /etc/init.d/tomcat)

I hope this helps.
Old 02-07-2006, 11:57 AM   #3
LQ Newbie
Registered: Feb 2006
Distribution: FC4
Posts: 5

Original Poster
Rep: Reputation: 0
That's worked really well, thanks.

Also, I like the use of the symlinks - that's neat solution to changing versions of java/tomcat etc.

Thanks a lot!


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Unable to run Tomcat 5.5.9 on Fedora core 4 tech_j Linux - Software 2 09-04-2005 09:17 AM
I can't run tomcat hus Programming 2 05-11-2005 11:48 AM
How do you run Tomcat as nobody? vous Linux - Software 11 03-24-2005 01:15 PM
How do I make a command run as root at boot up under Fedora 3? versaulis Linux - Software 5 02-10-2005 06:22 PM
How to start scriptfile(tomcat) automatically at boot-time run fmohideen76 Linux - General 4 07-11-2002 10:44 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:55 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration