Task - Install and Configure Tomcat Server

Hello.

I would like to know why I failed this tank. Here are my steps:

1 - Installed Tomcat through yum
2 - Change Connector port in server.xml file to 8089
3 - Copied ROOT.war file to CATALINA_HOME/webapps
4 - Restarted Tomcat and accessed like the instructions said
5 - The website showed a site with “Welcome to xFusionCorp Industries!”

I could see the website, what did I get wrong?

I have completed below steps and its worked.

Copy from jump host to server

scp /tmp/ROOT.war banner@stapp03:/tmp

sudo yum install tomcat

Move war file to webapps directory after install

cp /tmp/ROOT.war /usr/share/tomcat/webapps

Edit file : change port in below part

vi /usr/share/tomcat/conf/server.xml


<!-- A "Connector" represents an endpoint by which requests are received

         and responses are returned. Documentation at :

         Java HTTP Connector: /docs/config/http.html (blocking & non-blocking)

         Java AJP  Connector: /docs/config/ajp.html

         APR (HTTP/AJP) Connector: /docs/apr.html

         Define a non-SSL HTTP/1.1 Connector on port 8080

    -->

    <Connector port="5003" protocol="HTTP/1.1"

               connectionTimeout="20000"

               redirectPort="8443" />

    <!-- A "Connector" using the shared thread pool-->

    <!--

    <Connector executor="tomcatThreadPool"

               port="5003" protocol="HTTP/1.1"

               connectionTimeout="20000"

               redirectPort="8443" />

    -->

sudo systemctl start tomcat

sudo systemctl status tomcat

sudo systemctl enable tomcat


One way to verify it was deployed successfully is to curl -i 172.16.238.12:5003

1 Like

Wondering if my solution for my last task can be reviewed, I feel it might have been checked wrong. it failed saying tomcat package is not found on app server 3. Mind boggling, I checked systemctl status tomcat and it was running.

This is what I did:

on app 3 server:

sudo yum install wget

sudo yum install -y firewalld
sudo systemctl enable firewalld
sudo systemctl start firewalld
sudo firewall-cmd --permanent --add-port=port-number/tcp
sudo firewall-cmd --reload

sudo bash firewalld.sh

sudo vi /etc/resolv.conf ------> nameserver 8.8.8.8

sudo yum install -y java-1.8.0-openjdk.x86_64

sudo groupadd tomcat
sudo mkdir /opt/tomcat
sudo useradd -s /bin/nologin -g tomcat -d /opt/tomcat tomcat

cd /tmp
sudo wget https://downloads.apache.org/tomcat/tomcat-10/v10.0.5/bin/apache-tomcat-10.0.5.tar.gz
cd /opt
sudo tar -xvf /tmp/apache-tomcat-10.0.5.tar.gz
sudo mv apache-tomcat-10.0.5 tomcat

sudo chown -R tomcat:tomcat /opt/tomcat


sudo vi /etc/systemd/system/tomcat.service
-----------
add :

[Unit]
Description=Apache Tomcat Web Application Container
After=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.sh
ExecStop=/bin/kill -15 $MAINPID

User=tomcat
Group=tomcat

[Install]
WantedBy=multi-user.target


sudo systemctl daemon-reload

sudo systemctl start tomcat
sudo systemctl enable tomcat

move ROOT file from jump server to app:
on jump server:
sudo scp /tmp/ROOT.war banner@stapp03:/home/banner

on app:
sudo cp ROOT.war /opt/tomcat/webapps/

sudo systemctl restart tomcat