Skip to main content

Amazon EC2 Server Setup & Installing JDK 8 and Tomcat 8, Running on Port 80 & 443 and Redirect Request from port 80 to 8080 and 443 to 8443

Amazon EC2 Server Setup & Installing JDK 8 and Tomcat 8, Running on Port 80 & 443 and Redirect Request from port 80 to 8080 and 443 to 8443.

Step 1 : Log in to your aws account by following this link

then click on my account and choose option aws management console.

Note: I am assuming you created your account with aws and you are ready with you account if you haven’t done then you can check out on google you will get many and it's a straight forward steps if you have still problem while creating an account you can comment in comment box i will also provide tutorial for that.

Once you logged in aws management console you are able to see window like this one


Note : Before we go ahead we have to select proper reason from right and side.I choose ohio region for this example.

Step 2 : Now you have to choose EC2 Server from Services tab on left side
top corner then choose EC2 Services from “Compute option


You will get window like this one and right now i have one instance is
running for our website but you will have zero instance if you haven't setup
any instance then you will have all the values will be 0 except security group.

Now you have to Launch Instance for that you have to click on Launch Instance
Button You will have  an Amazon Machine Image (AMI)  page.


Now if you are in free tier then click on Free tier only AMI on left and side
Once you done ! Now you can select AMI that are available under free tier.

Here i will choose Amazon Linux AMI 2018.03.0 (HVM), SSD Volume
Type - ami-922914f7

Why i am taking this AMI For following reason some of because in this AMI
i will get some pre-installed packages like different different jdk version
as well as tomcat version inside this image.

Note : You can also choose Ubuntu or any other Linux version but
i am choose amazon Linux

Then click on select option Now you will have choose an instance
type (type of process and memory instance storage and all)
I am under free tier so i will go for default option that is t2.micro instance.
Once we select then we have to go for Next : Configuration Instance Details

Step 3: Configure Instance Details
Don’t change any default option if you don’t have any prior knowledge of
aws services. Otherwise it may cost unexpected charges. And click on add
storage  again don’t change any default option keep it as it is give by default.

Step 4: Add Storage
Your instance will be launched with the following storage device settings.
You can attach additional EBS Volumes and instance store volumes to your
instance, or edit the settings of the root volumen. You can also attach
additional EBS volumes after launching an instance, but not instance store
volumes.
Next Add Tags.

To help you manage your instances, images, and other Amazon EC2 resources,
you can optionally assign your own metadata to each resource in the form of tags.
This topic describes tags and shows you how to create them.

Step 6 is : Configure Security Group

A security group is a set of firewall rules that control the traffic for your instance.
On this page, you can add rules to allow specific traffic to reach your instance.
For example, if you want to set up a web server and allow Internet traffic to
reach your instance, add rules that allow unrestricted access to the
HTTP and HTTPS ports. You can create a new security group or select
from an existing one below.

Note: This is very important step toward to connect your instance and to access your instance if you do small mistake then it would lead you disappoint. While defining your security rules keep in mind you have to also take care of your external thread suppose you defined some rules that would lead to damage/hack by other person. So define each rules very carefully.

Here i am defining some security rules like
1) To access EC2 instance through SSH(like putty ) we have to access it on port 22
2) To access EC2 instance through HTTP request we have to give an access it on port 80
3) To access EC2 instance through HTTPs(SSL) request we have to give an access it on port 443
4) To access your EC2 Instance through SMTP (Like filezilla) we have to allow it on port 25
5) To access your EC2 instance through tomcat that will be listing on port by default on 8080 so we have to also give an access to it.(Note later will redirect the request from 8080 to port 80 and 443 port request to 8443)

Note: Add all these ports and make their source custom to public (But it is not at all suggest to give all these port as public access but for sake of simplity i am allowing it. You can change their source later after lunch instance successfully as well as.)


After configuration security group you can Review and Launch an instance from bottom right corner.

Step 7 : Review Instance Launch page

This will show detailed information that we configured in last 6 steps after view your all the configuration you can click on lunch instance .
When you click on launch instance then you will get an pop window from where you have to create your key pair and give a valid name and then click on Download Key Pair or you can use existing key pair if you have already download. If you missed it you will lose your services access. So keep it at safe place. Because these key pair are used while we connect our server from ssh client like putty.


After downloading click on lunch instance

Final Step : After this you will have one running instance in you account and it will look like something


Connect AWS EC2 instance to ssh client

Before we go ahead we need to download software
1) Putty   
2) Puttygen Tool  
Once you download it then first you have to run Puttygen Tool


Now you have to import your private key as shown above by click on Conversions -> Import Now you have to select your .ppm file that you download while lunching an instance. Once you import it. Then click save your private key and save it with the same name as your .ppm file name that you created it. It will save your .ppm file to .ppk file.

Step 2 : Now you have to install putty and run it. Now at Hostname or IP address you have to define as public dns address from server page its look like something “ec2-35-173-241-195.compute-1.amazonaws.com”

You have to also need to specify your ppk file but before to specify it you have to go to connection → SSH → Auth  here at bottom you will get and browse option where you have to specify you puttegen ppk file then click on open.
It will propmt a cmd window below one you have to enter “ec2-user”
Here is sample image.

Now we are connected with our EC2 instance as ec2-user  through ssh.

First Update Amazon Linux AMI then we have to install JDK1.8 in EC2 instance .

Once you  connected to your EC2 server it will suggest the following command
Like to update your instance by follwoing this command

sudo yum update

To update all the packages.
But as i mentioned above your are looked in as ec2-user but to do some further operation i will logged in as root user for that you don’t need to do anything except this 2 word command like
sudo -s
Once you logged in as root user then we can any type of changes inside our EC2 instance.
Now i can use yum package manager to install other software like apache tomcat.
But first we have to check latest version of java that is present by default in this AMI for that i have to run this command like
java -version

Here its will sample output

It will display our current java version like depending on time you are seeing it. Right now while writing this tutorial its showing me jdk1.7 But i have been coding in java 8 so i have to install that For that i will run following command
For that i have to run the command
sudo yum list java*

It will list down show all the java package it has that present in yum package manager. So here we have java 6 available and we have java 7 and java 8 available so what we can do Then we have to copy the first part of jdk like java-1.8.0-openjdk

And then we have to run the following command like
sudo yum install java-1.8.0-openjdk

Once it runs. Our java installation is complete. So now can i run java 8 version ?
No !  You haven't set it as default java 8 so for that i have to run the following commands
Now i have 2 java version java 7 and java 8
So we have to use alternatives command like
sudo /usr/sbin/alternatives --config java
It will say 2 program is providing java one is java 7 which is selected by default and java 8 for that i have to enter 2 from keyword. If you want to keep java 7 version then you have to just enter key nothing else but if you want to choose java 8 then you have to enter 2 i have to enter it
One more command to alternatives is
sudo /usr/sbin/alternatives --config javac  
This command will make java compiler as java 8 as default compiler
Phase 4 : To install Apache Tomcat on AWS AMAZON EC2 instance
Now we have to install apache tomcat on linux ec2 server
We will use yum package manager to list down all the available package for tomcat
You have to run this command
yum list tomcat*

Now to install tomcat8 we have to run the following command

sudo yum install tomcat8

Now to manage tomcat web application i have also need to install tomcat admin webapps  manager panel or web interface to deploy our web application and undeploy our web application
For that i have to run the following command
sudo yum install tomcat8-admin-webapps


After installing we can start tomcat for that i will use
sudo services tomcat8 start
sudo services tomcat8 stop
sudo services tomcat8 restart


Because we have to use sudo for every time because we are running of behalf of root user

Once you execute start you tomcat then go to web browser and type your DNS:8080/manager/html

For example : ec2-35-171-242-195.compute1.amazonaws.com:8080/manager/html

It will ask for login but we haven’t stepu user for tomcat so when we click on cancle then it will be displayed like this one

Now we have to enable to user to sign to the user tomcat8 web apps interface for that i will have to change configuration first we have to know where is our tomcat configuration files are

For that i will use  command like
whereis tomcat8
So tomcat8 are available at /usr/share/tomcat8
So i have to goto this directory by typing command like
cd /usr/share/tomcat8
Now to list down all the folder and files inside this directory we have to use “ls” command. Now i have to goto “conf” folder to change configuration for tomcat web apps
“cd conf”
then “ls”
It will show all the present directory
In this directory we are looking for “tomcat-users.xml” file we have to change our configuration
We have to add to user role that is shown in 403 error page.
To edit this file i will use text editor that is “vi” which is default in this server, its not very convenient but we can edit easy.
sudo vi tomcat-users.xml
After opening this file you can go up and down on up and down key
Go to bottom the page before the </tomcat-users>
Now to enable this file for editing you have to use “o character “ from keyword
To save this file we have to enter esc button from keyword and “:wq “
To cross check our changes are made successfully or not we can re open this file by again this command and easily we can cross verify
sudo vi tomcat-users.xml
After making changes we have to take server restart for that i will use
sudo services tomcat8 restart
Now try to access your dns url with the following pattern you will still get an error then we have to change again
context.xml file that is present inside /usr/share/tomcat8 ----->  webapps → manager → META-INF → context.xml file
We have to comment the value tag that is present inside the Context tag like below code
<Context antiResourceLocking="false" privileged="true" >
<!--  <Valve className="org.apache.catalina.valves.RemoteAddrValve"
       allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" />
-->
<Manager sessionAttributeValueClassNameFilter="java\.lang\.(?:Boolean|Integer|Long|Number|String)|org\.apache\.catalina\.filters\.CsrfPreventionFilter\$LruCache(?:\$1)?|java\.util\.(?:Linked)?HashMap"/>
</Context>



  • Setting tomcat to run in ports 80 & 443:
    There are many ways to achieve this. Some of them need you to install an apache server, and handle the different XML configuration files, but I think that this is a quite easy way, and you don’t need to install anything else, you just need to learn a little bit on how to use iptables so you can redirect the requests from port 80 to 8080 and from port 443 to 8443.
    To do so, you can type in the following commands in your console:
# Checking the current iptables content on the prerouting table
$ sudo /sbin/iptables -L -n -t nat
# Adding the rules:
$ sudo /sbin/iptables -t nat -I PREROUTING -p tcp —-dport 80 -j REDIRECT --to-port 8080
$ sudo /sbin/iptables -t nat -I PREROUTING -p tcp --dport 443 -j REDIRECT --to-port 8443
# Checking that the rules were added succesfully
$ sudo /sbin/iptables -L -n -t nat
# Saving the rules
$ sudo /sbin/service iptables save
# Restarting ipTables:
$ sudo /etc/init.d/iptables restart

# Checking that the rules were saved succesfully
$ sudo /sbin/iptables -L -n -t nat


