How To: Installing Apache Tomcat 7 in Linux Fedora Core 17

Home

Deprecated

This blog has been deprecated, proceed to go to my new Blog.

Continuing with the Java tutorials, now is the turn to cover Apache Tomcat. It is a well known Web Container for Java applications working in Web environment.

This tutorial is only for installation purposes in Linux. I am using the latest release available for each software while I am writing this tutorial. These are:

Remember that I already wrote a tutorial named How To: Installing Oracle’s Java JDK 6/7 in Linux Fedora Core 17. So once you have installed Java in Fedora Core, proceed to return here.

Step 01: Getting Apache Tomcat 7

Just go to Tomcat 7 Downloads. Then go below until the section 7.0.27. Of course this release would change according if exists a new release available. Below an image to show you where you should be located.

Figure 01: Apache Tomcat Downloading Page – Section 7.0.27

I am going to work with the core installer, therefore within the core sub section do click in the item or option tar.gz. Once you have done this, you are going to be able to get or download the apache-tomcat-7.0.27.tar.gz file. Below an image for a better understanding.

Figure 02: Downloading the apache-tomcat-7.0.27.tar.gz file

Note: is always wise do a checksum for any installer you got it. I am not going to cover this, I consider it out of the scope for this tutorial.

I just downloaded the apache-tomcat-7.0.27.tar.gz file into the Desktop directory.

Figure 03: The apache-tomcat-7.0.27.tar.gz file into the Desktop directory

Step 02: Creating the installation directory

I am going to create and work in the follow path directory whiteroom/apache/tomcat

Then, open the terminal 01 to create the path directory suggested above, but before, be sure to be located in your home user directory, I mean, /home/username. Bear in mind, when you open a new terminal by default it is already located in your home user directory. If you want confirm explicitly where you are located in some terminal, you can use the command pwd.

[section1@localhost ~]$ pwd
/home/section1
[section1@localhost ~]$

Listing 01: Terminal 01 – Knowing the current location within a terminal

My username is section1. Then we can now create the path directory. In the current terminal 01 execute the command mkdir -p whiteroom/apache/tomcat.

[section1@localhost ~]$ mkdir -p whiteroom/apache/tomcat
[section1@localhost ~]$

Listing 02: Terminal 01 – Creating the path directory whiteroom/apache/tomcat

Below the new directory created after of the command execution.

Figure 04: The path directory whiteroom/apache/tomcat empty

Step 03: Copying the installer to our customized installation directory

Proceed to copy (or move if you want it) the Tomcat installer to our path directory whiteroom/apache/tomcat. You must see the follow.

Figure 05: The path directory whiteroom/apache/tomcat with the Tomcat installer

Step 04: Moving to our customized installation directory

In the terminal 01 execute the command cd whiteroom/apache/tomcat

[section1@localhost ~]$ cd whiteroom/apache/tomcat
[section1@localhost tomcat]$

Listing 03: Terminal 01 – Moving to the path directory whiteroom/apache/tomcat

You can know our new location executing again the command pwd in the terminal 01.

[section1@localhost tomcat]$ pwd
/home/section1/whiteroom/apache/tomcat
[section1@localhost tomcat]$ 

Listing 04: Terminal 01 – knowing the current location within a terminal

Step 05: Unpacking the .tar.gz file

Now is the turn to work around with the .tar.gz file, we only need to unpack it. Therefore again in the terminal 01 execute the command tar -zxvf apache-tomcat-7.0.27.tar.gz

[section1@localhost tomcat]$ tar -zxvf apache-tomcat-7.0.27.tar.gz
...
[section1@localhost tomcat]$

Listing 05: Terminal 01 – Unpacking the .tar.gz file

The three dots (…) represent a long output when you execute the command indicated.

After of the execution of the command a new directory named apache-tomcat-7.0.27 must appear, like shown below.

Figure 06: the new apache-tomcat-7.0.27 directory created after to unpack the apache-tomcat-7.0.27.tar.gz file

Step 06: Knowing the apache-tomcat-7.0.27 directory (Optional)

Let’s see what directories exists within the apache-tomcat-7.0.27 directory

