티스토리 뷰

Study

Tomcat(톰캣) install(설치)

메디츠 2024. 2. 18. 09:25
반응형

16년 12월 기준.

 

wget http://mirror.navercorp.com/apache/tomcat/tomcat-8/v8.5.8/bin/apache-tomcat-8.5.8.tar.gz

 

tar -xzvf apache-tomcat-8.5.8.tar.gz

mv apache-tomcat-8.5.8.tar /usr/local/tomcat

 

ln -s apache-tomcat-8.5.8. tomcat

 

/etc/profile

export JAVA_HOME=/usr/java/idk

export CATALINA_HOME=/usr/local/tomcat

source /etc/profile

 

yum install iptables-services // iptables-services 설치

 

vi /etc/sysconfig/iptables

-A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT

service iptables restart

 

vi /etc/init.d/tomcat

#!/bin/sh

# chkconfig: 345 90 90

# description: init file for tomcat

# processname: tomcat

# Get Config

[ -f /usr/local/tomcat/conf/server.xml ] && [ -f /usr/local/tomcat/conf/web.xml ] || exit 0

 

source /etc/profile

 

# Source function library

. /etc/rc.d/init.d/functions

 

# caution :

# variable=<value> space between variable and value is not allowed

RETVAL=0

prog=tomcatd

 

# Start function

start()

{

echo -n "Starting $prog : "

daemon $CATALINA_HOME/bin/startup.sh

RETVAL=$?

echo

touch /var/lock/subsys/tomcat

return $RETVAL

}

 

# Stop fucntion

stop()

{

echo -n "Stopping $prog : "

daemon $CATALINA_HOME/bin/shutdown.sh

RETVAL=$?

echo

rm -f /var/lock/subsys/tomcat

return $RETVAL

}

 

# Restart function

restart()

{

stop

start

}

 

# See how we were called

case "$1" in

start)

start

;;

stop)

stop

;;

restart)

restart

;;

*)

echo $"Usage : $0 {start|stop|restart}"

esac

 

exit $RETVAL

 

chmod 755 /etc/init.d/tomcat

 

chkconfig -add tomcat

chkconfig -list tomcat

 

systemctl enable tomcat

systemctl status tomcat

// CentOS7

 

/etc/init.d/tomcat start

 

반응형
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
TAG
more
«   2025/06   »
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30
글 보관함