Install Tomcat On Amazon Linux

0 136
  1. Remove older version of java and install latest version:
    yum remove java* -y
    sudo yum install java-1.8.0-openjdk.x86_64 -y
  2. Download tomcat packages from onto /opt on EC2 instance
    # create tomcat directory
    cd /opt
    tar -xvzf /opt/apache-tomcat-8.5.35.tar.gz
  3. Give executing permissions to and which are under bin.
    chmod +x /opt/apache-tomcat-8.5.35/bin/
  4. Create link files for tomcat and
    ln -s /opt/apache-tomcat-8.5.35/bin/ /usr/local/bin/tomcatup
    ln -s /opt/apache-tomcat-8.5.35/bin/ /usr/local/bin/tomcatdown
  5. Access tomcat application from browser on prot 8080
  6. Using unique ports for each application is a best practice in an environment. But tomcat and Jenkins runs on ports number 8080. Hence lets change tomcat port number to 8090. Change port number in conf/server.xml file under tomcat home
    cd /opt/apache-tomcat-8.5.35/conf
    # update port number in the "connecter port" field in server.xml
    # restart tomcat after configuration update
  7. Now application is accessible on port 8090. but tomcat application doesnt allow to login from browser. changing a default parameter in context.xml does address this issue#search for context.xml
    find / -name context.xml
  8. Above command gives 3 context.xml files. comment () Value ClassName field on files which are under webapp directory. After that restart tomcat services to effect these changes
  9. Update users information in the tomcat-users.xml file goto tomcat home directory and Add below users to conf/tomcat-user.xml file
    <role rolename="manager-gui"/>
    <role rolename="manager-script"/>
    <role rolename="manager-jmx"/>
    <role rolename="manager-status"/>
    <user username="admin" password="admin" roles="manager-gui, manager-script, manager-jmx, manager-status"/>
    <user username="deployer" password="deployer" roles="manager-script"/>
    <user username="tomcat" password="s3cret" roles="manager-gui"/>
  10. Restart serivce and try to login to tomcat application from the browser. This time it should be Successful

Leave A Reply

Your email address will not be published.