blog
[CentOS] 아파치, 아파치 톰캣 다운로드 본문
처음부터 다시 설치하며 공부해보기로..
[java 8 다운로드]
yum -y install java-1.8.0-openjdk-devel.x86_64
버전에 맞게
[아파치 서버 다운로드]
yum -y install httpd
firewall-cmd --zone=public --permanent --add-service=http
firewall-cmd --zone=public --permanent --add-service=https
firewall-cmd --zone=public --permanent --add-port=80/tcp
firewall-cmd --zone=public --permanent --add-port=8080/tcp
하는 김에 8080도 추가해서 방화벽 해제
reload 이후 list 확인
[root@localhost ~]# systemctl enable httpd
Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service → /usr/lib/systemd/system/httpd.service.
[root@localhost ~]# systemctl start httpd
오류 발생
[root@localhost ~]# systemctl start httpd
오류 1 :
Job for httpd.service failed because the service did not take the steps required by its unit configuration.
See "systemctl status httpd.service" and "journalctl -xeu httpd.service" for details.
시스템 등록하고 시작했더니 에러 발생.
# journalctl -xe
=> AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globally to suppress this message
/etc/
오류 2 : systemctl status httpd
1월 27 14:22:19 localhost.localdomain httpd[39848]: (98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
1월 27 14:22:19 localhost.localdomain httpd[39848]: (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
불길한 오류
# netstat -anp | grep 80
# kill -9 PID
80포트를 잡고 있는 서비스를 죽인다.
다시 시작하면 정상동작
http://내 PC IP
서버 테스트 페이지 확인 가능
/var/www/html에 index.html을 만들면 해당 페이지가 보인다.
[톰캣 다운로드]
useradd -d /opt/tomcat -s /sbin/nologin tomcat
톰캣 사용자 만들기
/sbin 안되면 /bin으로
1. curl을 이용한 톰캣 다운로드
curl https://archive.apache.org/dist/tomcat/tomcat-9/v9.0.53/bin/apache-tomcat-9.0.53.tar.gz -o apache-tomcat-9.0.53.tar.gz
아카이브에서 적당한 버전을 다운로드
tar -zxvf apache-tomcat-9.0.53.tar.gz
mv apache-tomcat-9.0.53/* /opt/tomcat/
압축 풀고 /opt/tomcat으로 이동
chown -R tomcat:tomcat /opt/tomcat/
톰캣 유저에게 소유권 주기
자바 위치 확인
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.312.b01-0.1.ea.el9.x86_64/jre/bin/java
bin전까지!
[Unit]
Description=Apache Tomcat Web Application Container
Wants=network.target
After=network.target
[Service]
Type=forking
Environment=JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.312.b01-0.1.ea.el9.x86_64/jre
Environment=CATALINA_PID=/opt/tomcat/temp/tomcat.pid
Environment=CATALINA_HOME=/opt/tomcat
Environment='CATALINA_OPTS=-Xms512M -Xmx1G -Djava.net.preferIPv4Stack=true'
Environment='JAVA_OPTS=-Djava.awt.headless=true'
ExecStart=/opt/tomcat/bin/startup.sh
ExecStop=/opt/tomcat/bin/shutdown.sh
SuccessExitStatus=143
User=tomcat
Group=tomcat
UMask=0007
RestartSec=10
Restart=always
[Install]
WantedBy=multi-user.target
setenforce 0
sed -i 's/ELINUX=enforcing/ELINUX=disabled/g' /etc/selinux/config
톰캣 시작 전에 셀리눅스 끄기
systemctl daemon-reload
systemctl enable tomcat
systemctl start tomcat
systemctl status tomcat
netstat -antup | grep 8080
톰캣 실행중
8080포트로 접속하면 된다.
'Web > 그 외' 카테고리의 다른 글
다운그레이드 된 mysql(mariadb)로 데이터 옮기기 (0) | 2022.05.30 |
---|---|
[VSCode] 열리지 않을 때 (0) | 2022.05.30 |
[CentOS] tomcat 다운로드 (0) | 2022.03.05 |
[CentOS] Node.js 설치 (0) | 2022.02.21 |
[CentOS] Apache 웹서버 설치 (0) | 2022.02.21 |