LetHostTalk
INSTALL TOMCAT ON CENTOS 7 http://www.serverhedge.com/blogs/post/Install-Apache-Tomcat-8-on-CentOS-7 — LetsHostTalk - Web Hosting Forum
HostNamaste.com

INSTALL TOMCAT ON CENTOS 7 http://www.serverhedge.com/blogs/post/Install-Apache-Tomcat-8-on-CentOS-7

This blog post covers the basic installation & configuration
of TOMCAT 8 on CentOS 7

Install Java - OpenJDK 7 on your CentOS server.

yum install java-1.7.0-openjdk-devel

Default JAVA_HOME directory will be /usr/lib/jvm/jre

Now you should create a TOMCAT group & User as well.
groupadd tomcat

Now create a TOMCAT user with limited access privileges.

useradd -M -s /bin/nologin -g tomcat -d /opt/tomcat tomcat

Here the the TOMCAT user's home directory will be /opt/tomcat tomcat. Now you should download the latest bin distribution of TOMCAT to the TOMCAT user's home directory /opt/tomcat, from the official repository.
wget http://tomcat.apache.org/download-80.cgi#8.0.23
Next extract the tarball to the /opt/tomcat .
tar xvf apache-tomcat-8*tar.gz -C /opt/tomcat --strip-components=1
Now add read & write permissions to the TOMCAT user to the conf directory.
chgrp -R tomcat conf
chmod g+rwx conf
chmod g+r conf/*

Now make the TOMCAT user the owner of the webapps, work, temp, and logs directories.

chown -R tomcat webapps/ work/ temp/ logs/

Inorder to run TOMCAT as service,

vi /etc/systemd/system/tomcat.service

Now you should add the following lines to the file tomcat.service

# Systemd unit file for tomcat
[Unit]Description=Apache Tomcat Web Application ContainerAfter=syslog.target network.target
[Service]Type=forking
Environment=JAVA_HOME=/usr/lib/jvm/jre
Environment=CATALINA_PID=/opt/tomcat/temp/tomcat.pid
Environment=CATALINA_HOME=/opt/tomcat
Environment=CATALINA_BASE=/opt/tomcat
Environment='CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC'
Environment='JAVA_OPTS=-Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom'

ExecStart=/opt/tomcat/bin/startup.shExecStop=/bin/kill -15 $MAINPID
User=tomcatGroup=tomcat
[Install]WantedBy=multi-user.target

Now start the tomcat service.

systemctl start tomcat

To enable TOMCAT service at boot time.

systemctl enable tomcat

Now you can the TOMCAT default page through the port 8080.

Open in your web browser.


http://IP_address:8080

To configure TMOCAT web management interface.

You should edit tomcat-users.xml file.

vi /opt/tomcat/conf/tomcat-users.xml

Define admin role in this file as below.


Now restart the TOMCAT Service. No w the user 'admin can access manager-gui and admin-gui as well.
system restart tomcat

Now you can configure the TOMCAT webapps manager by accessing
the URL: http://server_IP_address:8080/manager/html

The web application manager is used to manage, Start, Stop, Reload,Deploy, and undeploy your application. From the Virtual Host Manager page in webapp manager, you can add virtual hosts to serve your web applications.

Skype Us : serverhedge
Helpdesk : http://serverhedge.com/helpdesk

Comments

Sign In or Register to comment.
                                                               KVM VPS