April 2024
M T W T F S S
1234567
891011121314
15161718192021
22232425262728
2930  

Categories

April 2024
M T W T F S S
1234567
891011121314
15161718192021
22232425262728
2930  

Install tomcat and Apache centos 7

yum install gcc-c++

yum install openssl-devel.x86_64

cd /usr/local/src

wget http://mirror.nus.edu.sg/apache//httpd/httpd-2.4.18.tar.gz
wget http://ftp.ps.pl/pub/apache//apr/apr-1.5.2.tar.gz
wget http://ftp.ps.pl/pub/apache//apr/apr-util-1.5.4.tar.gz

tar xvfz apr-1.5.1.tar.gz

tar xvfz apr-util-1.5.3.tar.gz

tar xvfz httpd-2.4.18.tar.gz

tar xvf pcre-8.35.tar.bz2

cd /usr/local/src/apr-1.5.1

./configure –prefix=/usr/local/apr

make

make install

cd /usr/local/src/apr-util-1.5.3

./configure –prefix=/usr/local/apr-util –with-apr=/usr/local/apr

make

make install

cd /usr/local/src/pcre-8.35

./configure –prefix=/usr/local

make

make install

cd /usr/local/src/httpd-2.4.18

./configure  –prefix=/usr/local/apache \

–enable-rule=SHARED_CORE  \

–enable-so  \

–enable-rewrite  \

–enable-vhost-alias  \

–enable-ssl  \

–enable-proxy  \

–enable-shared=max  \

–enable-modules=shared  \

–enable-mods-shared=all  \

–with-apr=/usr/local/apr  \

–with-charset=utf-8  \

–with-mpm=prefork \

–with-apr-util=/usr/local/apr-util

make

make install

wget http://apache.mirror.cdnetworks.com/tomcat/tomcat-connectors/jk/tomcat-connectors-1.2.40-src.tar.gz -O connector.tar.gz

tar -zxvf connector.tar.gz

cd tomcat-connectors-1.2.40-src/native/

./configure –with-apxs=/usr/local/apache/bin/apxs

make && make install

cd /usr/local/apache/conf/

vi workers.properties

worker.list=pem

worker.pem.port=8009

worker.pem.host=localhost

worker.pem.type=ajp13

vi /usr/local/apache2/conf/httpd.conf

#LoadModule slotmem_shm_module modules/mod_slotmem_shm.so

LoadModule slotmem_shm_module modules/mod_slotmem_shm.so

LoadModule jk_module modules/mod_jk.so

<IfModule jk_module>

JkWorkersFile conf/workers.properties

JkLogFile logs/mod_jk.log

JkLogLevel error

</IfModule>

#Include conf/extra/httpd-vhosts.conf

Include conf/extra/httpd-vhosts.conf

#Listen 9090

vi /usr/local/apache/conf/extra/httpd-vhosts.conf

Listen 9090

<VirtualHost *:9090>

ServerAdmin rmohan@rmohan.com

DocumentRoot /data/test/webapp

ServerName www.rmohan.com

ErrorLog “logs/dummy-host.example.com-error_log”

CustomLog “logs/dummy-host.example.com-access_log” common

JkMount  /*.jsp          pem

JkMount  /*.phyjax      pem

JkMount  /*.phy        pem

JkMount  /*.phyin        pem

JkMount /               pem

JkMount /j_spring_security_logout pem

JkMount /j_spring_security_check pem

<Directory “/home/test/webapp”>

Options Indexes FollowSymLinks

AllowOverride None

Order allow,deny

Allow from all

Require all granted

</Directory>

</VirtualHost>

chown apache:apache -R /usr/local/apache

cd /usr/local/apache/bin

chmod +s httpd

vi /usr/lib/systemd/system/apache.service

[Unit]

Description=apache2 Service
After=syslog.target
After=network.target

[Service]

Type=forking

ExecStart=/usr/local/apache/bin/apachectl start

ExecStop=/usr/loacal/apache/bin/apachectl graceful-stop

ExecReload=/usr/local/apache/bin/apachectl graceful

PrivateTmp=true

LimitNOFILE=infinity

[Install]
WantedBy=multi-user.target

systemctl enable apache

 

 

 
Centos 7  tomcat  ( systemclt )

# vi /usr/lib/systemd/system/tomcat.service

tomcat.service

[Unit]
Description=Tomcat7 Service
After=syslog.target
After=network.target

[Service]
Type=forking
ExecStart=/usr/tomcat/bin/catalina.sh start
ExecStop=/usr/tomcat/bin/catalina.sh stop

[Install]
WantedBy=multi-user.target

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>