Facebook Twitter Instagram
    TecAdmin
    • Home
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    You are at:Home»Web Servers»Tomcat»How to Install Tomcat 9 on Fedora 34/33 and CentOS/RHEL 7

    How to Install Tomcat 9 on Fedora 34/33 and CentOS/RHEL 7

    By RahulJuly 13, 20213 Mins Read

    Tomcat is developed by Apache Foundations. Apache Tomcat is an open-source web server for a Java-based web application. Tomcat is licensed under Apache License version 2. Apache Tomcat team has announced its latest Tomcat 9.0.50 release on July 02, 2021.

    Advertisement

    This article will help you to install Tomcat 9 on CentOS, RHEL, and Fedora systems. To install other version of tomcat visit Tomcat 8 on CentOS & Red Hat.

    Step 1 – Prerequisites

    Tomcat 9 is designed to run on Java SE 8 and later. So make sure you have installed the correct version on your system.

    java -version
    
    openjdk version "11.0.7" 2020-04-14 LTS
    OpenJDK Runtime Environment 18.9 (build 11.0.7+10-LTS)
    OpenJDK 64-Bit Server VM 18.9 (build 11.0.7+10-LTS, mixed mode, sharing)
    

    If you don’t have Java installed on your system or installed a lower version, use the following link to install Java first.

    • Install Java 11 CentOS/RHEL & Fedora

    Step 2 – Download Tomcat Archive

    Download Apache Tomcat 9 archive file using following commands or you can visit Tomcat 9 official download page for download most recent available version. After downloading extract archive file in /usr/local directory. You may change this location as per your setup.

    wget wget http://www-us.apache.org/dist/tomcat/tomcat-9/v9.0.50/bin/apache-tomcat-9.0.50.tar.gz
    tar xzf apache-tomcat-9.0.50.tar.gz
    sudo mv apache-tomcat-9.0.50 /usr/local/tomcat9 
    

    Step 3 – Set Environment Variables

    Let’s configure the CATALINA_HOME environment variable in your system using the following commands. It is required to run the Tomcat server.

    echo "export CATALINA_HOME="/usr/local/tomcat9"" >> ~/.bashrc
    source ~/.bashrc
    

    Step 4 – Setup User Accounts

    Finally we need to create user accounts to secure and access admin/manager pages. Edit conf/tomcat-users.xml file in your editor and paste inside <tomcat-users> </tomcat-users> tags.

    vim /usr/local/tomcat9/conf/tomcat-users.xml
    
    <!-- user manager can access only manager section -->
    <role rolename="manager-gui" />
    <user username="manager" password="_SECRET_PASSWORD_" roles="manager-gui" />
    
    <!-- user admin can access manager and admin section both -->
    <role rolename="admin-gui" />
    <user username="admin" password="_SECRET_PASSWORD_" roles="manager-gui,admin-gui" />
    

    Step 5 – Start Tomcat Service

    Tomcat is very easy to use, There is no need to compile its source. You simply extract the archive and start the tomcat server. Tomcat by default start on port 8080, So make sure no other application using the same port.

    cd /usr/local/tomcat9
    ./bin/startup.sh
    

    [Sample Output]

    Using CATALINA_BASE:   /usr/local/tomcat9
    Using CATALINA_HOME:   /usr/local/tomcat9
    Using CATALINA_TMPDIR: /usr/local/tomcat9/temp
    Using CLASSPATH:       /usr/local/tomcat9/bin/bootstrap.jar:/usr/local/tomcat9/bin/tomcat-juli.jar
    Tomcat started.
    

    Step 6 – Access Tomcat in Browser

    Tomcat server default works on port 8080. Access tomcat on a web browser by connecting your server on port 8080.

    Access Tomcat Home:- This is default tomcat home page. There are no authentication required to access this page..

    http://localhost:8080 

    Install Apache Tomcat 9

    Access Manager App Page:- Click on Manager App button on home page.This page is allowed for Admin and Manager access both.

    http://localhost:8080/manager/html 

    Install Apache Tomcat 9

    Access Host Manager Page:- Click on Host Manager button on home page.This page is allowed for Admin access only.

    http://localhost:8080/host-manager/html 

    apache tomcat Apache Tomcat 9 install tomcat tomcat
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp

    Related Posts

    How to Find Tomcat Version

    How to Check Tomcat Version on Linux

    How to Install Tomcat 10 on Debian 10

    How to Install Tomcat 10 on Debian 11/10

    How to Install Let's Encrypt SSL on Tomcat

    How To Secure Tomcat with Let’s Encrypt SSL

    View 7 Comments

    7 Comments

    1. lacho_t on June 23, 2020 6:21 am

      hi, i have problems on fedora 31:
      tomcat.service: Failed at step EXEC spawning /usr/local/tomcat9/bin/startup.sh: Permission denied
      maybe SELINUX, helpme please.

      Reply
      • lacho_t on June 23, 2020 6:31 am

        i solved with this:
        [Unit]
        Description=Tomcat 9 servlet container
        After=network.target

        [Service]
        Type=simple
        #Type=forking

        User=carteratom
        #Group=carteratom

        Environment=”JAVA_HOME=/usr/lib/jvm/jre”
        Environment=”JAVA_OPTS=-Djava.security.egd=file:///dev/urandom”

        Environment=”CATALINA_BASE=/usr/local/tomcat9″
        Environment=”CATALINA_HOME=/usr/local/tomcat9″
        Environment=”CATALINA_PID=/usr/local/tomcat9/temp/tomcat.pid”
        Environment=”CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC”

        ExecStart=/usr/local/tomcat9/bin/startup.sh -b $CATALINA_PID –enable-autoexec
        ExecStop=/usr/local/tomcat9/bin/shutdown.sh -b $CATALINA_PID –enable-autoexec

        [Install]
        WantedBy=multi-user.target

        Reply
    2. Cristina Oliveira on March 14, 2020 4:10 pm

      There is a problem at Step 2 – http://www-us.apache.org/dist/tomcat/tomcat-9/v9.0.26/bin/apache-tomcat-9.0.30.tar.gz
      Try this https://downloads.apache.org/tomcat/tomcat-9/v9.0.31/bin/apache-tomcat-9.0.31.tar.gz

      Reply
    3. SANDRO SOTO on September 20, 2019 3:56 pm

      THANKS A LOT RAHUL, IT WAS MY FIRST INTALLATION OF TOMCAT, NO PROBLEMS AT ALL.

      Reply
    4. Carlos Amaral on July 4, 2019 9:39 pm

      Thank you Rahul. I’ve learned a lot by your tutorials….

      Reply
    5. Nicolas on May 1, 2019 3:37 pm

      Merci pour ce tutoriel
      A préciser : Pour autoriser l’accès aux host-manager manager en dehors de localhost :

      vi /usr/local/tomcat9/webapps/manager/META-INF/context.xml
      et
      vi /usr/local/tomcat9/webapps/host-manager/META-INF/context.xml

      puis commenter la balise VALVE comme ceci :
      \

      Reply
    6. Vishnu on September 26, 2018 7:22 pm

      I followed all steps and was able to setup tomcat with ease.
      thanks buddy.

      Reply

    Leave A Reply Cancel Reply

    Advertisement
    Recent Posts
    • tail Command in Linux with Examples
    • What is a Orphan Process in Unix/Linux
    • How To Display Warning Message to Unauthorized SSH Access
    • How to Set a Custom SSH Login Banner and MOTD
    • Understanding Reverse DNS: What it is and Why it Matters?
    Facebook Twitter Instagram Pinterest
    © 2023 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.