If you want to deploy application through filezilla then you have to change the following permission to the following file
The ec2-user don't have permission to write files in /var/lib/tomcat6/webapps/. Only root user can do so. You have two ways here to do so:
1) Copy files to /home/ec2-user/ using filezilla. Now SSH into linux machine through putty. Change to root user using command sudo -s. Then copy file from /home/ec2-user to /var/lib/tomcat6/webapps/ using command cp -i RealEstateERP.war  /var/lib/tomcat6/webapps/.
2) SSH into linux machine through putty.Change to root user using command sudo -s.Provide write permission to all users on /var/lib/tomcat6/webapps/ using command chmod 777 /var/lib/tomcat6/webapps/. Then copy files to directory directly from filezilla.

How to take backup of your project in aws EC2 Instance 

Like first you have to take your project backup so for that you can run different different command based on recuriements if you run directoly like 
sudo cp -i source_direcotry destination_direcotry or sudo cp source_direcotry destination_directory then it will raise an error like  :  cp : omitting direcotry '/usr/share/tomcat8/webapps/ROOT
so your ROOT folder consiste of sub folder then this above command doesn't work you have to run the following command sudo cp -r /usr/share/tomcat8/webapps/ROOT /usr/share/othogobackup/

https://askubuntu.com/questions/35779/what-does-cp-omitting-directory-mean

How to Deploy & Take Backup of Java Web Application At AWS EC2 Instance Through ssh.

Steps 1: 

Step 2: 



sudo chmod 777 /var/lib/tomcat8/webapps


If you want to enter in root user then use the following command
Sudo -s

If you want to exit from root user to back to ec2-user then use the following command like


All Commands
------------------
[root@ip-172-31-31-148 ec2-user]# java -version
java version "1.7.0_201"
OpenJDK Runtime Environment (amzn-2.6.16.0.78.amzn1-x86_64 u201-b00)
OpenJDK 64-Bit Server VM (build 24.201-b00, mixed mode)
[root@ip-172-31-31-148 ec2-user]# sudo yum install java-1.8.0-openjdk
Failed to set locale, defaulting to C
Loaded plugins: priorities, update-motd, upgrade-helper
amzn-main                                                                                                                                                                            | 2.1 kB  00:00:00     
amzn-updates                                                                                                                                                                         | 2.5 kB  00:00:00     
Resolving Dependencies
--> Running transaction check
---> Package java-1.8.0-openjdk.x86_64 1:1.8.0.191.b12-0.42.amzn1 will be installed
--> Processing Dependency: java-1.8.0-openjdk-headless(x86-64) = 1:1.8.0.191.b12-0.42.amzn1 for package: 1:java-1.8.0-openjdk-1.8.0.191.b12-0.42.amzn1.x86_64
--> Running transaction check
---> Package java-1.8.0-openjdk-headless.x86_64 1:1.8.0.191.b12-0.42.amzn1 will be installed
amzn-main/latest/filelists_db                                                                                                                                                        | 5.7 MB  00:00:00     
amzn-updates/latest/filelists_db                                                                                                                                                     | 6.1 MB  00:00:00     
--> Processing Dependency: lksctp-tools(x86-64) for package: 1:java-1.8.0-openjdk-headless-1.8.0.191.b12-0.42.amzn1.x86_64
--> Running transaction check
---> Package lksctp-tools.x86_64 0:1.0.10-7.7.amzn1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

============================================================================================================================================================================================================
 Package                                                   Arch                                 Version                                                    Repository                                  Size
============================================================================================================================================================================================================
Installing:
 java-1.8.0-openjdk                                        x86_64                               1:1.8.0.191.b12-0.42.amzn1                                 amzn-updates                               255 k
Installing for dependencies:
 java-1.8.0-openjdk-headless                               x86_64                               1:1.8.0.191.b12-0.42.amzn1                                 amzn-updates                                39 M
 lksctp-tools                                              x86_64                               1.0.10-7.7.amzn1                                           amzn-main                                   89 k

Transaction Summary
============================================================================================================================================================================================================
Install  1 Package (+2 Dependent packages)

Total download size: 39 M
Installed size: 104 M
Is this ok [y/d/N]: y
Downloading packages:
(1/3): java-1.8.0-openjdk-1.8.0.191.b12-0.42.amzn1.x86_64.rpm                                                                                                                        | 255 kB  00:00:00     
(2/3): lksctp-tools-1.0.10-7.7.amzn1.x86_64.rpm                                                                                                                                      |  89 kB  00:00:00     
(3/3): java-1.8.0-openjdk-headless-1.8.0.191.b12-0.42.amzn1.x86_64.rpm                                                                                                               |  39 MB  00:00:00     
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                        57 MB/s |  39 MB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : lksctp-tools-1.0.10-7.7.amzn1.x86_64                                                                                                                                                     1/3 
  Installing : 1:java-1.8.0-openjdk-headless-1.8.0.191.b12-0.42.amzn1.x86_64                                                                                                                            2/3 
  Installing : 1:java-1.8.0-openjdk-1.8.0.191.b12-0.42.amzn1.x86_64                                                                                                                                     3/3 
  Verifying  : lksctp-tools-1.0.10-7.7.amzn1.x86_64                                                                                                                                                     1/3 
  Verifying  : 1:java-1.8.0-openjdk-headless-1.8.0.191.b12-0.42.amzn1.x86_64                                                                                                                            2/3 
  Verifying  : 1:java-1.8.0-openjdk-1.8.0.191.b12-0.42.amzn1.x86_64                                                                                                                                     3/3 

Installed:
  java-1.8.0-openjdk.x86_64 1:1.8.0.191.b12-0.42.amzn1                                                                                                                                                      

Dependency Installed:
  java-1.8.0-openjdk-headless.x86_64 1:1.8.0.191.b12-0.42.amzn1                                                    lksctp-tools.x86_64 0:1.0.10-7.7.amzn1                                                   

Complete!
[root@ip-172-31-31-148 ec2-user]# java -version
java version "1.7.0_201"
OpenJDK Runtime Environment (amzn-2.6.16.0.78.amzn1-x86_64 u201-b00)
OpenJDK 64-Bit Server VM (build 24.201-b00, mixed mode)
[root@ip-172-31-31-148 ec2-user]# sudo /usr/sbin/alternatives --config java

There are 2 programs which provide 'java'.

  Selection    Command
-----------------------------------------------
*+ 1           /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/java
   2           /usr/lib/jvm/jre-1.8.0-openjdk.x86_64/bin/java

Enter to keep the current selection[+], or type selection number: 2
[root@ip-172-31-31-148 ec2-user]# sudo /usr/sbin/alternatives --config javac
[root@ip-172-31-31-148 ec2-user]# java -version
openjdk version "1.8.0_191"
OpenJDK Runtime Environment (build 1.8.0_191-b12)
OpenJDK 64-Bit Server VM (build 25.191-b12, mixed mode)
[root@ip-172-31-31-148 ec2-user]# sudo yum install tomcat8
Failed to set locale, defaulting to C
Loaded plugins: priorities, update-motd, upgrade-helper
Resolving Dependencies
--> Running transaction check
---> Package tomcat8.noarch 0:8.5.32-1.78.amzn1 will be installed
--> Processing Dependency: tomcat8-lib = 8.5.32-1.78.amzn1 for package: tomcat8-8.5.32-1.78.amzn1.noarch
--> Processing Dependency: apache-commons-pool for package: tomcat8-8.5.32-1.78.amzn1.noarch
--> Processing Dependency: apache-commons-logging for package: tomcat8-8.5.32-1.78.amzn1.noarch
--> Processing Dependency: apache-commons-dbcp for package: tomcat8-8.5.32-1.78.amzn1.noarch
--> Processing Dependency: apache-commons-daemon for package: tomcat8-8.5.32-1.78.amzn1.noarch
--> Processing Dependency: apache-commons-collections for package: tomcat8-8.5.32-1.78.amzn1.noarch
--> Running transaction check
---> Package apache-commons-collections.noarch 0:3.2.2-3.10.amzn1 will be installed
---> Package apache-commons-daemon.x86_64 0:1.0.7-1.6.amzn1 will be installed
---> Package apache-commons-dbcp.noarch 0:1.4-7.7.amzn1 will be installed
---> Package apache-commons-logging.noarch 0:1.1.1-16.8.amzn1 will be installed
---> Package apache-commons-pool.noarch 0:1.5.6-1.7.amzn1 will be installed
---> Package tomcat8-lib.noarch 0:8.5.32-1.78.amzn1 will be installed
--> Processing Dependency: tomcat8-servlet-3.1-api = 8.5.32-1.78.amzn1 for package: tomcat8-lib-8.5.32-1.78.amzn1.noarch
--> Processing Dependency: tomcat8-jsp-2.3-api = 8.5.32-1.78.amzn1 for package: tomcat8-lib-8.5.32-1.78.amzn1.noarch
--> Processing Dependency: tomcat8-el-3.0-api = 8.5.32-1.78.amzn1 for package: tomcat8-lib-8.5.32-1.78.amzn1.noarch
--> Processing Dependency: ecj >= 1:4.2.1 for package: tomcat8-lib-8.5.32-1.78.amzn1.noarch
--> Running transaction check
---> Package ecj.x86_64 1:4.2.1-4.15.amzn1 will be installed
---> Package tomcat8-el-3.0-api.noarch 0:8.5.32-1.78.amzn1 will be installed
---> Package tomcat8-jsp-2.3-api.noarch 0:8.5.32-1.78.amzn1 will be installed
---> Package tomcat8-servlet-3.1-api.noarch 0:8.5.32-1.78.amzn1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

============================================================================================================================================================================================================
 Package                                                    Arch                                   Version                                               Repository                                    Size
============================================================================================================================================================================================================
Installing:
 tomcat8                                                    noarch                                 8.5.32-1.78.amzn1                                     amzn-updates                                 102 k
Installing for dependencies:
 apache-commons-collections                                 noarch                                 3.2.2-3.10.amzn1                                      amzn-main                                    531 k
 apache-commons-daemon                                      x86_64                                 1.0.7-1.6.amzn1                                       amzn-main                                     51 k
 apache-commons-dbcp                                        noarch                                 1.4-7.7.amzn1                                         amzn-main                                    161 k
 apache-commons-logging                                     noarch                                 1.1.1-16.8.amzn1                                      amzn-main                                    131 k
 apache-commons-pool                                        noarch                                 1.5.6-1.7.amzn1                                       amzn-main                                    101 k
 ecj                                                        x86_64                                 1:4.2.1-4.15.amzn1                                    amzn-main                                    1.4 M
 tomcat8-el-3.0-api                                         noarch                                 8.5.32-1.78.amzn1                                     amzn-updates                                 106 k
 tomcat8-jsp-2.3-api                                        noarch                                 8.5.32-1.78.amzn1                                     amzn-updates                                  68 k
 tomcat8-lib                                                noarch                                 8.5.32-1.78.amzn1                                     amzn-updates                                 4.3 M
 tomcat8-servlet-3.1-api                                    noarch                                 8.5.32-1.78.amzn1                                     amzn-updates                                 255 k