Figure 07: the apache-tomcat-7.0.27 directory content

I am not going to explain each directory right now, in future tutorials, I will do the respective explanation when be appropriate.

The directory of our interest right now is the bin directory.

Step 07: Moving to the apache-tomcat-7.0.27’s bin directory

Again in the terminal 01 just execute the command cd apache-tomcat-7.0.27/bin

[section1@localhost tomcat]$ cd apache-tomcat-7.0.27/bin
[section1@localhost bin]$ 

Listing 06: Terminal 01 – Moving to the path directory apache-tomcat-7.0.27/bin

Is always wise be curious, let’s see what files we have within the apache-tomcat-7.0.27/bin directory

Figure 08: the apache-tomcat-7.0.27/bin directory content

Step 08: Startup the Apache Tomcat Server

Within the apache-tomcat-7.0.27/bin directory we have a file of our interest to startup the Tomcat server. It is the startup.sh file script.

Warning: Bear in mind it is a tutorial only for installation purposes, I am not including mandatory and important configuration settings about the heap size to avoid problems about the performance with Apache Tomcat. It will covered in other tutorials.

Therefore, to startup Tomcat just execute the command (really the script) ./startup.sh within the terminal 01

[section1@localhost bin]$ 
[section1@localhost bin]$ ./startup.sh 
Using CATALINA_BASE:   /home/section1/whiteroom/apache/tomcat/apache-tomcat-7.0.27
Using CATALINA_HOME:   /home/section1/whiteroom/apache/tomcat/apache-tomcat-7.0.27
Using CATALINA_TMPDIR: /home/section1/whiteroom/apache/tomcat/apache-tomcat-7.0.27/temp
Using JRE_HOME:        /home/section1/whiteroom/sun/jdk/jdk1.7.0_04
Using CLASSPATH:       /home/section1/whiteroom/apache/tomcat/apache-tomcat-7.0.27/bin/bootstrap.jar:/home/section1/whiteroom/apache/tomcat/apache-tomcat-7.0.27/bin/tomcat-juli.jar
[section1@localhost bin]$ 

Listing 07: Terminal 01 – Startup Apache Tomcat Server through the execution of the startup.sh file script

To check if the Tomcat has started successfully, proceed to open your favourite Web Browser and write in the URL address http://localhost:8080. If all is correct you must see the follow image.

Figure 09: Checking if Tomcat server is started through the URL address http://localhost:8080

Step 09: Shutdown the Apache Tomcat Server

Again, within the apache-tomcat-7.0.27/bin directory we have a file of our interest to start the Tomcat server. It is the shutdown.sh file script.

Therefore, to shutdown Tomcat just execute the command (really the script) ./shutdown.sh within the terminal 01

[section1@localhost bin]$
[section1@localhost bin]$ ./shutdown.sh 
Using CATALINA_BASE:   /home/section1/whiteroom/apache/tomcat/apache-tomcat-7.0.27
Using CATALINA_HOME:   /home/section1/whiteroom/apache/tomcat/apache-tomcat-7.0.27
Using CATALINA_TMPDIR: /home/section1/whiteroom/apache/tomcat/apache-tomcat-7.0.27/temp
Using JRE_HOME:        /home/section1/whiteroom/sun/jdk/jdk1.7.0_04
Using CLASSPATH:       /home/section1/whiteroom/apache/tomcat/apache-tomcat-7.0.27/bin/bootstrap.jar:/home/section1/whiteroom/apache/tomcat/apache-tomcat-7.0.27/bin/tomcat-juli.jar
[section1@localhost bin]$ 

Listing 08: Terminal 01 – Shutdown Apache Tomcat Server through the execution of the shutdown.sh file script

Final Notes

Congratulations, now you have learned how install Apache Tomcat 7 into Fedora Core 17.

In other tutorials, I will explain more about Apache Tomcat 7, be ready!

Home

Advertisements

9 thoughts on “How To: Installing Apache Tomcat 7 in Linux Fedora Core 17

  1. Here it gives error ./startup.sh and ./shutdown.sh bash: ./shutdown.sh: Permission denied
    even if i logged in with root in FEDORA 16.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s