Tomcat9 설치 - Ubuntu 20.04
페이지 정보
작성자 상석하대 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 에필로그 댓글 0건 조회 1,574회 작성일 23-01-14 18:28본문
sudo groupadd tomcat
sudo useradd -s /bin/false -g tomcat -d /home/tomcat9 tomcat
sudo mkdir /home/tomcat9
wget https://www.apache.org/dist/tomcat/tomcat-9/v9.0.70/bin/apache-tomcat-9.0.70.tar.gz
sudo tar xzvf apache-tomcat-9.0.70.tar.gz -C /home/tomcat9 --strip-components=1
cd /home/tomcat9
sudo chgrp -R tomcat /home/tomcat9
sudo chmod -R g+r conf
sudo chmod g+x conf
sudo chown -R tomcat webapps/ work/ temp/ logs/
ll
cd ~
sudo vi /etc/systemd/system/tomcat.service
-------------------------------------------------------------- 내용 시작
[Unit]
Description=Apache Tomcat
After=network.target
[Service]
Type=forking
Environment=JAVA_HOME=/usr/local/java
Environment=CATALINA_PID=/home/tomcat9/temp/tomcat.pid
Environment=CATALINA_HOME=/home/tomcat9
Environment=CATALINA_BASE=/home/tomcat9
Environment='CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC'
Environment='JAVA_OPTS=-Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom'
ExecStart=/home/tomcat9/bin/startup.sh
ExecStop=/home/tomcat9/bin/shutdown.sh
User=tomcat
Group=tomcat
UMask=0007
RestartSec=10
Restart=always
[Install]
WantedBy=multi-user.target
-------------------------------------------------------------- 내용 끝
sudo systemctl daemon-reload
sudo systemctl start tomcat
sudo systemctl status tomcat
sudo ufw allow 8080
http://ip:8080
sudo systemctl enable tomcat
sudo vi /home/tomcat9/conf/tomcat-users.xml
<role rolename="admin-gui"/>
<role rolename="manager-gui"/>
<user username="아이디" password="암호" roles="manager-gui,admin-gui"/>
sudo vi /home/tomcat9/webapps/manager/META-INF/context.xml //Valve 주석
sudo vi /home/tomcat9/webapps/host-manager/META-INF/context.xml //Valve 주석
sudo systemctl restart tomcat
http://ip:8080/manager
http://ip:8080/host-manager
sudo vi /home/tomcat9/webapps/ROOT/test.jsp
-------------------------------------------------------------- 내용 시작
<html>
<head>
<title>JSP test page</title>
</head>
<body>
<START OF JAVA CODES>
<%
out.println("Hello World!"); out.println("<p>First JSP Application.");
%>
<END OF JAVA CODES>
</body>
</html>
-------------------------------------------------------------- 내용 끝
sudo chown tomcat: /home/tomcat9/webapps/ROOT/test.jsp
댓글목록
등록된 댓글이 없습니다.