0

I'm new to Linux but having spent a whole day I Installed Java and Tomcat. My goal is to host an App with this Linux box. I know it all works fine from my windows based machine, but it is my laptop so I'm planning to use the Linux Box as my dedicated server.

I am following this tutorial . From this tutorial I have executed the following command :

cd /etc/init.d 
vi tomcat 
#!/bin/bash  
# description: Tomcat Start Stop Restart  
# processname: tomcat  
# chkconfig: 234 20 80  
JAVA_HOME=/usr/java/jdk1.7.0_05  
export JAVA_HOME  
PATH=$JAVA_HOME/bin:$PATH  
export PATH  
CATALINA_HOME=/usr/share/apache-tomcat-7.0.29  

case $1 in  
start)  
sh $CATALINA_HOME/bin/startup.sh  
;;   
stop)     
sh $CATALINA_HOME/bin/shutdown.sh  
;;   
restart)  
sh $CATALINA_HOME/bin/shutdown.sh  
sh $CATALINA_HOME/bin/startup.sh  
;;   
esac      
exit 0  
chmod 755 tomcat
chkconfig --add tomcat 
chkconfig --level 234 tomcat on 
chkconfig --list tomcat 
service tomcat start  

After this command , tomcat is started at port 8082 . But when I restart pc , the tomcat is not started with boot of PC .

How can I do this ?

Khaled
  • 36,533
  • 8
  • 72
  • 99

1 Answers1

1

Run the following command to set the service to start automatically:

chkconfig tomcat on
Itai Ganot
  • 10,644
  • 29
  • 93
  • 146
  • Note: Forwarding request to 'systemctl enable tomcat.service'. Failed to issue method call: Bad message – Christopher Marlowe Feb 20 '17 at 12:10
  • Why do you install it like that and not through yum? check out this article: https://www.digitalocean.com/community/tutorials/how-to-install-apache-tomcat-7-on-centos-7-via-yum – Itai Ganot Feb 20 '17 at 12:12