Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 31 |
Tags
- posgtresql
- 하위디렉토리
- 공주페이
- Openlayers
- 와콤뱀부슬레이트
- PostgreSQL
- 데이터비교
- 순댓국밥
- tablewidget
- posgresql
- postgis
- psql
- postgrest
- rc.local
- pygqis
- qgis
- HP스펙터
- idw
- shp내려받기
- table비교
- shape내려받기
- ST_InvDistWeight4ma
- 테이블 중복조회
- HP스펙터x360
- 네이버클라우드
- 테이블리턴
- SQL
- 테이블목록
- Python
- table
Archives
- Today
- Total
오픈소스의 일상
#7. 아파치+톰켓 설치 및 연동 본문
1. httpd 설치 및 정상설치 여부 확인
[root@flas ~]# yum install -y httpd
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirror.kakao.com
* centos-sclo-rh: mirror.kakao.com
* epel: mirrors.nipa.cloud
* extras: mirror.kakao.com
* updates: mirror.kakao.com
Resolving Dependencies
--> Running transaction check
---> Package httpd.x86_64 0:2.4.6-97.el7.centos.2 will be installed
--> Processing Dependency: httpd-tools = 2.4.6-97.el7.centos.2 for package: httpd-2.4.6-97.el7.centos.2.x86_64
--> Processing Dependency: /etc/mime.types for package: httpd-2.4.6-97.el7.centos.2.x86_64
--> Running transaction check
---> Package httpd-tools.x86_64 0:2.4.6-97.el7.centos.2 will be installed
---> Package mailcap.noarch 0:2.1.41-2.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
============================================================================================
Package Arch Version Repository Size
============================================================================================
Installing:
httpd x86_64 2.4.6-97.el7.centos.2 updates 2.7 M
Installing for dependencies:
httpd-tools x86_64 2.4.6-97.el7.centos.2 updates 94 k
mailcap noarch 2.1.41-2.el7 base 31 k
Transaction Summary
============================================================================================
Install 1 Package (+2 Dependent packages)
Total download size: 2.8 M
Installed size: 9.6 M
Downloading packages:
(1/3): httpd-2.4.6-97.el7.centos.2.x86_64.rpm | 2.7 MB 00:00:00
(2/3): mailcap-2.1.41-2.el7.noarch.rpm | 31 kB 00:00:00
(3/3): httpd-tools-2.4.6-97.el7.centos.2.x86_64.rpm | 94 kB 00:00:00
--------------------------------------------------------------------------------------------
Total 21 MB/s | 2.8 MB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : httpd-tools-2.4.6-97.el7.centos.2.x86_64 1/3
Installing : mailcap-2.1.41-2.el7.noarch 2/3
Installing : httpd-2.4.6-97.el7.centos.2.x86_64 3/3
Verifying : httpd-2.4.6-97.el7.centos.2.x86_64 1/3
Verifying : mailcap-2.1.41-2.el7.noarch 2/3
Verifying : httpd-tools-2.4.6-97.el7.centos.2.x86_64 3/3
Installed:
httpd.x86_64 0:2.4.6-97.el7.centos.2
Dependency Installed:
httpd-tools.x86_64 0:2.4.6-97.el7.centos.2 mailcap.noarch 0:2.1.41-2.el7
Complete!
[root@flas ~]# httpd -version
Server version: Apache/2.4.6 (CentOS)
Server built: Nov 10 2021 14:26:31
-- 자동실행 등록
[root@flas ~]# systemctl enable httpd
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
-- 서비스 상태확인
[root@flas ~]# systemctl status httpd
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
Active: inactive (dead)
Docs: man:httpd(8)
man:apachectl(8)
[root@flas ~]#
2. Tomcat 설치
-- Tomcat 다운로드 https://tomcat.apache.org/download-80.cgi
-- 설치위치로 이동
[root@flas home]# cd /usr/local
[root@flas local]# wget https://dlcdn.apache.org/tomcat/tomcat-8/v8.5.73/bin/apache-tomcat-8.5.73.tar.gz
--2021-12-23 09:17:44--
https://dlcdn.apache.org/tomcat/tomcat-8/v8.5.73/bin/apache-tomcat-8.5.73.tar.gz
Resolving dlcdn.apache.org (dlcdn.apache.org)... 151.101.2.132, 2a04:4e42::644
Connecting to dlcdn.apache.org (dlcdn.apache.org)|151.101.2.132|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 10581990 (10M) [application/x-gzip]
Saving to: ‘apache-tomcat-8.5.73.tar.gz’
100%[==================================================>] 10,581,990 --.-K/s in 0.03s
2021-12-23 09:17:44 (292 MB/s) - ‘apache-tomcat-8.5.73.tar.gz’ saved [10581990/10581990]
[root@flas local]# tar xvfz apache-tomcat-8.5.73.tar.gz
-- 압축풀기
[root@flas local]# tar xvfz apache-tomcat-8.5.73.tar.gz
...
-- Tomcat 실행
[root@flas apache-tomcat-8.5.73]# /usr/local/apache-tomcat-8.5.73/bin/startup.sh
Using CATALINA_BASE: /usr/local/apache-tomcat-8.5.73
Using CATALINA_HOME: /usr/local/apache-tomcat-8.5.73
Using CATALINA_TMPDIR: /usr/local/apache-tomcat-8.5.73/temp
Using JRE_HOME: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.312.b07-1.el7_9.x86_64
Using CLASSPATH: /usr/local/apache-tomcat-8.5.73/bin/bootstrap.jar:/usr/local/apache-tomcat-8.5.73/bin/tomcat-juli.jar
Using CATALINA_OPTS:
Tomcat started.
[root@flas apache-tomcat-8.5.73]#
3. Tomcat 자동실행등록
--Tomcat 중지
[root@flas bin]# /usr/local/apache-tomcat-8.5.73/bin/catalina.sh stop
Using CATALINA_BASE: /usr/local/apache-tomcat-8.5.73
Using CATALINA_HOME: /usr/local/apache-tomcat-8.5.73
Using CATALINA_TMPDIR: /usr/local/apache-tomcat-8.5.73/temp
Using JRE_HOME: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.312.b07-1.el7_9.x86_64
Using CLASSPATH: /usr/local/apache-tomcat-8.5.73/bin/bootstrap.jar:/usr/local/apache-tomcat-8.5.73/bin/tomcat-juli.jar
Using CATALINA_OPTS:
--Tomcat 서비스 생성
[root@flas ]# cd /etc/systemd/system
[root@flas system]# vi tomcat.service
...
[Unit]
Description=tomcat8
After=network.target syslog.target
[Service]
Type=forking
Environment=/usr/local/apache-tomcat-8.5.73
User=root
Group=root
ExecStart=/usr/local/apache-tomcat-8.5.73/bin/startup.sh
ExecStop=/usr/local/apache-tomcat-8.5.73/bin/shutdown.sh
UMask=0007
RestartSec=10
Restart=always
SuccessExitStatus=143
[Install]
WantedBy=multi-user.target
-- 서비스 등록
[root@flas system]# systemctl enable tomcat.service
-- 서비스 테스트 시작
[root@flas system]# systemctl start tomcat.service
[root@flas system]# ps -ef | grep tomcat
root 4993 1 18 13:49 ? 00:00:02 /usr/bin/java -Djava.util.logging.config.file=
/usr/local/apache-tomcat-8.5.73/conf/logging.properties
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
-Djdk.tls.ephemeralDHKeySize=2048
-Djava.protocol.handler.pkgs=org.apache.catalina.webresources
-Dorg.apache.catalina.security.SecurityListener.UMASK=0027
-Dignore.endorsed.dirs=
-classpath /usr/local/apache-tomcat-8.5.73/bin/bootstrap.jar:
/usr/local/apache-tomcat-8.5.73/bin/tomcat-juli.jar
-Dcatalina.base=/usr/local/apache-tomcat-8.5.73
-Dcatalina.home=/usr/local/apache-tomcat-8.5.73
-Djava.io.tmpdir=/usr/local/apache-tomcat-8.5.73/temp
org.apache.catalina.startup.Bootstrap start
root 5118 1426 0 13:49 pts/0 00:00:00 grep --color=auto tomcat
-- 서비스 테스트 종료
[root@flas system]# systemctl stop tomcat.service
[root@flas system]# ps -ef | grep tomcat
root 5241 1426 0 13:49 pts/0 00:00:00 grep --color=auto tomcat
[root@flas system]#
4. Tomcat-Connector(mod_jk) 설치
-- 의존성 주입
-- https://mirror.navercorp.com/apache/tomcat/tomcat-connectors/jk/tomcat-connectors-1.2.48-src.tar.gz
[root@flas home]# wget -c https://mirror.navercorp.com/apache/tomcat/tomcat-connectors/jk/tomcat-connectors-1.2.48-src.tar.gz
--2021-12-23 14:25:06-- https://mirror.navercorp.com/apache/tomcat/tomcat-connectors/jk/tomcat-connectors-1.2.48-src.tar.gz
Resolving mirror.navercorp.com (mirror.navercorp.com)... 125.209.216.167
Connecting to mirror.navercorp.com (mirror.navercorp.com)|125.209.216.167|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 3665280 (3.5M) [application/octet-stream]
Saving to: ‘tomcat-connectors-1.2.48-src.tar.gz’
100%[==================================================>] 3,665,280 --.-K/s in 0.1s
2021-12-23 14:25:06 (25.4 MB/s) - ‘tomcat-connectors-1.2.48-src.tar.gz’ saved [3665280/3665280]
-- 압축 풀기 및 폴더 이동
[root@flas home]# tar xvf tomcat-connectors-1.2.48-src.tar.gz
[root@flas home]# mv tomcat-connectors-1.2.48-src/ /usr/local/src
[root@flas home]# cd /usr/local/src/tomcat-connectors-1.2.48-src/native/
-- 필수유틸 설치
[root@flas native]# yum -y install gcc gcc-c++ httpd-devel
...
Installed:
httpd-devel.x86_64 0:2.4.6-97.el7.centos.2
Dependency Installed:
apr-devel.x86_64 0:1.4.8-7.el7 apr-util-devel.x86_64 0:1.5.2-6.el7
cyrus-sasl.x86_64 0:2.1.26-23.el7 cyrus-sasl-devel.x86_64 0:2.1.26-23.el7
expat-devel.x86_64 0:2.1.0-12.el7 libdb-devel.x86_64 0:5.3.21-25.el7
openldap-devel.x86_64 0:2.4.44-24.el7_9
Complete!
--위치확인 및 빌드
[root@flas native]# pwd
/usr/local/src/tomcat-connectors-1.2.48-src/native
[root@flas native]# ./buildconf.sh
buildconf: checking installation...
buildconf: autoconf version 2.69 (ok)
buildconf: libtool version 2.4.2 (ok)
buildconf: libtoolize --automake --copy
buildconf: aclocal
buildconf: autoheader
buildconf: automake -a --foreign --copy
buildconf: autoconf
[root@flas native]# ./configure --with-apxs=/usr/bin/apxs
[root@flas native]# make clean && make && make install
-- mod_jk 파일확인
[root@flas native]# ls /etc/httpd/modules/ | grep mod_jk
mod_jk.so
[root@flas native]#
5. Apache+Tomcat 연동
[root@flas conf]# pwd
/etc/httpd/conf
[root@flas conf]# vi workers.properties
...
worker.list=worker1
worker.worker1.type=ajp13
worker.worker1.host=localhost
worker.worker1.port=8009
worker.worker1.lbfactor=1
[root@flas conf]# vi httpd.conf
...
#AllowOverride All 로 변경
<Directory "/var/www/html">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
...
LoadModule jk_module /etc/httpd/modules/mod_jk.so
<VirtualHost *:80>
ServerName localhost
JkMount /* worker1
</VirtualHost>
JkMountCopy On
<IfModule jk_module>
JkWorkersFile conf/workers.properties
JkShmFile /home/log//mod_jk.shm
JkLogFile /home/log/mod_jk.log
JkLogLevel info
JkLogStampFormat "[%y %m %d %H:%M:%S] "
</IfModule>
[root@flas conf]# pwd
/usr/local/apache-tomcat-8.5.73/conf
[root@flas conf]# vi server.xml
...
<?xml version="1.0" encoding="UTF-8"?>
<Server port="8005" shutdown="SHUTDOWN">
<Listener className="org.apache.catalina.startup.VersionLoggerListener" />
<!-- Security listener. Documentation at /docs/config/listeners.html
<Listener className="org.apache.catalina.security.SecurityListener" />
-->
<!-- APR library loader. Documentation at /docs/apr.html -->
<Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
<!-- Prevent memory leaks due to use of particular java/javax APIs-->
<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
<Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
<GlobalNamingResources>
<Resource name="UserDatabase" auth="Container"
type="org.apache.catalina.UserDatabase"
description="User database that can be updated and saved"
factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
pathname="conf/tomcat-users.xml" />
</GlobalNamingResources>
<Service name="Catalina">
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
<Connector protocol="AJP/1.3" address="0.0.0.0" secretRequired="false"
port="8009" redirectPort="8443" />
<Engine name="Catalina" defaultHost="localhost">
<Realm className="org.apache.catalina.realm.LockOutRealm">
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
resourceName="UserDatabase"/>
</Realm>
<Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true">
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="localhost_access_log" suffix=".txt"
pattern="%h %l %u %t "%r" %s %b" />
<Context path="" docBase="/usr/local/apache-tomcat-8.5.73/webapps/flas/" reloadable="true"/>
</Host>
</Engine>
</Service>
</Server>
==참고
1) semanage설치(selinux 관리 패키지)
yum install -y policycoreutils-python
2) 현재 설정된 포트보기
semanage port -l|grep http_port_t
(80,443,8080,8009,8443 등의 selinux가 허용한 기본 포트만 나열됨)
3) 포트추가(ajp 설정한 포트를 추가 해주시면 됩니다.)
semanage port -a -p tcp -t http_port_t 포트
728x90
'오픈소스 > 네이버클라우드' 카테고리의 다른 글
#8 FTP 설정 (0) | 2022.01.05 |
---|---|
#6. OpenJDK 1.8 설정 (0) | 2021.12.22 |
#5. PostgreSQL 설정 (0) | 2021.12.22 |
#4. PostGIS 3.1.X 설치 및 확인 (0) | 2021.12.21 |
#3. 필수 라이브러리 설치 (0) | 2021.12.21 |