How to install Tomcat in Amazon Web Services EC2

If you also want to know the help documentation, the command is: sudo yum install tomcat8-webapps tomcat8-docs-webapp tomcat8-admin-webapps


On Amazon Linux 2 AMI:

  1. List extra packages (you will see tomcat8 versions):

    $ amazon-linux-extras list

  2. Install extra packages:

    $ sudo amazon-linux-extras install tomcat8.5

  3. Start tomcat service:

    $ sudo systemctl start tomcat

  4. Create index file:

    $ cd /usr/share/tomcat/webapps
    $ sudo mkdir ROOT
    $ cd ROOT/
    $ sudo vi index.html #add some HTML content

Next you could view your site at localhost:8080


For Amazon AMI 2, Tomcat is available in Amazon Linux Extra topic "tomcat8.5"

To use, run

# sudo amazon-linux-extras install tomcat8.5

Learn more at https://aws.amazon.com/amazon-linux-2/faqs/#Amazon_Linux_Extras


You can use yum tool to install the tomcat8 packer from amazon default repository.

The command is: yum install tomcat8-webapps tomcat8-admin-webapps