Install Java 8, Apache http, Apache Tomcat 8.5 on CentOS 6

# Install tools and apache web server:
yum install wget nano httpd
chkconfig httpd on
service iptables stop
setenforce 0
service httpd start

# Install Java JDK 8 for server
yum install java-1.8.0-openjdk java-1.8.0-openjdk-devel
java -version

# downloadand unpackage apache tomcat
cd /home/
mkdir installers
cd installers
wget http://www-eu.apache.org/dist/tomcat/tomcat-8/v8.5.5/bin/apache-tomcat-8.5.5.tar.gz
tar -zxvf apache-tomcat-8.5.5.tar.gz
mv apache-tomcat-8.5.5 tomcat85
mv tomcat85/ /opt/

# set tomcat opts
cd /opt/tomcat85/bin/
nano setenv.sh
# put the line:
export CATALINA_OPTS="$CATALINA_OPTS -server -Dfile.encoding=UTF-8 -Xms128m -Xmx6248m -XX:PermSize=64m -XX:MaxPermSize=2000m"
# save and quit (ctrl+o, ctrl+X)
chmod +x setenv.sh

# start tomcat and test on browser:
/opt/tomcat85/bin/startup.sh
# see welcome page in port 8080
# example:  http://192.168.1.81:8080/

# Configure Apache web server for proxypass an Web App via ajp (for this example /docs/)
nano /etc/httpd/conf/httpd.conf
# append the line to file bottom:
# see more docs in https://httpd.apache.org/docs/2.4/mod/mod_proxy_ajp.html
ProxyPass "/docs" "ajp://127.0.0.1:8009/docs"
# restart apache http
service httpd restart
# test via browser without port, example: http://192.168.1.81/docs

# firewall rule for 80, 8080 ports
nano /etc/sysconfig/iptables
# Then add this entry before -A INPUT -j REJECT line
-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 8080 -j ACCEPT
# restart firewall
service iptables restart
# verify open ports:
netstat -tulpn
# Make sure iptables is allowing ports
iptables -L -n
 
# Disable enforce
nano /etc/selinux/config
# change the SELINUX line to 
SELINUX=disabled

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s