Transaction Summary
============================================================================================================================================================================================================
Install  1 Package (+10 Dependent packages)

Total download size: 7.1 M
Installed size: 8.1 M
Is this ok [y/d/N]: y
Downloading packages:
(1/11): apache-commons-daemon-1.0.7-1.6.amzn1.x86_64.rpm                                                                                                                             |  51 kB  00:00:00     
(2/11): apache-commons-collections-3.2.2-3.10.amzn1.noarch.rpm                                                                                                                       | 531 kB  00:00:00     
(3/11): apache-commons-dbcp-1.4-7.7.amzn1.noarch.rpm                                                                                                                                 | 161 kB  00:00:00     
(4/11): apache-commons-logging-1.1.1-16.8.amzn1.noarch.rpm                                                                                                                           | 131 kB  00:00:00     
(5/11): apache-commons-pool-1.5.6-1.7.amzn1.noarch.rpm                                                                                                                               | 101 kB  00:00:00     
(6/11): ecj-4.2.1-4.15.amzn1.x86_64.rpm                                                                                                                                              | 1.4 MB  00:00:00     
(7/11): tomcat8-el-3.0-api-8.5.32-1.78.amzn1.noarch.rpm                                                                                                                              | 106 kB  00:00:00     
(8/11): tomcat8-8.5.32-1.78.amzn1.noarch.rpm                                                                                                                                         | 102 kB  00:00:00     
(9/11): tomcat8-jsp-2.3-api-8.5.32-1.78.amzn1.noarch.rpm                                                                                                                             |  68 kB  00:00:00     
(10/11): tomcat8-servlet-3.1-api-8.5.32-1.78.amzn1.noarch.rpm                                                                                                                        | 255 kB  00:00:00     
(11/11): tomcat8-lib-8.5.32-1.78.amzn1.noarch.rpm                                                                                                                                    | 4.3 MB  00:00:00     
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                        13 MB/s | 7.1 MB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : apache-commons-pool-1.5.6-1.7.amzn1.noarch                                                                                                                                              1/11 
  Installing : apache-commons-dbcp-1.4-7.7.amzn1.noarch                                                                                                                                                2/11 
  Installing : tomcat8-servlet-3.1-api-8.5.32-1.78.amzn1.noarch                                                                                                                                        3/11 
  Installing : apache-commons-collections-3.2.2-3.10.amzn1.noarch                                                                                                                                      4/11 
  Installing : tomcat8-el-3.0-api-8.5.32-1.78.amzn1.noarch                                                                                                                                             5/11 
  Installing : tomcat8-jsp-2.3-api-8.5.32-1.78.amzn1.noarch                                                                                                                                            6/11 
  Installing : apache-commons-logging-1.1.1-16.8.amzn1.noarch                                                                                                                                          7/11 
  Installing : apache-commons-daemon-1.0.7-1.6.amzn1.x86_64                                                                                                                                            8/11 
  Installing : 1:ecj-4.2.1-4.15.amzn1.x86_64                                                                                                                                                           9/11 
  Installing : tomcat8-lib-8.5.32-1.78.amzn1.noarch                                                                                                                                                   10/11 
  Installing : tomcat8-8.5.32-1.78.amzn1.noarch                                                                                                                                                       11/11 
  Verifying  : apache-commons-pool-1.5.6-1.7.amzn1.noarch                                                                                                                                              1/11 
  Verifying  : 1:ecj-4.2.1-4.15.amzn1.x86_64                                                                                                                                                           2/11 
  Verifying  : apache-commons-daemon-1.0.7-1.6.amzn1.x86_64                                                                                                                                            3/11 
  Verifying  : tomcat8-lib-8.5.32-1.78.amzn1.noarch                                                                                                                                                    4/11 
  Verifying  : tomcat8-el-3.0-api-8.5.32-1.78.amzn1.noarch                                                                                                                                             5/11 
  Verifying  : apache-commons-logging-1.1.1-16.8.amzn1.noarch                                                                                                                                          6/11 
  Verifying  : tomcat8-8.5.32-1.78.amzn1.noarch                                                                                                                                                        7/11 
  Verifying  : apache-commons-dbcp-1.4-7.7.amzn1.noarch                                                                                                                                                8/11 
  Verifying  : tomcat8-jsp-2.3-api-8.5.32-1.78.amzn1.noarch                                                                                                                                            9/11 
  Verifying  : apache-commons-collections-3.2.2-3.10.amzn1.noarch                                                                                                                                     10/11 
  Verifying  : tomcat8-servlet-3.1-api-8.5.32-1.78.amzn1.noarch                                                                                                                                       11/11 

Installed:
  tomcat8.noarch 0:8.5.32-1.78.amzn1                                                                                                                                                                        

Dependency Installed:
  apache-commons-collections.noarch 0:3.2.2-3.10.amzn1  apache-commons-daemon.x86_64 0:1.0.7-1.6.amzn1      apache-commons-dbcp.noarch 0:1.4-7.7.amzn1     apache-commons-logging.noarch 0:1.1.1-16.8.amzn1 
  apache-commons-pool.noarch 0:1.5.6-1.7.amzn1          ecj.x86_64 1:4.2.1-4.15.amzn1                       tomcat8-el-3.0-api.noarch 0:8.5.32-1.78.amzn1  tomcat8-jsp-2.3-api.noarch 0:8.5.32-1.78.amzn1   
  tomcat8-lib.noarch 0:8.5.32-1.78.amzn1                tomcat8-servlet-3.1-api.noarch 0:8.5.32-1.78.amzn1 

Complete!
[root@ip-172-31-31-148 ec2-user]# sudo yum install tomcat8-admin-webapps
Failed to set locale, defaulting to C
Loaded plugins: priorities, update-motd, upgrade-helper
Resolving Dependencies
--> Running transaction check
---> Package tomcat8-admin-webapps.noarch 0:8.5.32-1.78.amzn1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

============================================================================================================================================================================================================
 Package                                                 Arch                                     Version                                              Repository                                      Size
============================================================================================================================================================================================================
Installing:
 tomcat8-admin-webapps                                   noarch                                   8.5.32-1.78.amzn1                                    amzn-updates                                    54 k

Transaction Summary
============================================================================================================================================================================================================
Install  1 Package

Total download size: 54 k
Installed size: 124 k
Is this ok [y/d/N]: y
Downloading packages:
tomcat8-admin-webapps-8.5.32-1.78.amzn1.noarch.rpm                                                                                                                                   |  54 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : tomcat8-admin-webapps-8.5.32-1.78.amzn1.noarch                                                                                                                                           1/1 
  Verifying  : tomcat8-admin-webapps-8.5.32-1.78.amzn1.noarch                                                                                                                                           1/1 

Installed:
  tomcat8-admin-webapps.noarch 0:8.5.32-1.78.amzn1                                                                                                                                                          

Complete!
[root@ip-172-31-31-148 ec2-user]# whereis tomcat8
tomcat8: /usr/sbin/tomcat8 /etc/tomcat8 /usr/libexec/tomcat8 /usr/share/tomcat8
[root@ip-172-31-31-148 ec2-user]# cd /usr/share/tomcat8/conf/
[root@ip-172-31-31-148 conf]# ls
Catalina  catalina.policy  catalina.properties  context.xml  jaspic-providers.xml  logging.properties  server.xml  tomcat-users.xml  tomcat8.conf  web.xml
[root@ip-172-31-31-148 conf]# sudo vi tomcat-users.xml 
[root@ip-172-31-31-148 conf]# sudo vi tomcat-users.xml 
[root@ip-172-31-31-148 conf]# cd ..
[root@ip-172-31-31-148 tomcat8]# ls
bin  conf  lib  logs  temp  webapps  work
[root@ip-172-31-31-148 tomcat8]# cd webapps/manager/META-INF/
[root@ip-172-31-31-148 META-INF]# ls
context.xml
[root@ip-172-31-31-148 META-INF]# sudo vi context.xml 
[root@ip-172-31-31-148 META-INF]# sudo /sbin/iptables -L -n -t nat
Chain PREROUTING (policy ACCEPT)
target     prot opt source               destination         

Chain INPUT (policy ACCEPT)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         

