Make Tomcat auto startup in Windows is easy, either install it as service or just put the startup batch into Windows startup list. But not for Linux. After you install (or unzip) Tomcat into your Linux machine, and everything tested OK, you can use steps below to make Tomcat startup as service in Linux (referring to Startup script for Tomcat on Centos | Redhat | Fedora):
- Download the startup script from here. There are 2 files inside the zip file: tomcatd and tomcatRunner.
- Extract them to /etc/init.d. Make sure they are runnable.
- Edit parameters below inside tomcatd file:
- JAVA: location of your java utility, for example /usr/java/jdk1.6.0_17/bin/java.
- tomcatuser: user that will run the service, usually I just change it to root. (default is tomcat)
- CATALINA_HOME: location of your Tomcat, example /usr/tomcat.
- Make a tomcat directory in /var/run:
- Add the tomcat service:
chkconfig ––add tomcatd
- Now you should able to test out the service:
service tomcatd restart
Here is another post to auto start Tomcat.