Question : The Nautilus application development team recently finished the beta version of one of their Java-based applications, which they are planning to deploy on one of the app servers in Stratos DC. After an internal team meeting, they have decided to use the tomcat application server. Based on the requirements mentioned below complete the task:
a. Install tomcat server on App Server 2 using yum.
b. Configure it to run on port 5001.
c. There is a ROOT.war file on Jump host at location /tmp. Deploy it on this tomcat server and make sure the webpage works directly on base URL i.e without specifying any sub-directory anything like this http://URL/ROOT .
Please Note :- Perform the below commands based on your question server, user name & other details that might differ. So please read the task carefully before executing it. All the Best 👍
1. At first Copy the war file from the jump host to the app server given in the task
thor@jump_host
~$ scp /tmp/ROOT.war steve@stapp02:/tmp The authenticity
of host 'stapp02 (172.16.238.11)' can't be established. ECDSA key fingerprint
is SHA256:PsHLW7Xry4ZVVIXtMxKgTSzP7MWi12kd0+uj2GAMH6Y. ECDSA key
fingerprint is MD5:2e:91:19:02:cd:f4:0c:1b:b0:ba:6c:f4:bf:cd:ee:ac. Are you sure you
want to continue connecting (yes/no)? yes Warning:
Permanently added 'stapp02,172.16.238.11' (ECDSA) to the list of known hosts. steve@stapp02's
password: ROOT.war 100% 4529 8.0MB/s 00:00
thor@jump_host
~$ |
2.
Login on app server as per the task & Switch to root user
thor@jump_host
~$ ssh steve@stapp02 steve@stapp02's
password: [steve@stapp02
~]$ sudo su - We trust you
have received the usual lecture from the local System Administrator.
It usually boils down to these three things: #1) Respect the privacy of others. #2) Think before you type. #3) With great power comes great
responsibility. [sudo] password
for steve: [root@stapp02
~]# |
3. Install Tomcat Packages & configure ahead
[root@stapp02
~]# yum install -y tomcat Loaded plugins:
fastestmirror, ovl Loading mirror
speeds from cached hostfile * base: repos.forethought.net * extras: nyc.mirrors.clouvider.net * updates: mirrors.tummy.com Resolving
Dependencies --> Running
transaction check ---> Package
tomcat.noarch 0:7.0.76-16.el7_9 will be installed -->
Processing Dependency: tomcat-lib = 7.0.76-16.el7_9 for package:
tomcat-7.0.76-16.el7_9.noarch -->
Processing Dependency: java >= 1:1.6.0 for package:
tomcat-7.0.76-16.el7_9.noarch -->
Processing Dependency: apache-commons-pool for package:
tomcat-7.0.76-16.el7_9.noarch -->
Processing Dependency: apache-commons-logging for package:
tomcat-7.0.76-16.el7_9.noarch -->
Processing Dependency: apache-commons-dbcp for package:
tomcat-7.0.76-16.el7_9.noarch -->
Processing Dependency: apache-commons-daemon for package:
tomcat-7.0.76-16.el7_9.noarch --> Processing
Dependency: apache-commons-collections for package:
tomcat-7.0.76-16.el7_9.noarch --> Running
transaction check Installed: tomcat.noarch 0:7.0.76-16.el7_9
Dependency Installed: alsa-lib.x86_64 0:1.1.8-1.el7
apache-commons-collections.noarch 0:3.2.1-22.el7_2 apache-commons-daemon.x86_64 0:1.0.13-7.el7 apache-commons-dbcp.noarch
0:1.4-17.el7
apache-commons-logging.noarch 0:1.1.2-7.el7 apache-commons-pool.noarch 0:1.6-9.el7 atk.x86_64 0:2.28.1-2.el7 avahi-libs.x86_64
0:0.6.31-20.el7
avalon-framework.noarch 0:4.3-10.el7
Complete! [root@stapp02
~]# |
4. Edit the config file of the tomcat server and replace the port mentioned in the given task Connector port of non-ssl
[root@stapp02
~]# vi /usr/share/tomcat/conf/server.xml [root@stapp02
~]# cat /usr/share/tomcat/conf/server.xml |grep port <Server
port="8005" shutdown="SHUTDOWN"> Define a non-SSL HTTP/1.1 Connector
on port 8080 <Connector port="5001"
protocol="HTTP/1.1" port="5001"
protocol="HTTP/1.1" <!-- Define a SSL HTTP/1.1 Connector
on port 8443 <Connector port="8443"
protocol="org.apache.coyote.http11.Http11Protocol" <!-- Define an AJP 1.3 Connector on
port 8009 --> <Connector port="8009"
protocol="AJP/1.3" redirectPort="8443" /> <!-- You should set jvmRoute to
support load-balancing via AJP ie : [root@stapp02
~]# |
[root@stapp02
~]# cp /tmp/ROOT.war /usr/share/tomcat/webapps [root@stapp02
~]# ll /usr/share/tomcat/webapps/ total 12 drwxr-xr-x 4
tomcat tomcat 4096 Aug 8 08:46 ROOT -rw-r--r-- 1
root root 4529 Aug
8 08:45 ROOT.war [root@stapp02
~]# |
6. Start the tomcat service & check the status.
[root@stapp02
~]# systemctl start tomcat [root@stapp02
~]# systemctl status tomcat ● tomcat.service
- Apache Tomcat Web Application Container Loaded: loaded
(/usr/lib/systemd/system/tomcat.service; disabled; vendor preset: disabled) Active: active (running) since Sun
2021-08-08 08:46:04 UTC; 48s ago Main PID: 1116 (java) CGroup:
/docker/73869ed0e363f8a625313c5603b65543b827c271c2068016af6f249106668a39/system.slice/tomcat.service └─1116 /usr/lib/jvm/jre/bin/java
-Djavax.sql.DataSource.Factory=org.apache.commons.dbcp.BasicDataSourceFactory
-classpath /usr/share/tomcat/bin/bootstrap....
Aug 08 08:46:15
stapp02.stratos.xfusioncorp.com server[1116]: Aug 08, 2021 8:46:15 AM
org.apache.catalina.util.SessionIdGeneratorBase createSecureRandom Aug 08 08:46:15
stapp02.stratos.xfusioncorp.com server[1116]: INFO: Creation of SecureRandom
instance for session ID generation using [SHA1PRNG] took [327] m...seconds. Aug 08 08:46:15
stapp02.stratos.xfusioncorp.com server[1116]: Aug 08, 2021 8:46:15 AM
org.apache.catalina.startup.HostConfig deployWAR Aug 08 08:46:15
stapp02.stratos.xfusioncorp.com server[1116]: INFO: Deployment of web
application archive /var/lib/tomcat/webapps/ROOT.war has finished in 5,245 ms Aug 08 08:46:15
stapp02.stratos.xfusioncorp.com server[1116]: Aug 08, 2021 8:46:15 AM
org.apache.coyote.AbstractProtocol start Aug 08 08:46:15
stapp02.stratos.xfusioncorp.com server[1116]: INFO: Starting ProtocolHandler
["http-bio-5001"] Aug 08 08:46:15
stapp02.stratos.xfusioncorp.com server[1116]: Aug 08, 2021 8:46:15 AM
org.apache.coyote.AbstractProtocol start Aug 08 08:46:15
stapp02.stratos.xfusioncorp.com server[1116]: INFO: Starting ProtocolHandler
["ajp-bio-8009"] Aug 08 08:46:15
stapp02.stratos.xfusioncorp.com server[1116]: Aug 08, 2021 8:46:15 AM
org.apache.catalina.startup.Catalina start Aug 08 08:46:15
stapp02.stratos.xfusioncorp.com server[1116]: INFO: Server startup in 5614 ms Hint: Some lines
were ellipsized, use -l to show in full. [root@stapp02
~]# |
7. Validate the task by the below commands
[root@stapp02
~]# curl -i http://stapp02:5001 HTTP/1.1 200 OK Server:
Apache-Coyote/1.1 Accept-Ranges:
bytes ETag:
W/"471-1580289830000" Last-Modified:
Wed, 29 Jan 2020 09:23:50 GMT Content-Type:
text/html Content-Length:
471 Date: Sun, 08
Aug 2021 08:48:04 GMT
<!DOCTYPE
html> <!-- To change this
license header, choose License Headers in Project Properties. To change this
template file, choose Tools | Templates and open the
template in the editor. --> <html> <head>
<title>SampleWebApp</title> <meta
charset="UTF-8"> <meta name="viewport"
content="width=device-width, initial-scale=1.0"> </head> <body> <h2>Welcome to xFusionCorp
Industries!</h2> <br> </body> </html> [root@stapp02
~]# |
8. Click on Finish & Confirm to complete the task successfully
Happy Learning!!!!
2 Comments
Thanks for the instruction!
ReplyDeleteYou most welcome. Keep Learning
Delete