Chain POSTROUTING (policy ACCEPT)
target     prot opt source               destination         
[root@ip-172-31-31-148 META-INF]# sudo /sbin/iptables -t nat -I PREROUTING -p tcp --dport 80 -J REDIRECT --to-port 8080
iptables v1.4.18: unknown option "-J"
Try `iptables -h' or 'iptables --help' for more information.
[root@ip-172-31-31-148 META-INF]# sudo /sbin/iptables -t nat -I PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080
[root@ip-172-31-31-148 META-INF]# sudo /sbin/iptables -t nat -I PREROUTING -p tcp --dport 443 -j REDIRECT --to-port 8443
[root@ip-172-31-31-148 META-INF]# sudo /sbin/iptables -L -n -t nat
Chain PREROUTING (policy ACCEPT)
target     prot opt source               destination         
REDIRECT   tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:443 redir ports 8443
REDIRECT   tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:80 redir ports 8080

Chain INPUT (policy ACCEPT)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         

Chain POSTROUTING (policy ACCEPT)
target     prot opt source               destination         
[root@ip-172-31-31-148 META-INF]# sudo /etc/init.d/iptables restart
iptables: Flushing firewall rules:                         [  OK  ]
iptables: Setting chains to policy ACCEPT: nat             [  OK  ]
iptables: Unloading modules:                               [  OK  ]
[root@ip-172-31-31-148 META-INF]# 
[root@ip-172-31-31-148 META-INF]# 
[root@ip-172-31-31-148 META-INF]# sudo /sbin/iptables -L -n -t nat
Chain PREROUTING (policy ACCEPT)
target     prot opt source               destination         

Chain INPUT (policy ACCEPT)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         

Chain POSTROUTING (policy ACCEPT)
target     prot opt source               destination         
[root@ip-172-31-31-148 META-INF]# sudo /sbin/iptables -t nat -I PREROUTING -p tcp --dport 443 -j REDIRECT --to-port 8443
[root@ip-172-31-31-148 META-INF]# sudo /sbin/iptables -t nat -I PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080
[root@ip-172-31-31-148 META-INF]# sudo /sbin/service iptables save
iptables: Saving firewall rules to /etc/sysconfig/iptables:[  OK  ]
[root@ip-172-31-31-148 META-INF]# sudo /etc/init.d/iptables restart
iptables: Flushing firewall rules:                         [  OK  ]
iptables: Setting chains to policy ACCEPT: nat             [  OK  ]
iptables: Unloading modules:                               [  OK  ]
iptables: Applying firewall rules:                         [  OK  ]
[root@ip-172-31-31-148 META-INF]# sudo /sbin/iptables -L -n -t nat
Chain PREROUTING (policy ACCEPT)
target     prot opt source               destination         
REDIRECT   tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:80 redir ports 8080
REDIRECT   tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:443 redir ports 8443

Chain INPUT (policy ACCEPT)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         

Chain POSTROUTING (policy ACCEPT)
target     prot opt source               destination         
[root@ip-172-31-31-148 META-INF]# sudo service tomcat8 restart
[root@ip-172-31-31-148 META-INF]#                          [  OK  ]



Complete Steps to Setup EC2 Instance on AWS

Mukeshs-MacBook-Air:~ mukeshchoudhary$ sudo ssh -i Desktop/AWS-2019/dubaievisaonline.pem ec2-user@ec2-15-206-136-84.ap-south-1.compute.amazonaws.com
Password:
The authenticity of host 'ec2-15-206-136-84.ap-south-1.compute.amazonaws.com (15.206.136.84)' can't be established.
ECDSA key fingerprint is SHA256:mQ1cJ8SpMcZo8odMkVRFEY32Ms3ixlAoyOFET+BQHx8.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'ec2-15-206-136-84.ap-south-1.compute.amazonaws.com,15.206.136.84' (ECDSA) to the list of known hosts.

       __|  __|_  )
       _|  (     /   Amazon Linux AMI
      ___|\___|___|

https://aws.amazon.com/amazon-linux-ami/2018.03-release-notes/
10 package(s) needed for security, out of 18 available
Run "sudo yum update" to apply all updates.
-bash: warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory
[ec2-user@ip-172-31-15-220 ~]$ clear















































[ec2-user@ip-172-31-15-220 ~]$ ls
[ec2-user@ip-172-31-15-220 ~]$ 
[ec2-user@ip-172-31-15-220 ~]$ 
[ec2-user@ip-172-31-15-220 ~]$ 
[ec2-user@ip-172-31-15-220 ~]$ sudo sudo yum update
Failed to set locale, defaulting to C
Loaded plugins: priorities, update-motd, upgrade-helper
amzn-main                                                                                                                                                                            | 2.1 kB  00:00:00     
amzn-updates                                                                                                                                                                         | 2.5 kB  00:00:00     
Resolving Dependencies
--> Running transaction check
---> Package curl.x86_64 0:7.61.1-11.91.amzn1 will be updated
---> Package curl.x86_64 0:7.61.1-12.93.amzn1 will be an update
---> Package ec2-net-utils.noarch 0:0.5-2.35.amzn1 will be updated
---> Package ec2-net-utils.noarch 0:0.5-3.36.amzn1 will be an update
---> Package ec2-utils.noarch 0:0.5-2.35.amzn1 will be updated
---> Package ec2-utils.noarch 0:0.5-3.36.amzn1 will be an update
---> Package kernel.x86_64 0:4.14.146-93.123.amzn1 will be installed
---> Package libblkid.x86_64 0:2.23.2-33.28.amzn1 will be updated
---> Package libblkid.x86_64 0:2.23.2-59.29.amzn1 will be an update
---> Package libcurl.x86_64 0:7.61.1-11.91.amzn1 will be updated
---> Package libcurl.x86_64 0:7.61.1-12.93.amzn1 will be an update
---> Package libjpeg-turbo.x86_64 0:1.2.90-5.14.amzn1 will be updated
---> Package libjpeg-turbo.x86_64 0:1.2.90-8.16.amzn1 will be an update
---> Package libmount.x86_64 0:2.23.2-33.28.amzn1 will be updated
---> Package libmount.x86_64 0:2.23.2-59.29.amzn1 will be an update
---> Package libuuid.x86_64 0:2.23.2-33.28.amzn1 will be updated
---> Package libuuid.x86_64 0:2.23.2-59.29.amzn1 will be an update
---> Package openssh.x86_64 0:7.4p1-16.71.amzn1 will be updated
---> Package openssh.x86_64 0:7.4p1-21.73.amzn1 will be an update
---> Package openssh-clients.x86_64 0:7.4p1-16.71.amzn1 will be updated
---> Package openssh-clients.x86_64 0:7.4p1-21.73.amzn1 will be an update
---> Package openssh-server.x86_64 0:7.4p1-16.71.amzn1 will be updated
---> Package openssh-server.x86_64 0:7.4p1-21.73.amzn1 will be an update
---> Package python27.x86_64 0:2.7.16-1.129.amzn1 will be updated
---> Package python27.x86_64 0:2.7.16-1.130.amzn1 will be an update
---> Package python27-devel.x86_64 0:2.7.16-1.129.amzn1 will be updated
---> Package python27-devel.x86_64 0:2.7.16-1.130.amzn1 will be an update
---> Package python27-libs.x86_64 0:2.7.16-1.129.amzn1 will be updated
---> Package python27-libs.x86_64 0:2.7.16-1.130.amzn1 will be an update
---> Package tzdata.noarch 0:2019a-1.71.amzn1 will be updated
---> Package tzdata.noarch 0:2019c-1.73.amzn1 will be an update
---> Package tzdata-java.noarch 0:2019a-1.71.amzn1 will be updated
---> Package tzdata-java.noarch 0:2019c-1.73.amzn1 will be an update
---> Package util-linux.x86_64 0:2.23.2-33.28.amzn1 will be updated
---> Package util-linux.x86_64 0:2.23.2-59.29.amzn1 will be an update
--> Processing Dependency: libsmartcols = 2.23.2-59.29.amzn1 for package: util-linux-2.23.2-59.29.amzn1.x86_64
--> Processing Dependency: libsmartcols.so.1(SMARTCOLS_2.25)(64bit) for package: util-linux-2.23.2-59.29.amzn1.x86_64
--> Processing Dependency: libsmartcols.so.1()(64bit) for package: util-linux-2.23.2-59.29.amzn1.x86_64
--> Running transaction check
---> Package libsmartcols.x86_64 0:2.23.2-59.29.amzn1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

============================================================================================================================================================================================================
 Package                                           Arch                                     Version                                                    Repository                                      Size
============================================================================================================================================================================================================
Installing:
 kernel                                            x86_64                                   4.14.146-93.123.amzn1                                      amzn-updates                                    22 M
Updating:
 curl                                              x86_64                                   7.61.1-12.93.amzn1                                         amzn-updates                                   363 k
 ec2-net-utils                                     noarch                                   0.5-3.36.amzn1                                             amzn-updates                                    14 k
 ec2-utils                                         noarch                                   0.5-3.36.amzn1                                             amzn-updates                                    12 k
 libblkid                                          x86_64                                   2.23.2-59.29.amzn1                                         amzn-updates                                   187 k
 libcurl                                           x86_64                                   7.61.1-12.93.amzn1                                         amzn-updates                                   307 k
 libjpeg-turbo                                     x86_64                                   1.2.90-8.16.amzn1                                          amzn-updates                                   144 k
 libmount                                          x86_64                                   2.23.2-59.29.amzn1                                         amzn-updates                                   192 k
 libuuid                                           x86_64                                   2.23.2-59.29.amzn1                                         amzn-updates                                    84 k
 openssh                                           x86_64                                   7.4p1-21.73.amzn1                                          amzn-updates                                   640 k
 openssh-clients                                   x86_64                                   7.4p1-21.73.amzn1                                          amzn-updates                                   1.1 M
 openssh-server                                    x86_64                                   7.4p1-21.73.amzn1                                          amzn-updates                                   512 k
 python27                                          x86_64                                   2.7.16-1.130.amzn1                                         amzn-updates                                   103 k
 python27-devel                                    x86_64                                   2.7.16-1.130.amzn1                                         amzn-updates                                   525 k
 python27-libs                                     x86_64                                   2.7.16-1.130.amzn1                                         amzn-updates                                   6.8 M
 tzdata                                            noarch                                   2019c-1.73.amzn1                                           amzn-updates                                   835 k
 tzdata-java                                       noarch                                   2019c-1.73.amzn1                                           amzn-updates                                   230 k
 util-linux                                        x86_64                                   2.23.2-59.29.amzn1                                         amzn-updates                                   3.1 M
Installing for dependencies:
 libsmartcols                                      x86_64                                   2.23.2-59.29.amzn1                                         amzn-updates                                   146 k

Transaction Summary
============================================================================================================================================================================================================
Install   1 Package  (+1 Dependent package)
Upgrade  17 Packages

Total download size: 37 M
Is this ok [y/d/N]: y
Downloading packages:
(1/19): ec2-net-utils-0.5-3.36.amzn1.noarch.rpm                                                                                                                                      |  14 kB  00:00:00     
(2/19): ec2-utils-0.5-3.36.amzn1.noarch.rpm                                                                                                                                          |  12 kB  00:00:00     
(3/19): curl-7.61.1-12.93.amzn1.x86_64.rpm                                                                                                                                           | 363 kB  00:00:00     
(4/19): libblkid-2.23.2-59.29.amzn1.x86_64.rpm                                                                                                                                       | 187 kB  00:00:00     
(5/19): libjpeg-turbo-1.2.90-8.16.amzn1.x86_64.rpm                                                                                                                                   | 144 kB  00:00:00     
(6/19): libmount-2.23.2-59.29.amzn1.x86_64.rpm                                                                                                                                       | 192 kB  00:00:00     
(7/19): libcurl-7.61.1-12.93.amzn1.x86_64.rpm                                                                                                                                        | 307 kB  00:00:00     
(8/19): libsmartcols-2.23.2-59.29.amzn1.x86_64.rpm                                                                                                                                   | 146 kB  00:00:00     
(9/19): libuuid-2.23.2-59.29.amzn1.x86_64.rpm                                                                                                                                        |  84 kB  00:00:00     
(10/19): openssh-7.4p1-21.73.amzn1.x86_64.rpm                                                                                                                                        | 640 kB  00:00:00     
(11/19): openssh-clients-7.4p1-21.73.amzn1.x86_64.rpm                                                                                                                                | 1.1 MB  00:00:00     
(12/19): python27-2.7.16-1.130.amzn1.x86_64.rpm                                                                                                                                      | 103 kB  00:00:00     
(13/19): openssh-server-7.4p1-21.73.amzn1.x86_64.rpm                                                                                                                                 | 512 kB  00:00:00     
(14/19): python27-devel-2.7.16-1.130.amzn1.x86_64.rpm                                                                                                                                | 525 kB  00:00:00     
(15/19): tzdata-2019c-1.73.amzn1.noarch.rpm                                                                                                                                          | 835 kB  00:00:00     
(16/19): python27-libs-2.7.16-1.130.amzn1.x86_64.rpm                                                                                                                                 | 6.8 MB  00:00:00     
(17/19): tzdata-java-2019c-1.73.amzn1.noarch.rpm                                                                                                                                     | 230 kB  00:00:00     
(18/19): util-linux-2.23.2-59.29.amzn1.x86_64.rpm                                                                                                                                    | 3.1 MB  00:00:01     
(19/19): kernel-4.14.146-93.123.amzn1.x86_64.rpm                                                                                                                                     |  22 MB  00:00:03     
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                       9.0 MB/s |  37 MB  00:00:04     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Updating   : libuuid-2.23.2-59.29.amzn1.x86_64                                                                                                                                                       1/36 
  Updating   : libblkid-2.23.2-59.29.amzn1.x86_64                                                                                                                                                      2/36 
  Updating   : python27-2.7.16-1.130.amzn1.x86_64                                                                                                                                                      3/36 
  Updating   : python27-libs-2.7.16-1.130.amzn1.x86_64                                                                                                                                                 4/36 
  Updating   : libmount-2.23.2-59.29.amzn1.x86_64                                                                                                                                                      5/36 
  Updating   : libcurl-7.61.1-12.93.amzn1.x86_64                                                                                                                                                       6/36 
  Updating   : curl-7.61.1-12.93.amzn1.x86_64                                                                                                                                                          7/36 
  Installing : libsmartcols-2.23.2-59.29.amzn1.x86_64                                                                                                                                                  8/36 
  Updating   : util-linux-2.23.2-59.29.amzn1.x86_64                                                                                                                                                    9/36 
  Updating   : openssh-7.4p1-21.73.amzn1.x86_64                                                                                                                                                       10/36 
  Updating   : openssh-server-7.4p1-21.73.amzn1.x86_64                                                                                                                                                11/36 
  Updating   : openssh-clients-7.4p1-21.73.amzn1.x86_64                                                                                                                                               12/36 
  Updating   : ec2-utils-0.5-3.36.amzn1.noarch                                                                                                                                                        13/36 
  Updating   : ec2-net-utils-0.5-3.36.amzn1.noarch                                                                                                                                                    14/36 
  Updating   : python27-devel-2.7.16-1.130.amzn1.x86_64                                                                                                                                               15/36 
  Updating   : libjpeg-turbo-1.2.90-8.16.amzn1.x86_64                                                                                                                                                 16/36 
  Updating   : tzdata-2019c-1.73.amzn1.noarch                                                                                                                                                         17/36 
  Updating   : tzdata-java-2019c-1.73.amzn1.noarch                                                                                                                                                    18/36 
  Installing : kernel-4.14.146-93.123.amzn1.x86_64                                                                                                                                                    19/36 
  Cleanup    : python27-devel-2.7.16-1.129.amzn1.x86_64                                                                                                                                               20/36 
  Cleanup    : ec2-net-utils-0.5-2.35.amzn1.noarch                                                                                                                                                    21/36 
  Cleanup    : ec2-utils-0.5-2.35.amzn1.noarch                                                                                                                                                        22/36 
  Cleanup    : curl-7.61.1-11.91.amzn1.x86_64                                                                                                                                                         23/36 
  Cleanup    : python27-2.7.16-1.129.amzn1.x86_64                                                                                                                                                     24/36 
  Cleanup    : python27-libs-2.7.16-1.129.amzn1.x86_64                                                                                                                                                25/36 
  Cleanup    : openssh-clients-7.4p1-16.71.amzn1.x86_64                                                                                                                                               26/36 
  Cleanup    : openssh-server-7.4p1-16.71.amzn1.x86_64                                                                                                                                                27/36 
  Cleanup    : tzdata-2019a-1.71.amzn1.noarch                                                                                                                                                         28/36 
  Cleanup    : tzdata-java-2019a-1.71.amzn1.noarch                                                                                                                                                    29/36 
  Cleanup    : openssh-7.4p1-16.71.amzn1.x86_64                                                                                                                                                       30/36 
  Cleanup    : util-linux-2.23.2-33.28.amzn1.x86_64                                                                                                                                                   31/36 
  Cleanup    : libmount-2.23.2-33.28.amzn1.x86_64                                                                                                                                                     32/36 
  Cleanup    : libblkid-2.23.2-33.28.amzn1.x86_64                                                                                                                                                     33/36 
  Cleanup    : libuuid-2.23.2-33.28.amzn1.x86_64                                                                                                                                                      34/36 
  Cleanup    : libcurl-7.61.1-11.91.amzn1.x86_64                                                                                                                                                      35/36 
  Cleanup    : libjpeg-turbo-1.2.90-5.14.amzn1.x86_64                                                                                                                                                 36/36 
intel: model '', path ' intel-ucode/*', kvers ''
intel: blacklist ''
intel-06-4f-01: model 'GenuineIntel 06-4f-01', path ' intel-ucode/06-4f-01', kvers ' 4.14.42'
intel-06-4f-01: blacklist ''
  Verifying  : python27-libs-2.7.16-1.130.amzn1.x86_64                                                                                                                                                 1/36 
  Verifying  : libblkid-2.23.2-59.29.amzn1.x86_64                                                                                                                                                      2/36 
  Verifying  : libuuid-2.23.2-59.29.amzn1.x86_64                                                                                                                                                       3/36 
  Verifying  : openssh-server-7.4p1-21.73.amzn1.x86_64                                                                                                                                                 4/36 
  Verifying  : kernel-4.14.146-93.123.amzn1.x86_64                                                                                                                                                     5/36 
  Verifying  : ec2-utils-0.5-3.36.amzn1.noarch                                                                                                                                                         6/36 
  Verifying  : python27-2.7.16-1.130.amzn1.x86_64                                                                                                                                                      7/36 
  Verifying  : libsmartcols-2.23.2-59.29.amzn1.x86_64                                                                                                                                                  8/36 
  Verifying  : libcurl-7.61.1-12.93.amzn1.x86_64                                                                                                                                                       9/36 
  Verifying  : tzdata-java-2019c-1.73.amzn1.noarch                                                                                                                                                    10/36 
  Verifying  : python27-devel-2.7.16-1.130.amzn1.x86_64                                                                                                                                               11/36 
  Verifying  : tzdata-2019c-1.73.amzn1.noarch                                                                                                                                                         12/36 
  Verifying  : util-linux-2.23.2-59.29.amzn1.x86_64                                                                                                                                                   13/36 
  Verifying  : openssh-7.4p1-21.73.amzn1.x86_64                                                                                                                                                       14/36 
  Verifying  : ec2-net-utils-0.5-3.36.amzn1.noarch                                                                                                                                                    15/36 
  Verifying  : libmount-2.23.2-59.29.amzn1.x86_64                                                                                                                                                     16/36 
  Verifying  : openssh-clients-7.4p1-21.73.amzn1.x86_64                                                                                                                                               17/36 
  Verifying  : libjpeg-turbo-1.2.90-8.16.amzn1.x86_64                                                                                                                                                 18/36 
  Verifying  : curl-7.61.1-12.93.amzn1.x86_64                                                                                                                                                         19/36 
  Verifying  : libjpeg-turbo-1.2.90-5.14.amzn1.x86_64                                                                                                                                                 20/36 
  Verifying  : ec2-net-utils-0.5-2.35.amzn1.noarch                                                                                                                                                    21/36 
  Verifying  : tzdata-2019a-1.71.amzn1.noarch                                                                                                                                                         22/36 
  Verifying  : libmount-2.23.2-33.28.amzn1.x86_64                                                                                                                                                     23/36 
  Verifying  : util-linux-2.23.2-33.28.amzn1.x86_64                                                                                                                                                   24/36 
  Verifying  : openssh-clients-7.4p1-16.71.amzn1.x86_64                                                                                                                                               25/36 
  Verifying  : python27-devel-2.7.16-1.129.amzn1.x86_64                                                                                                                                               26/36 
  Verifying  : libblkid-2.23.2-33.28.amzn1.x86_64                                                                                                                                                     27/36 
  Verifying  : python27-2.7.16-1.129.amzn1.x86_64                                                                                                                                                     28/36 
  Verifying  : openssh-7.4p1-16.71.amzn1.x86_64                                                                                                                                                       29/36 
  Verifying  : ec2-utils-0.5-2.35.amzn1.noarch                                                                                                                                                        30/36 
  Verifying  : curl-7.61.1-11.91.amzn1.x86_64                                                                                                                                                         31/36 
  Verifying  : python27-libs-2.7.16-1.129.amzn1.x86_64                                                                                                                                                32/36 
  Verifying  : libcurl-7.61.1-11.91.amzn1.x86_64                                                                                                                                                      33/36 
  Verifying  : libuuid-2.23.2-33.28.amzn1.x86_64                                                                                                                                                      34/36 
  Verifying  : openssh-server-7.4p1-16.71.amzn1.x86_64                                                                                                                                                35/36 
  Verifying  : tzdata-java-2019a-1.71.amzn1.noarch                                                                                                                                                    36/36 

Installed:
  kernel.x86_64 0:4.14.146-93.123.amzn1                                                                                                                                                                     

Dependency Installed:
  libsmartcols.x86_64 0:2.23.2-59.29.amzn1                                                                                                                                                                  

Updated:
  curl.x86_64 0:7.61.1-12.93.amzn1                    ec2-net-utils.noarch 0:0.5-3.36.amzn1               ec2-utils.noarch 0:0.5-3.36.amzn1                  libblkid.x86_64 0:2.23.2-59.29.amzn1          
  libcurl.x86_64 0:7.61.1-12.93.amzn1                 libjpeg-turbo.x86_64 0:1.2.90-8.16.amzn1            libmount.x86_64 0:2.23.2-59.29.amzn1               libuuid.x86_64 0:2.23.2-59.29.amzn1           
  openssh.x86_64 0:7.4p1-21.73.amzn1                  openssh-clients.x86_64 0:7.4p1-21.73.amzn1          openssh-server.x86_64 0:7.4p1-21.73.amzn1          python27.x86_64 0:2.7.16-1.130.amzn1          
  python27-devel.x86_64 0:2.7.16-1.130.amzn1          python27-libs.x86_64 0:2.7.16-1.130.amzn1           tzdata.noarch 0:2019c-1.73.amzn1                   tzdata-java.noarch 0:2019c-1.73.amzn1         
  util-linux.x86_64 0:2.23.2-59.29.amzn1             

Complete!
[ec2-user@ip-172-31-15-220 ~]$ java -version
java version "1.7.0_231"
OpenJDK Runtime Environment (amzn-2.6.19.1.80.amzn1-x86_64 u231-b01)
OpenJDK 64-Bit Server VM (build 24.231-b01, mixed mode)
[ec2-user@ip-172-31-15-220 ~]$ sudo yum list java*
Failed to set locale, defaulting to C
Loaded plugins: priorities, update-motd, upgrade-helper
Installed Packages
java-1.7.0-openjdk.x86_64                                                                           1:1.7.0.231-2.6.19.1.80.amzn1                                                               installed   
javapackages-tools.noarch                                                                           0.9.1-1.5.amzn1                                                                             installed   
Available Packages
java-1.6.0-openjdk.x86_64                                                                           1:1.6.0.41-1.13.13.1.77.amzn1                                                               amzn-main   
java-1.6.0-openjdk-demo.x86_64                                                                      1:1.6.0.41-1.13.13.1.77.amzn1                                                               amzn-main   
java-1.6.0-openjdk-devel.x86_64                                                                     1:1.6.0.41-1.13.13.1.77.amzn1                                                               amzn-main   
java-1.6.0-openjdk-javadoc.x86_64                                                                   1:1.6.0.41-1.13.13.1.77.amzn1                                                               amzn-main   
java-1.6.0-openjdk-src.x86_64                                                                       1:1.6.0.41-1.13.13.1.77.amzn1                                                               amzn-main   
java-1.7.0-openjdk-demo.x86_64                                                                      1:1.7.0.231-2.6.19.1.80.amzn1                                                               amzn-updates
java-1.7.0-openjdk-devel.x86_64                                                                     1:1.7.0.231-2.6.19.1.80.amzn1                                                               amzn-updates
java-1.7.0-openjdk-javadoc.noarch                                                                   1:1.7.0.231-2.6.19.1.80.amzn1                                                               amzn-updates
java-1.7.0-openjdk-src.x86_64                                                                       1:1.7.0.231-2.6.19.1.80.amzn1                                                               amzn-updates
java-1.8.0-openjdk.x86_64                                                                           1:1.8.0.222.b10-0.47.amzn1                                                                  amzn-updates
java-1.8.0-openjdk-demo.x86_64                                                                      1:1.8.0.222.b10-0.47.amzn1                                                                  amzn-updates
java-1.8.0-openjdk-devel.x86_64                                                                     1:1.8.0.222.b10-0.47.amzn1                                                                  amzn-updates
java-1.8.0-openjdk-headless.x86_64                                                                  1:1.8.0.222.b10-0.47.amzn1                                                                  amzn-updates
java-1.8.0-openjdk-javadoc.noarch                                                                   1:1.8.0.222.b10-0.47.amzn1                                                                  amzn-updates
java-1.8.0-openjdk-javadoc-zip.noarch                                                               1:1.8.0.222.b10-0.47.amzn1                                                                  amzn-updates
java-1.8.0-openjdk-src.x86_64                                                                       1:1.8.0.222.b10-0.47.amzn1                                                                  amzn-updates
java_cup.noarch                                                                                     1:0.10k-5.7.amzn1                                                                           amzn-main   
java_cup-javadoc.noarch                                                                             1:0.10k-5.7.amzn1                                                                           amzn-main   
java_cup-manual.noarch                                                                              1:0.10k-5.7.amzn1                                                                           amzn-main   
javacc.noarch                                                                                       4.1-0.5.8.amzn1                                                                             amzn-main   
javacc-demo.noarch                                                                                  4.1-0.5.8.amzn1                                                                             amzn-main   
javacc-manual.noarch                                                                                4.1-0.5.8.amzn1                                                                             amzn-main   
javassist.noarch                                                                                    3.9.0-6.4.amzn1                                                                             amzn-main   
javassist-javadoc.noarch                                                                            3.9.0-6.4.amzn1                                                                             amzn-main   
[ec2-user@ip-172-31-15-220 ~]$ sudo yum install java-1.8.0-openjdk
Failed to set locale, defaulting to C
Loaded plugins: priorities, update-motd, upgrade-helper
Resolving Dependencies
--> Running transaction check
---> Package java-1.8.0-openjdk.x86_64 1:1.8.0.222.b10-0.47.amzn1 will be installed
--> Processing Dependency: java-1.8.0-openjdk-headless(x86-64) = 1:1.8.0.222.b10-0.47.amzn1 for package: 1:java-1.8.0-openjdk-1.8.0.222.b10-0.47.amzn1.x86_64
--> Running transaction check
---> Package java-1.8.0-openjdk-headless.x86_64 1:1.8.0.222.b10-0.47.amzn1 will be installed
amzn-main/latest/filelists_db                                                                                                                                                        | 5.7 MB  00:00:00     
amzn-updates/latest/filelists_db                                                                                                                                                     |  11 MB  00:00:01     
--> Processing Dependency: lksctp-tools(x86-64) for package: 1:java-1.8.0-openjdk-headless-1.8.0.222.b10-0.47.amzn1.x86_64
--> Processing Dependency: cups-libs(x86-64) for package: 1:java-1.8.0-openjdk-headless-1.8.0.222.b10-0.47.amzn1.x86_64
--> Running transaction check
---> Package cups-libs.x86_64 1:1.4.2-67.21.amzn1 will be installed
--> Processing Dependency: libtiff.so.5(LIBTIFF_4.0)(64bit) for package: 1:cups-libs-1.4.2-67.21.amzn1.x86_64
--> Processing Dependency: libgnutls.so.26(GNUTLS_1_4)(64bit) for package: 1:cups-libs-1.4.2-67.21.amzn1.x86_64
--> Processing Dependency: libtiff.so.5()(64bit) for package: 1:cups-libs-1.4.2-67.21.amzn1.x86_64
--> Processing Dependency: libgnutls.so.26()(64bit) for package: 1:cups-libs-1.4.2-67.21.amzn1.x86_64
--> Processing Dependency: libavahi-common.so.3()(64bit) for package: 1:cups-libs-1.4.2-67.21.amzn1.x86_64
--> Processing Dependency: libavahi-client.so.3()(64bit) for package: 1:cups-libs-1.4.2-67.21.amzn1.x86_64
---> Package lksctp-tools.x86_64 0:1.0.10-7.7.amzn1 will be installed
--> Running transaction check
---> Package avahi-libs.x86_64 0:0.6.25-12.17.amzn1 will be installed
---> Package gnutls.x86_64 0:2.12.23-21.18.amzn1 will be installed
---> Package libtiff.x86_64 0:4.0.3-32.34.amzn1 will be installed
--> Processing Dependency: libjbig.so.2.0()(64bit) for package: libtiff-4.0.3-32.34.amzn1.x86_64
--> Running transaction check
---> Package jbigkit-libs.x86_64 0:2.0-11.4.amzn1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

============================================================================================================================================================================================================
 Package                                                   Arch                                 Version                                                    Repository                                  Size
============================================================================================================================================================================================================
Installing:
 java-1.8.0-openjdk                                        x86_64                               1:1.8.0.222.b10-0.47.amzn1                                 amzn-updates                               279 k
Installing for dependencies:
 avahi-libs                                                x86_64                               0.6.25-12.17.amzn1                                         amzn-main                                   64 k
 cups-libs                                                 x86_64                               1:1.4.2-67.21.amzn1                                        amzn-main                                  364 k
 gnutls                                                    x86_64                               2.12.23-21.18.amzn1                                        amzn-main                                  450 k
 java-1.8.0-openjdk-headless                               x86_64                               1:1.8.0.222.b10-0.47.amzn1                                 amzn-updates                                39 M
 jbigkit-libs                                              x86_64                               2.0-11.4.amzn1                                             amzn-main                                   47 k
 libtiff                                                   x86_64                               4.0.3-32.34.amzn1                                          amzn-updates                               439 k
 lksctp-tools                                              x86_64                               1.0.10-7.7.amzn1                                           amzn-main                                   89 k

Transaction Summary
============================================================================================================================================================================================================
Install  1 Package (+7 Dependent packages)

Total download size: 41 M
Installed size: 107 M
Is this ok [y/d/N]: y
Downloading packages:
(1/8): avahi-libs-0.6.25-12.17.amzn1.x86_64.rpm                                                                                                                                      |  64 kB  00:00:00     
(2/8): gnutls-2.12.23-21.18.amzn1.x86_64.rpm                                                                                                                                         | 450 kB  00:00:00     
(3/8): cups-libs-1.4.2-67.21.amzn1.x86_64.rpm                                                                                                                                        | 364 kB  00:00:00     
(4/8): jbigkit-libs-2.0-11.4.amzn1.x86_64.rpm                                                                                                                                        |  47 kB  00:00:00     
(5/8): lksctp-tools-1.0.10-7.7.amzn1.x86_64.rpm                                                                                                                                      |  89 kB  00:00:00     
(6/8): java-1.8.0-openjdk-1.8.0.222.b10-0.47.amzn1.x86_64.rpm                                                                                                                        | 279 kB  00:00:00     
(7/8): libtiff-4.0.3-32.34.amzn1.x86_64.rpm                                                                                                                                          | 439 kB  00:00:00     
(8/8): java-1.8.0-openjdk-headless-1.8.0.222.b10-0.47.amzn1.x86_64.rpm                                                                                                               |  39 MB  00:00:05     
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                       7.1 MB/s |  41 MB  00:00:05     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : avahi-libs-0.6.25-12.17.amzn1.x86_64                                                                                                                                                     1/8 
  Installing : jbigkit-libs-2.0-11.4.amzn1.x86_64                                                                                                                                                       2/8 
  Installing : libtiff-4.0.3-32.34.amzn1.x86_64                                                                                                                                                         3/8 
  Installing : lksctp-tools-1.0.10-7.7.amzn1.x86_64                                                                                                                                                     4/8 
  Installing : gnutls-2.12.23-21.18.amzn1.x86_64                                                                                                                                                        5/8 
  Installing : 1:cups-libs-1.4.2-67.21.amzn1.x86_64                                                                                                                                                     6/8 
  Installing : 1:java-1.8.0-openjdk-headless-1.8.0.222.b10-0.47.amzn1.x86_64                                                                                                                            7/8 
  Installing : 1:java-1.8.0-openjdk-1.8.0.222.b10-0.47.amzn1.x86_64                                                                                                                                     8/8 
  Verifying  : gnutls-2.12.23-21.18.amzn1.x86_64                                                                                                                                                        1/8 
  Verifying  : 1:cups-libs-1.4.2-67.21.amzn1.x86_64                                                                                                                                                     2/8 
  Verifying  : 1:java-1.8.0-openjdk-headless-1.8.0.222.b10-0.47.amzn1.x86_64                                                                                                                            3/8 
  Verifying  : 1:java-1.8.0-openjdk-1.8.0.222.b10-0.47.amzn1.x86_64                                                                                                                                     4/8 
  Verifying  : libtiff-4.0.3-32.34.amzn1.x86_64                                                                                                                                                         5/8 
  Verifying  : lksctp-tools-1.0.10-7.7.amzn1.x86_64                                                                                                                                                     6/8 
  Verifying  : jbigkit-libs-2.0-11.4.amzn1.x86_64                                                                                                                                                       7/8 
  Verifying  : avahi-libs-0.6.25-12.17.amzn1.x86_64                                                                                                                                                     8/8 

Installed:
  java-1.8.0-openjdk.x86_64 1:1.8.0.222.b10-0.47.amzn1                                                                                                                                                      

Dependency Installed:
  avahi-libs.x86_64 0:0.6.25-12.17.amzn1       cups-libs.x86_64 1:1.4.2-67.21.amzn1       gnutls.x86_64 0:2.12.23-21.18.amzn1          java-1.8.0-openjdk-headless.x86_64 1:1.8.0.222.b10-0.47.amzn1      
  jbigkit-libs.x86_64 0:2.0-11.4.amzn1         libtiff.x86_64 0:4.0.3-32.34.amzn1         lksctp-tools.x86_64 0:1.0.10-7.7.amzn1      

Complete!
[ec2-user@ip-172-31-15-220 ~]$ java -version
java version "1.7.0_231"
OpenJDK Runtime Environment (amzn-2.6.19.1.80.amzn1-x86_64 u231-b01)
OpenJDK 64-Bit Server VM (build 24.231-b01, mixed mode)
[ec2-user@ip-172-31-15-220 ~]$ sudo /usr/sbin/alternatives --config java

There are 2 programs which provide 'java'.

  Selection    Command
-----------------------------------------------
*+ 1           /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/java
   2           /usr/lib/jvm/jre-1.8.0-openjdk.x86_64/bin/java

Enter to keep the current selection[+], or type selection number: 2
[ec2-user@ip-172-31-15-220 ~]$ sudo /usr/sbin/alternatives --config javac
[ec2-user@ip-172-31-15-220 ~]$ java -version
openjdk version "1.8.0_222"
OpenJDK Runtime Environment (build 1.8.0_222-b10)
OpenJDK 64-Bit Server VM (build 25.222-b10, mixed mode)
[ec2-user@ip-172-31-15-220 ~]$ yum list tomcat*
Failed to set locale, defaulting to C
Loaded plugins: priorities, update-motd, upgrade-helper
Available Packages
tomcat-native.x86_64                                                                                   1.2.21-1.22.amzn1                                                                        amzn-updates
tomcat7.noarch                                                                                         7.0.94-1.35.amzn1                                                                        amzn-updates
tomcat7-admin-webapps.noarch                                                                           7.0.94-1.35.amzn1                                                                        amzn-updates
tomcat7-docs-webapp.noarch                                                                             7.0.94-1.35.amzn1                                                                        amzn-updates
tomcat7-el-2.2-api.noarch                                                                              7.0.94-1.35.amzn1                                                                        amzn-updates
tomcat7-javadoc.noarch                                                                                 7.0.94-1.35.amzn1                                                                        amzn-updates
tomcat7-jsp-2.2-api.noarch                                                                             7.0.94-1.35.amzn1                                                                        amzn-updates
tomcat7-lib.noarch                                                                                     7.0.94-1.35.amzn1                                                                        amzn-updates
tomcat7-log4j.noarch                                                                                   7.0.94-1.35.amzn1                                                                        amzn-updates
tomcat7-servlet-3.0-api.noarch                                                                         7.0.94-1.35.amzn1                                                                        amzn-updates
tomcat7-webapps.noarch                                                                                 7.0.94-1.35.amzn1                                                                        amzn-updates
tomcat8.noarch                                                                                         8.5.42-1.80.amzn1                                                                        amzn-updates
tomcat8-admin-webapps.noarch                                                                           8.5.42-1.80.amzn1                                                                        amzn-updates
tomcat8-docs-webapp.noarch                                                                             8.5.42-1.80.amzn1                                                                        amzn-updates
tomcat8-el-3.0-api.noarch                                                                              8.5.42-1.80.amzn1                                                                        amzn-updates
tomcat8-javadoc.noarch                                                                                 8.5.42-1.80.amzn1                                                                        amzn-updates
tomcat8-jsp-2.3-api.noarch                                                                             8.5.42-1.80.amzn1                                                                        amzn-updates
tomcat8-lib.noarch                                                                                     8.5.42-1.80.amzn1                                                                        amzn-updates
tomcat8-log4j.noarch                                                                                   8.5.42-1.80.amzn1                                                                        amzn-updates
tomcat8-servlet-3.1-api.noarch                                                                         8.5.42-1.80.amzn1                                                                        amzn-updates
tomcat8-webapps.noarch                                                                                 8.5.42-1.80.amzn1                                                                        amzn-updates
tomcat80.noarch                                                                                        8.0.53-1.80.amzn1                                                                        amzn-updates
tomcat80-admin-webapps.noarch                                                                          8.0.53-1.80.amzn1                                                                        amzn-updates
tomcat80-docs-webapp.noarch                                                                            8.0.53-1.80.amzn1                                                                        amzn-updates
tomcat80-el-3.0-api.noarch                                                                             8.0.53-1.80.amzn1                                                                        amzn-updates
tomcat80-javadoc.noarch                                                                                8.0.53-1.80.amzn1                                                                        amzn-updates
tomcat80-jsp-2.3-api.noarch                                                                            8.0.53-1.80.amzn1                                                                        amzn-updates
tomcat80-lib.noarch                                                                                    8.0.53-1.80.amzn1                                                                        amzn-updates
tomcat80-log4j.noarch                                                                                  8.0.53-1.80.amzn1                                                                        amzn-updates
tomcat80-servlet-3.1-api.noarch                                                                        8.0.53-1.80.amzn1                                                                        amzn-updates
tomcat80-webapps.noarch                                                                                8.0.53-1.80.amzn1                                                                        amzn-updates
[ec2-user@ip-172-31-15-220 ~]$ sudo yum install tomcat8
Failed to set locale, defaulting to C
Loaded plugins: priorities, update-motd, upgrade-helper
Resolving Dependencies
--> Running transaction check
---> Package tomcat8.noarch 0:8.5.42-1.80.amzn1 will be installed
--> Processing Dependency: tomcat8-lib = 8.5.42-1.80.amzn1 for package: tomcat8-8.5.42-1.80.amzn1.noarch
--> Processing Dependency: apache-commons-pool for package: tomcat8-8.5.42-1.80.amzn1.noarch
--> Processing Dependency: apache-commons-logging for package: tomcat8-8.5.42-1.80.amzn1.noarch
--> Processing Dependency: apache-commons-dbcp for package: tomcat8-8.5.42-1.80.amzn1.noarch
--> Processing Dependency: apache-commons-daemon for package: tomcat8-8.5.42-1.80.amzn1.noarch
--> Processing Dependency: apache-commons-collections for package: tomcat8-8.5.42-1.80.amzn1.noarch
--> Running transaction check
---> Package apache-commons-collections.noarch 0:3.2.2-3.10.amzn1 will be installed
---> Package apache-commons-daemon.x86_64 0:1.0.7-1.6.amzn1 will be installed
---> Package apache-commons-dbcp.noarch 0:1.4-7.7.amzn1 will be installed
---> Package apache-commons-logging.noarch 0:1.1.1-16.8.amzn1 will be installed
---> Package apache-commons-pool.noarch 0:1.5.6-1.7.amzn1 will be installed
---> Package tomcat8-lib.noarch 0:8.5.42-1.80.amzn1 will be installed
--> Processing Dependency: tomcat8-servlet-3.1-api = 8.5.42-1.80.amzn1 for package: tomcat8-lib-8.5.42-1.80.amzn1.noarch
--> Processing Dependency: tomcat8-jsp-2.3-api = 8.5.42-1.80.amzn1 for package: tomcat8-lib-8.5.42-1.80.amzn1.noarch
--> Processing Dependency: tomcat8-el-3.0-api = 8.5.42-1.80.amzn1 for package: tomcat8-lib-8.5.42-1.80.amzn1.noarch
--> Processing Dependency: ecj >= 1:4.2.1 for package: tomcat8-lib-8.5.42-1.80.amzn1.noarch
--> Running transaction check
---> Package ecj.x86_64 1:4.2.1-4.15.amzn1 will be installed
---> Package tomcat8-el-3.0-api.noarch 0:8.5.42-1.80.amzn1 will be installed
---> Package tomcat8-jsp-2.3-api.noarch 0:8.5.42-1.80.amzn1 will be installed
---> Package tomcat8-servlet-3.1-api.noarch 0:8.5.42-1.80.amzn1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

============================================================================================================================================================================================================
 Package                                                    Arch                                   Version                                               Repository                                    Size
============================================================================================================================================================================================================
Installing:
 tomcat8                                                    noarch                                 8.5.42-1.80.amzn1                                     amzn-updates                                 102 k
Installing for dependencies:
 apache-commons-collections                                 noarch                                 3.2.2-3.10.amzn1                                      amzn-main                                    531 k
 apache-commons-daemon                                      x86_64                                 1.0.7-1.6.amzn1                                       amzn-main                                     51 k
 apache-commons-dbcp                                        noarch                                 1.4-7.7.amzn1                                         amzn-main                                    161 k
 apache-commons-logging                                     noarch                                 1.1.1-16.8.amzn1                                      amzn-main                                    131 k
 apache-commons-pool                                        noarch                                 1.5.6-1.7.amzn1                                       amzn-main                                    101 k
 ecj                                                        x86_64                                 1:4.2.1-4.15.amzn1                                    amzn-main                                    1.4 M
 tomcat8-el-3.0-api                                         noarch                                 8.5.42-1.80.amzn1                                     amzn-updates                                 110 k
 tomcat8-jsp-2.3-api                                        noarch                                 8.5.42-1.80.amzn1                                     amzn-updates                                  68 k
 tomcat8-lib                                                noarch                                 8.5.42-1.80.amzn1                                     amzn-updates                                 4.3 M
 tomcat8-servlet-3.1-api                                    noarch                                 8.5.42-1.80.amzn1                                     amzn-updates                                 255 k

Transaction Summary
============================================================================================================================================================================================================
Install  1 Package (+10 Dependent packages)

Total download size: 7.2 M
Installed size: 8.2 M
Is this ok [y/d/N]: y
Downloading packages:
(1/11): apache-commons-daemon-1.0.7-1.6.amzn1.x86_64.rpm                                                                                                                             |  51 kB  00:00:00     
(2/11): apache-commons-dbcp-1.4-7.7.amzn1.noarch.rpm                                                                                                                                 | 161 kB  00:00:00     
(3/11): apache-commons-collections-3.2.2-3.10.amzn1.noarch.rpm                                                                                                                       | 531 kB  00:00:00     
(4/11): apache-commons-logging-1.1.1-16.8.amzn1.noarch.rpm                                                                                                                           | 131 kB  00:00:00     
(5/11): apache-commons-pool-1.5.6-1.7.amzn1.noarch.rpm                                                                                                                               | 101 kB  00:00:00     
(6/11): ecj-4.2.1-4.15.amzn1.x86_64.rpm                                                                                                                                              | 1.4 MB  00:00:00     
(7/11): tomcat8-8.5.42-1.80.amzn1.noarch.rpm                                                                                                                                         | 102 kB  00:00:00     
(8/11): tomcat8-jsp-2.3-api-8.5.42-1.80.amzn1.noarch.rpm                                                                                                                             |  68 kB  00:00:00     
(9/11): tomcat8-servlet-3.1-api-8.5.42-1.80.amzn1.noarch.rpm                                                                                                                         | 255 kB  00:00:00     
(10/11): tomcat8-el-3.0-api-8.5.42-1.80.amzn1.noarch.rpm                                                                                                                             | 110 kB  00:00:00     
(11/11): tomcat8-lib-8.5.42-1.80.amzn1.noarch.rpm                                                                                                                                    | 4.3 MB  00:00:01     
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                       3.9 MB/s | 7.2 MB  00:00:01     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : apache-commons-pool-1.5.6-1.7.amzn1.noarch                                                                                                                                              1/11 
  Installing : apache-commons-dbcp-1.4-7.7.amzn1.noarch                                                                                                                                                2/11 
  Installing : apache-commons-collections-3.2.2-3.10.amzn1.noarch                                                                                                                                      3/11 
  Installing : tomcat8-el-3.0-api-8.5.42-1.80.amzn1.noarch                                                                                                                                             4/11 
  Installing : tomcat8-servlet-3.1-api-8.5.42-1.80.amzn1.noarch                                                                                                                                        5/11 
  Installing : tomcat8-jsp-2.3-api-8.5.42-1.80.amzn1.noarch                                                                                                                                            6/11 
  Installing : apache-commons-logging-1.1.1-16.8.amzn1.noarch                                                                                                                                          7/11 
  Installing : apache-commons-daemon-1.0.7-1.6.amzn1.x86_64                                                                                                                                            8/11 
  Installing : 1:ecj-4.2.1-4.15.amzn1.x86_64                                                                                                                                                           9/11 
  Installing : tomcat8-lib-8.5.42-1.80.amzn1.noarch                                                                                                                                                   10/11 
  Installing : tomcat8-8.5.42-1.80.amzn1.noarch                                                                                                                                                       11/11 
  Verifying  : apache-commons-pool-1.5.6-1.7.amzn1.noarch                                                                                                                                              1/11 
  Verifying  : 1:ecj-4.2.1-4.15.amzn1.x86_64                                                                                                                                                           2/11 
  Verifying  : apache-commons-daemon-1.0.7-1.6.amzn1.x86_64                                                                                                                                            3/11 
  Verifying  : tomcat8-servlet-3.1-api-8.5.42-1.80.amzn1.noarch                                                                                                                                        4/11 
  Verifying  : tomcat8-el-3.0-api-8.5.42-1.80.amzn1.noarch                                                                                                                                             5/11 
  Verifying  : tomcat8-jsp-2.3-api-8.5.42-1.80.amzn1.noarch                                                                                                                                            6/11 
  Verifying  : tomcat8-8.5.42-1.80.amzn1.noarch                                                                                                                                                        7/11 
  Verifying  : apache-commons-logging-1.1.1-16.8.amzn1.noarch                                                                                                                                          8/11 
  Verifying  : tomcat8-lib-8.5.42-1.80.amzn1.noarch                                                                                                                                                    9/11 
  Verifying  : apache-commons-dbcp-1.4-7.7.amzn1.noarch                                                                                                                                               10/11 
  Verifying  : apache-commons-collections-3.2.2-3.10.amzn1.noarch                                                                                                                                     11/11 

Installed:
  tomcat8.noarch 0:8.5.42-1.80.amzn1                                                                                                                                                                        

Dependency Installed:
  apache-commons-collections.noarch 0:3.2.2-3.10.amzn1  apache-commons-daemon.x86_64 0:1.0.7-1.6.amzn1      apache-commons-dbcp.noarch 0:1.4-7.7.amzn1     apache-commons-logging.noarch 0:1.1.1-16.8.amzn1 
  apache-commons-pool.noarch 0:1.5.6-1.7.amzn1          ecj.x86_64 1:4.2.1-4.15.amzn1                       tomcat8-el-3.0-api.noarch 0:8.5.42-1.80.amzn1  tomcat8-jsp-2.3-api.noarch 0:8.5.42-1.80.amzn1   
  tomcat8-lib.noarch 0:8.5.42-1.80.amzn1                tomcat8-servlet-3.1-api.noarch 0:8.5.42-1.80.amzn1 

Complete!
[ec2-user@ip-172-31-15-220 ~]$ cd /usr/share/tomcat8/
[ec2-user@ip-172-31-15-220 tomcat8]$ ls
bin  conf  lib  logs  temp  webapps  work
[ec2-user@ip-172-31-15-220 tomcat8]$ cd conf/
[ec2-user@ip-172-31-15-220 conf]$ ls
Catalina  catalina.policy  catalina.properties  context.xml  jaspic-providers.xml  logging.properties  server.xml  tomcat-users.xml  tomcat8.conf  web.xml
[ec2-user@ip-172-31-15-220 conf]$ cd ..
[ec2-user@ip-172-31-15-220 tomcat8]$ ls
bin  conf  lib  logs  temp  webapps  work
[ec2-user@ip-172-31-15-220 tomcat8]$ cd ..
[ec2-user@ip-172-31-15-220 share]$ ls
X11           authconfig       desktop-directories  file        gdb          grub     info        java-ext    jvm-commmon  man              misc     pkgconfig  systemtap  xsessions
aclocal       awk              dict                 firstboot   ghostscript  gtk-doc  java        java-utils  keyutils     maven-fragments  nano     pki        tabset     yum-cli
alsa          backgrounds      doc                  fontconfig  glib-2.0     hwdata   java-1.5.0  javadoc     licenses     maven-poms       omf      plymouth   terminfo   yum-plugins
anaconda      bash-completion  dracut               fonts       gnome        i18n     java-1.6.0  javazi      locale       microcode_ctl    p11-kit  ruby       themes     zoneinfo
applications  cracklib         emacs                games       gnupg        icons    java-1.7.0  javazi-1.8  lua          mime             perl5    screen     tomcat8    zsh
augeas        dbus-1           empty                gcc-7       groff        idl      java-1.8.0  jvm         magic        mime-info        pixmaps  sounds     vim
[ec2-user@ip-172-31-15-220 share]$ cd tomcat8/
[ec2-user@ip-172-31-15-220 tomcat8]$ ls
bin  conf  lib  logs  temp  webapps  work
[ec2-user@ip-172-31-15-220 tomcat8]$ cd conf/
[ec2-user@ip-172-31-15-220 conf]$ ls
Catalina  catalina.policy  catalina.properties  context.xml  jaspic-providers.xml  logging.properties  server.xml  tomcat-users.xml  tomcat8.conf  web.xml
[ec2-user@ip-172-31-15-220 conf]$ sudo vi context.xml 
[ec2-user@ip-172-31-15-220 conf]$ sudo service tomcat8 start
[ec2-user@ip-172-31-15-220 conf]$                          [  OK  ]
[ec2-user@ip-172-31-15-220 conf]$ 
[ec2-user@ip-172-31-15-220 conf]$ ls
Catalina  catalina.policy  catalina.properties  context.xml  jaspic-providers.xml  logging.properties  server.xml  tomcat-users.xml  tomcat8.conf  web.xml
[ec2-user@ip-172-31-15-220 conf]$ cd ..
[ec2-user@ip-172-31-15-220 tomcat8]$ ls
bin  conf  lib  logs  temp  webapps  work
[ec2-user@ip-172-31-15-220 tomcat8]$ cd webapps/
[ec2-user@ip-172-31-15-220 webapps]$ ls
[ec2-user@ip-172-31-15-220 webapps]$ sudo mkdir ROOT
[ec2-user@ip-172-31-15-220 webapps]$ ls
ROOT
[ec2-user@ip-172-31-15-220 webapps]$ cd ROOT/
[ec2-user@ip-172-31-15-220 ROOT]$ ls
[ec2-user@ip-172-31-15-220 ROOT]$ touch index.html
touch: cannot touch 'index.html': Permission denied
[ec2-user@ip-172-31-15-220 ROOT]$ sudo touch index.html
[ec2-user@ip-172-31-15-220 ROOT]$ ls
index.html
[ec2-user@ip-172-31-15-220 ROOT]$ sudo vi index.html 
[ec2-user@ip-172-31-15-220 ROOT]$ 
[ec2-user@ip-172-31-15-220 ROOT]$ 
[ec2-user@ip-172-31-15-220 ROOT]$ 

[ec2-user@ip-172-31-15-220 ROOT]$ 

Comments

  1. This is really a big and great source of information. A complete guide one must follow if want to start his online blogging. Thanks for sharing such a nice information.


    DedicatedHosting4u.com

    ReplyDelete
  2. awesome blog it's very nice and useful i got many more information it's really nice i like your blog styleweb design company in velachery

    ReplyDelete
  3. Those guidelines additionally worked to become a good way to recognize that other people online have the identical fervor like mine to grasp great deal more around this condition.

    Top Digital Marketing Training in Chennai

    ReplyDelete
  4. The whole installation process is quite complicated, but it seems to me that this is the most complete instruction that will help me avoid all errors and do everything right.

    ReplyDelete
  5. I believe, that Amazon is one of the biggest sites in the world, but I have never used it. Moreover, I don't even know how it looks.

    ReplyDelete
  6. Many thanks for the article, it is quite helpful! Amazon is common and people will be happy to discover new possibilities over there.

    ReplyDelete

Post a Comment

Popular posts from this blog

How do I change the time zone of my Amazon RDS database instance?

As we know bydefault time in the format of UTC in mysql.We can set local time zone to our AWS RDS Instance for our application. or any other time zone prefared Cloud Based Website Hosting Service Provider Steps 1: Go to Services and Select RDS Now to change time zone we have to change "Parameter Group" in left side that is associated with DB instance first we can check default Parameter Group for our instance is Parameter group default.mysql5.7  ( in-sync ) like this. So we have to change the time zone in this Parameter Group.  now open that parameter group (default.mysql5.7)  and click on edit parameter. then search for time_zone (because we want to change it.) then we have to change time_zone only by default it is engine-default (that is utc)  we have to select Asia/Calcutta.  More information we can ref.  https://aws.amazon.com/premiumsupport/knowledge-center/rds-change-time-zone/

Changing the Time Zone on Amazon Linux Ec2 Instance

Amazon Linux instances are set to the UTC (Coordinated Universal Time) time zone by default, but you may wish to change the time on an instance to the local time or to another time zone in your network. Important These procedures are intended for use with Amazon Linux. For more information about other distributions, see their specific documentation. To change the time zone on an instance Identify the time zone to use on the instance. The  /usr/share/zoneinfo  directory contains a hierarchy of time zone data files. Browse the directory structure at that location to find a file for your time zone. [ec2-user ~]$ ls /usr/share/zoneinfo Africa Chile GB Indian Mideast posixrules US America CST6CDT GB-Eire Iran MST PRC UTC Antarctica Cuba GMT iso3166.tab MST7MDT PST8PDT WET Arctic EET GMT0 Israel Navajo right W-SU ... Some of the entries at this location are directo