Tomcat 7.0.65 Server on Ubuntu, Debian & LinuxMint

Apache Tomcat is a opensource webserver product of Apache Foundation like Apache HTTP server. It is used to 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 .

Step 1: Verify JAVA

First we need to make sure that we have installed java on or system. JAVA is the first requirement of tomcat installation. Use following command to check if you have java installed already on your system. Try to keep java up to date with latest version.
$ java -version

java version "1.8.0_66"
Java(TM) SE Runtime Environment (build 1.8.0_66-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.66-b17, mixed mode)
In case you do not have java installed use link: Install JAVA 8 on Ubuntu

Step 2: Download Tomcat 7 Archive

After configuring JAVA properly on your system, let’s download Apache tomcat archive file from Apache official site using or use the following command to download Tomcat 7.0.65 from Apache server.
$ cd /opt
$ wget
After competed download extract archive file in /opt directory. You may change this location as per your setup.
$ tar xzf apache-tomcat-7.0.65.tar.gz
$ mv apache-tomcat-7.0.65 tomcat7

Step 3: Setup Environment Variable

Before starting Tomcat, Configure environment variables by adding entry in ~/.bashrc file, So that system environment can set on system bootup with the following command.
$ echo "export CATALINA_HOME=\"/opt/tomcat7\"" >> ~/.bashrc
$ source ~/.bashrc

Step 4: Start Tomcat

After completing all above configuration, Lets use below command to start Tomcat. There are no need to compile its source. Tomcat by default start on port 8080, So make sure no other application using the same port.
$ cd /opt/tomcat7
$ sudo ./bin/

Step 5: Access Tomcat

Tomcat server works on port 8080 default. Access tomcat on web browser by connecting your server on port 8080.
Step 6: 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 7: Create Tomcat7 Init Script
Create a init file /etc/init.d/tomcat7 using following content.

# Provides:        tomcat7
# Required-Start:  $network
# Required-Stop:   $network
# Default-Start:   2 3 4 5
# Default-Stop:    0 1 6
# Short-Description: Start/Stop Tomcat server


start() {
 sh /opt/tomcat7/bin/

stop() {
 sh /opt/tomcat7/bin/

case $1 in
  start) start;;
  stop)  stop;;
  restart) stop; start;;
  *) echo "Run as $0 "; exit 1;;
Now execute following commands to set proper permissions and symbolic links for init script.
$ chmod 755 /etc/init.d/tomcat7
$ update-rc.d tomcat7 defaults
Hack The Security
Hack The Security Twitter
Hack The Security Facebook Page

About Author:

I am a Linux Administrator and Security Expert with this site i can help lot's of people about linux knowladge and as per security expert i also intersted about hacking related news.TwitterFacebook

Newer Post
Older Post


Post a Comment