In this article, we will explain Steps to install Tomcat on Linux.
Apache Tomcat is an 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 any application in Tomcat we can simply create a war file and deploy them. For more details about you can visit apache official site TOMCAT
Command to check Java version in Linux
JAVA is the first requirement for Tomcat 7 installation. Make sure you have JAVA SE 6 or Later version installed in your system. 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)
Download the latest Tomcat7 version 7.0.62 for Linux
https://tomcat.apache.org/download-70.cgi
Transfer the downloaded zip file to your server where you wish to install tomcat. In this example – I have transferred to /opt/
[root@Ora-Node1 opt]# ls -ltr -rw-r--r--. 1 root root 24010343 Sep 21 10:05 apache-tomcat-7.0.62.zip [root@Ora-Node1 opt]#
unzip the transferred file apache-tomcat-7.0.62.zip
[root@Ora-Node1 opt] unzip apache-tomcat-7.0.62.zip [root@Ora-Node1 opt]# ls -ltr drwxr-xr-x. 9 root root 4096 Sep 11 20:17 apache-tomcat-7.0.62 -rw-r--r--. 1 root root 9401043 Sep 21 20:05 apache-tomcat-7.0.62.zip [root@Ora-Node1 opt]#
You may rename apache-tomcat-7.0.62 to tomcat but it’s entirely on you. This concluded tomcat installation is done and now will start to ensure installation is successful.
- Go to apache-tomcat-7.0.62/bin folder
- Execute startup.sh to start the tomcat
[root@Ora-Node1 bin]# ./startup.sh -bash: ./startup.sh: Permission denied [root@Ora-Node1 bin]#
If you are getting permission denied while executing sh file then you need to change the permission to sh file as executable.
chmod 755 *.sh
Now, let’s try to start tomcat service.
[root@Ora-Node1 bin]# ./startup.sh Using CATALINA_BASE: /opt/apache-tomcat-7.0.62 Using CATALINA_HOME: /opt/apache-tomcat-7.0.62 Using CATALINA_TMPDIR: /opt/apache-tomcat-7.0.62/temp Using JRE_HOME: / Using CLASSPATH: /opt/apache-tomcat-7.0.62/bin/bootstrap.jar:/opt/apache-tomcat-7.0.62/bin/tomcat-juli.jar Tomcat started. [root@Ora-Node1 bin]#
As you can see Tomcat is started. By default, Tomcat listens on 8080 port so you may wish to access tomcat by http://servername:8080 and you will have a welcome page like below.
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" />
End of tutorial – Steps to Install Tomcat on Linux.
You’ll also like:
How to install Nginx in RHEL and CentOS