dev/mac

[macOS] 개발환경 구축 - Rocky Linux에 Tomcat9 설치하기

hazelbean 2025. 5. 11. 21:26

1. 패키지 매니저 업데이트

dnf update
dnf upgrade

 

2. wget, tar 설치

which 명령어로 wget과 tar 위치를 확인하여 없을 경우 설치 해준다.

dnf upgrade
dnf install tar -y

 

3. java가 설치되어 있는지 확인한다. (설치되어 있지 않을 경우 설치가 필요하다.)

java -version

 

4. wget 명령어를 이용하여 Apache Tomcat(이하 톰캣) 설치 파일을 다운로드 한다.

4-1. Apache Tomcat 다운로드 페이지 접속

https://tomcat.apache.org/download-90.cgi

 

Apache Tomcat® - Apache Tomcat 9 Software Downloads

Welcome to the Apache Tomcat® 9.x software download page. This page provides download links for obtaining the latest version of Tomcat 9.0.x software, as well as links to the archives of older releases. Unsure which version you need? Specification version

tomcat.apache.org

4-2. 'tar.gz' 하이퍼링크를 우클릭하면 나오는 '링크 주소 복사를' 클릭하여 다운로드 주소를 복사한다.

4-3. wget 명령어를 이용하여 톰캣 설치파일을 다운로드 한다.

wget https://dlcdn.apache.org/tomcat/tomcat-9/v9.0.105/bin/apache-tomcat-9.0.105.tar.gz

 

5. tar 명령어로 다운로드한 설치파일의 압축을 풀어준다.

tar -zxvf apache-tomcat-9.0.104.tar.gz

 

6. mv 명령어를 이용하여 /opt 혹은 원하는 디렉토리로 이동시킨다.

 mv ./apache-tomcat-9.0.104 /opt

 

7. cd 명령어로 톰캣 bin 디렉토리로 이동한다.

cd /opt/apache-tomcat-9.0.104/bin

 

8. 톰캣 서버를 실행 시킨다.

./startup.sh

 

 

9. 톰캣이 정상적으로 실행되었다. 설치가 완료되었다.

브라우저에서 톰캣 화면을 확인 해본다. (htttp://{IP}:8080/)

 

10. 브라우저에서 톰캣 index.html 화면이 확인되지 않는 경우 Port 및 방화벽을 확인 해준다.

10-1. 방화벽이 문제인 경우 방화벽을 해제한다.

systemctl stop firewalld

10-2. 8080 포트가 다른 곳에서 사용 중인 경우 내려주고 톰캣을 재기동 한다.

netstat 명령어를 사용하여 사용 중인 8080 포트를 사용하는 PID가 있는지 확인한다.

netstat -tnlp|grep 8080

 

8080 포트를 사용 중인 PID가 있다면 kill -9 명령어를 사용하여 프로세스를 종료해준다.

kill -9 12345