VPS 및 전용 서버(호스팅 컨트롤 센터) 도움말

How to install Apache Tomcat

Apache Tomcat is a web server for multiple operating systems, including CentOS. It's open-source software developed by the Apache Software Foundation, so it's available for free under the Apache license. Apache Tomcat is written in Java, and uses JavaServer Pages and Java servlets to create a pure Java runtime environment. It runs as a single process in its simplest configuration, although Tomcat processes each HTTP request from the browser as a separate thread. The procedure for installing Tomcat generally involves installing the Java Development Kit (JDK), configuring the system environment, downloading Tomcat and installing it.

DIFFICULTY Basic - 1 | Medium - 2 | Advanced - 3
RELATED PRODUCTS Linux-based VPS or dedicated servers

Here is a quick tutorial on how to install Apache Tomcat.

NOTE: cPanel/WHM users should follow cPanel's instructions instead to use EasyApache

Install the JDK

Assume for this example that you wish to develop Java programs in addition to installing the JDK. Assume further that the current version of JDK is v1.7.0, and you want to automatically answer "yes" to all questions that the installation program asks. Enter the following command at the CentOS command line:

$ sudo yum install java-1.7.0-openjdk-devel -y

Set the JAVA_HOME environment variable

Set JAVA_HOME to the location of JDK, which is /usr/lib/jvm/java-1.7.0-openjdk by default.

$ sudo sh -c 'echo export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk > /etc/profile.d/java.sh'
$ source /etc/profile.d/java.sh

Download Apache Tomcat

Download the Tomcat binary. The following command assumes that the current version of Tomcat is v7.0.56:

$ wget http://apache.mirrors.tds.net/tomcat/tomcat-7/v7.0.56/bin/apache-tomcat-7.0.56.tar.gz

NOTE: Always check to ensure you are downloading the latest version. Version 7.0.56 was current at the time of writing.

Unpack and configure

Unpack the binary file with the tar command:

$ sudo tar xvzf apache-tomcat-7.0.56.tar.gz -C /opt

Make the unpacked files read-only;

$ sudo chmod +r /opt/apache-tomcat-7.0.56/conf/*

Set CATALINA_HOME to the directory for the Tomcat files

$ sudo sh -c 'echo export CATALINA_HOME=/opt/apache-tomcat-7.0.56 > /etc/profile.d/tomcat.sh'
$ source /etc/profile.d/tomcat.sh

Start Tomcat

Run Tomcat's startup script.

$ sudo $CATALINA_HOME/bin/startup.sh

Verify that Tomcat is running by going to http://localhost:8080 in your browser. This URL should appear as follows:

Change your Tomcat login credentials

You'll also need to update the password you use to log in to your Tomcat Manager. We've got thos instructions for you here.

이 글이 도움되었나요?
피드백을 보내주셔서 감사합니다. 고객 서비스 담당자에게 문의하시려면 지원 전화 번호 또는 위의 채팅 옵션을 이용하시기 바랍니다.
도와드릴 수 있어 기쁩니다! 더 도와 드릴 것이 있나요?
그것 유감스럽습니다. 혼동이 되었던 사항 또는 솔루션이 고객님의 문제를 해결하지 못했던 원인을 알려주세요.