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 7 on CentOS/RHEL 7/6/5

    How to Install Tomcat 7 on CentOS/RHEL 7/6/5

    By RahulDecember 25, 20193 Mins Read

    Apache Tomcat is a open source web server for Java application of Apache Foundation like Apache HTTP server. It used for deploying Java Servlet and JSP applications. To deploy an application in Tomcat we can simply create a war file and deploy them. For more details about you can visit apache official site http://tomcat.apache.org/.

    Advertisement

    This article will help you to install Tomcat 7 on CentOS/RHEL servers. We are using CentOS 7 and installing Apache tomcat 7. To read more about this release read Tomcat Release Notes.

    Step 1 – Check Java Version

    JAVA is the first requirement for Tomcat 7 installation. Make sure you have JAVA SE 7 or 8 version installed in your system. Currently, Java 9 does not support Tomcat. Use the following command to check if you have java installed already on your system.

    java -version
    
    java version "1.8.0_121"
    Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
    Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)
    

    If you do not have java installed, Use another article to install Java 8 in Red Hat based systems.

    Step 2 – Download Tomcat 7 Archive

    Download Apache Tomcat archive file from Apache tomcat official download page. You can use below wget command to download it.

    cd /tmp
    wget http://www-us.apache.org/dist/tomcat/tomcat-7/v7.0.99/bin/apache-tomcat-7.0.99.tar.gz
    

    After competed download extract archive file in /tmp directory and move to the proper location as per your need. We are placing this under /usr/local directory.

    tar xzf apache-tomcat-7.0.99.tar.gz
    mv apache-tomcat-7.0.99 /usr/local/tomcat7
    
    Step 3 – Start Tomcat Server

    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, Make sure no other services are running on the same port using ‘telnet localhost 8080’.

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

    Sample Output

    Using CATALINA_BASE:   /usr/local/tomcat7
    Using CATALINA_HOME:   /usr/local/tomcat7
    Using CATALINA_TMPDIR: /usr/local/tomcat7/temp
    Using JRE_HOME:        /opt/jdk1.8.0_121
    Using CLASSPATH:       /usr/local/tomcat7/bin/bootstrap.jar:/usr/local/tomcat7/bin/tomcat-juli.jar
    Tomcat started.
    
    Step 4 – Access Tomcat in Browser

    Tomcat server works on port 8080 default. To access Tomcat on the web browser by connecting your server on port 8080.

     http://localhost:8080 

    Install Tomcat 7 CentOS

    Step 5 – 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.

    <!-- 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 6 – Stop Tomcat Server

    Finally, if you feel that there is no need for Tomcat in your system, you can simply stop it using the below command from the tomcat home directory.

    ./bin/shutdown.sh
    

    I hope above steps will help you to set up Tomcat 7 on your server. Read our next article to Install Tomcat 7 on Ubuntu. Tomcat 8 stable release is also available to download. Read our next article to Install Tomcat 8 in Linux

    Thanks

    Apache Java tomcat tomcat7 webserver
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp

    Related Posts

    Comparing Apache MPM Worker and Prefork: Which is Right for Your Application

    How to Install Apache (httpd) on RHEL & CentOS Stream 9

    How to Install LAMP Stack on RHEL & CentOS Stream 9

    View 30 Comments

    30 Comments

    1. Rahul Gole on June 16, 2021 12:05 pm

      Hello Rahul,
      Is Tomcat 6.x is supported in RHEL 7.x ?
      I have a project running on tomcat 6 on RHEL 5 which needs to be migrated on RHEL 7.
      while running tomcat 6 on RHEL 7 I get below issue.

      Jun 16, 2021 1:32:25 PM org.apache.catalina.core.StandardContext filterStart
      SEVERE: Exception starting filter Request Dumper Filter
      java.lang.ClassNotFoundException: org.apache.catalina.filters.RequestDumperFilter
      at java.net.URLClassLoader$1.run(URLClassLoader.java:212)
      at java.net.URLClassLoader$1.run(URLClassLoader.java:201)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:200)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:325)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:270)
      at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:272)
      at org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:119)
      at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4076)
      at org.apache.catalina.core.StandardContext.start(StandardContext.java:4730)
      at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
      at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
      at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:583)
      at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1079)
      at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:1002)
      at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:506)
      at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1317)
      at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324)
      at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
      at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1065)
      at org.apache.catalina.core.StandardHost.start(StandardHost.java:822)
      at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
      at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
      at org.apache.catalina.core.StandardService.start(StandardService.java:525)
      at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
      at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:622)
      at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
      at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)

      let me know your view on this.
      Thanks in advanced !!!

      Reply
    2. Stan on December 30, 2018 2:06 pm

      Link that /currently/ works: http://www.us.apache.org/dist/tomcat/tomcat-7/v7.0.92/bin/apache-tomcat-7.0.92.tar.gz

      Or go to http://www.us.apache.org/dist/tomcat/ and find it yourself.

      Reply
    3. Ejustine on September 28, 2017 3:19 pm

      Hello have really challenge, tried installing tomcat7 in centos7 and have failed.

      Reply
      • Rahul K. on September 29, 2017 7:00 am

        Hi Ejustine, What issue are you facing?

        Reply
        • Elina on May 26, 2018 7:04 pm

          Hello RAHUL K how are you ?
          Please ,can you help.
          I have some problems to release the SSO authentification server with LDAP and Kerberos server.this is the documentation but i have a problem :
          -i can’t generate the cas.war file whene i tap :# mvn package install
          ,so this comande give me a lot of ligne of Erreur .
          (i have copy and passte all the commande in the documentation )plz help

          Reply
    4. Bhupendra on May 18, 2017 2:16 pm

      Hi, Rahul,

      I never thought that tomcat will be easy like this.

      Thanks a lot of

      Reply
    5. Neha on March 10, 2016 5:15 am

      Great post. It just made my configuration quick & easy.

      Reply
    6. Surya on February 23, 2016 9:31 pm

      Look like this link “http://www.us.apache.org/dist/tomcat/tomcat-7/v7.0.64/bin/apache-tomcat-7.0.64.tar.gz” needs to be updated. I was able to use the latest version though, thanks for the instruction.

      Reply
    7. lemiguelapps on October 17, 2015 5:12 pm

      Configure LDAP with tomcat in http://www.theseforums.com/FALF

      Reply
    8. Gotch on June 24, 2015 6:49 am

      Hey! I did the following steps but I can’t seem to edit the conf/tomcat-users.xml folder due to restriction issues. Any help? Thanks

      Reply
    9. JB on June 10, 2015 11:30 am

      Hi,

      If I follow this guide and needed to uninstall tomcat, do i just delete the extracted tomcat folder?

      Reply
      • Rahul on June 13, 2015 4:54 pm

        Yes, Just delete that folder.

        Reply
    10. JoRgE-1987 on June 9, 2015 12:34 pm

      Thanks for share!!

      Today I had to do this, and your article was very useful.

      Regards.

      Reply
    11. Philly on April 24, 2015 9:10 am

      Cheers mate! Much appreciated 🙂

      Reply
    12. Larry on April 17, 2015 12:57 pm

      Great article, Rahul,

      I am trying to stand up my application in Tomcat-7.0.54 and have followed all your instructions.
      However, when I enter ./startup.sh I get an error message:

      /bin/setclasspath.shache-tomcat-7.0.54
      This file is needed to run this program

      The “shache” looks like I have a typo somewhere. But I’ve looked and don’t see one.
      Can you help?

      Reply
    13. Jack on February 8, 2015 1:23 am

      Hi

      I’ve followed the tutorial but once I try to run the new version of Tomcat, it shows following error.

      Cannot find apache-tomcat-8.0.18/bin/setclasspath.sh
      This file is needed to run this program

      Regarding the issue, I also posted a question on stackoverflow. You may find it here
      http://stackoverflow.com/questions/28378139/how-to-run-a-new-version-of-tomcat-on-linux

      Reply
    14. Dave on October 13, 2014 5:46 am

      Thanks for the quick tutorial Rahul. It took all of 5 minutes to get Tomcat 7.0.56 up and running on my Centos 5.x system.

      Reply
    15. sam on June 20, 2014 3:34 pm

      GREAT! Article Rahul, Keep it up, You just save me time…

      Reply
    16. Mike on June 20, 2014 2:44 pm

      How do you configure to start on reboot?

      Reply
      • Rahul on June 23, 2014 3:06 am

        Hi Mike,

        You may use this script for start/stop tomcat with little changes.

        https://coderwall.com/p/yqrusq

        Reply
    17. Nilesh on June 10, 2014 10:46 am

      Awesome.

      Reply
    18. Cody on May 29, 2014 4:36 pm

      great article, it really helped me, as a noob, to understand how to set-up tomcat user accounts, although I used http://www.rosehosting.com/blog/how-to-install-tomcat-8-on-a-centos-6-vps/ to install and set-up java and tomcat 8 on my centos vps as tomcat 8 is required

      thanks and keep up the great work,

      – cody

      Reply
    19. khalid on April 30, 2014 12:05 pm

      how I can to deploy a WAR archive Java web application into server with CentOS?

      Reply
      • Mohamed Amr on January 1, 2016 12:48 pm

        just move your war file to /usr/share/tomcat/webapps before triggering catalina.sh start command

        Reply
    20. ellan on April 4, 2014 8:44 am

      short but fully problem describing article

      Reply
    21. Anand on April 3, 2014 5:43 am

      Rahul, you have no clue how much this helped so far. I was struck a whole day figuring out why the way I had installed was not working. Atlast it did work for me perfectly. Thanks alot dude.

      Reply
    22. Victor on February 13, 2014 12:34 pm

      Excellent article, Rahul. This helped very much in getting our Tomcat/Eclipse development environment up and running on our Linux servers.

      Reply
    23. Terence on January 23, 2014 5:40 am

      Good article. There are even more tips here on Tomcat installation and setup.
      http://wiki.glitchdata.com/index.php?title=Tomcat_Installation

      Reply
    24. Dan Brian on December 13, 2013 7:44 am

      Hi,

      Thank you so much for this article. This helped me a lot since I’m new to linux. Do you have an article about running multiple instances of tomcat7 on CentOS 6?

      Reply
      • Gaurav Bhayana on February 27, 2014 11:11 am

        Hi Dan Brian

        You can follow this link for running multiple instance on apache tomcat.

        http://thelinuxstarter.wordpress.com/2013/12/01/run-multiple-instance-of-apache-tomcat-in-single-server

        Reply

    Leave A Reply Cancel Reply

    Advertisement
    Recent Posts
    • How to List Manually Installed Packages in Ubuntu & Debian
    • 10 Bash Tricks Every Developer Should Know
    • How to Validate Email Address in JavaScript
    • Firewalld: Common Firewall Rules and Commands
    • 12 Apk Commands in Alpine Linux Package Management
    Facebook Twitter Instagram Pinterest
    © 2023 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

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