How to Install Apache Tomcat Web App Server in 10 Minutes

How to Install Apache Tomcat on Mac OS X Snow Leopard

This tutorial will guide the user through the steps of installing Apache Tomcat on Mac OS X.

Prepare the Mac OS X to use the cURL command as Wget : Open a Terminal Window (Applications -> Utilities -> Terminal) and add wget as an alias for curl to the bash_profile file with the following command. Close the Terminal Window when complete.

# Add the wget alias for curl to the end of the bash_profile file
#----------------------------------------------------------------------------#
echo 'alias wget="curl -O"' >> ~/.bash_profile

Apache Tomcat Web App Server

Apache Tomcat is developed in an open and participatory environment and released under the Apache License version 2. Apache Tomcat is intended to be a collaboration of the best-of-breed developers from around the world. There is an open invitation to participate in this open development project. To learn more about getting involved, click here.

Apache Tomcat powers numerous large-scale, mission-critical web applications across a diverse range of industries and organizations. Some of these users and their stories are listed on the PoweredBy wiki page.  Learn more here.

Mac OS X Snow Leopard

Mac OS X is renowned for its simplicity, its reliability, and its ease of use. So when it came to designing Snow Leopard, Apple engineers had a single goal: to make a great thing even better.  Learn more here.

7 Steps for Installing Tomcat on Mac OS X

Open a Terminal Window and follow these seven steps to install and configure Tomcat on Mac OS X. Application developers can download Tomcat and configure it with various editors, but the method described here can save time and reduce mistakes. This method also supports remote installation. The steps described here, with a modification to step six, can be used to remotely install Tomcat on Unix based systems. This is helpful in “Cloud Computing” environments.

#----------------------------------------------------------------------------#
# 1. ) Navigate to your "projects" directory
# The path for this guide is "/projects/", but the reader's path may be different.
#----------------------------------------------------------------------------#
cd /projects
#----------------------------------------------------------------------------#
# 2. ) Create a new directory named "tomcats" and navigate into "tomcats"
#----------------------------------------------------------------------------#
mkdir tomcats
cd tomcats
#----------------------------------------------------------------------------#
# 3. ) Download Apache Tomcat
# Note: Visit http://tomcat.apache.org to get the URL of the needed version of Tomcat
#----------------------------------------------------------------------------#
wget http://apache.cs.utah.edu/tomcat/tomcat-7/v7.0.10/bin/apache-tomcat-7.0.10.tar.gz
#----------------------------------------------------------------------------#
# 4. ) Unpack Tomcat and delete apache-tomcat-7.0.10.tar.gz
#----------------------------------------------------------------------------#
tar -xzvf apache-tomcat-7.0.10.tar.gz
rm apache-tomcat-7.0.10.tar.gz
#----------------------------------------------------------------------------#
# 5. ) Rename "apache-tomcat-7.0.10" to "tomcat"
#----------------------------------------------------------------------------#
mv apache-tomcat-7.0.10 tomcat
#----------------------------------------------------------------------------#
# 6. ) Edit "tomcat/bin/startup.sh" to add JAVA_HOME
#----------------------------------------------------------------------------#
nano tomcat/bin/startup.sh
# Add the following line after the one that starts with EXECUATBLE:
# export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home
# Save changes, press Ctrl+o ; return ; Ctrl+x
# Note: Application developers can browse "/System/Library/Frameworks/JavaVM.framework/Versions"
# and substitute the appropriate version of Java
#----------------------------------------------------------------------------#
# 7. ) Start Tomcat
#----------------------------------------------------------------------------#
sh tomcat/bin/startup.sh
#----------------------------------------------------------------------------#
# Open a web browser and navigate to http://localhost:8080
# Tomcat can be shut down with sh tomcat/bin/shutdown.sh
#----------------------------------------------------------------------------#

Apache Tomcat App Server Successfully Installed on Mac OS X

Open a web browser and navigate to http://localhost:8080 Application developers should see the main Tomcat page displayed in their web browser.

How to Access Tomcat Virtual Host Manager

Application developers should also configure authorization for the Tomcat Virtual Host Manager.

How to Access Tomcat Application Manager

Application developers should also configure authorization for the Tomcat Application Manager.

How to Configure Authorization for Tomcat Administrators

Go back to the Terminal Window and edit “tomcat/conf/tomcat-users.xml” to add roles and users to “tomcat-users” that can access the Tomcat Administrator areas.

#----------------------------------------------------------------------------#
# 1. ) edit "tomcat/conf/tomcat-users.xml"
#----------------------------------------------------------------------------#
nano tomcat/conf/tomcat-users.xml
# Save changes when complete, press Ctrl+o ; return ; Ctrl+x
#----------------------------------------------------------------------------#






#----------------------------------------------------------------------------#
# 2. ) Restart Tomcat to apply changes in configuration
#----------------------------------------------------------------------------#
sh tomcat/bin/shutdown.sh
sh tomcat/bin/startup.sh
#----------------------------------------------------------------------------#

Apache Tomcat Web Application Manager

Authorization has now been configured for the Tomcat Application Manager.

Apache Tomcat Virtual Host Manager

Authorization has now been configured for the Tomcat Virtual Host Manager

Tomcat Mac OS X Resources

How to Setup a Virtual Web Server in 10 Minutes

Virtual Hosting

Virtual hosting is a method for hosting multiple domain names on a computer using a single IP address. This allows one machine to share its resources, such as memory and processor cycles, to use its resources more efficiently.

Introduction

This article will walk the reader through a few simple steps on how to setup a virtual web server in 10 minutes.  The steps outlined here describe how to install Apache Web Server with the MySQL Database, PHP, & Perl.  This is a tutorial on how to setup a virtual web server on the Apple Macbook Pro, but the same steps apply for a Microsoft Windows computer with a few simple modifications.

The Apple Macbook Pro OS X already comes bundled with a web server.  This Mac OS X web server can be enabled by following the steps outlined in this article, “How to set up a Web Server in Mac OS X Leopard“.

This tutorial will show how to install and configure a virtual web server for web development that can be removed at will.  Web developers experimenting with cutting edge technologies and custom configurations usually need multiple environments.

Please use caution when installing new software on computer systems.  A Best Practice includes creating system backups before changes.

1. How to Install Open Source Software

The good people at Apache Friends have made this step extremely easy.  People can download an Apache distribution containing MySQL, PHP and Perl in the XAMPP package.  Download and install XAMPP by following the steps defined at http://www.apachefriends.org/en/xampp.html

2. Edit the Local Host File

sudo nano /private/etc/hosts

The entries in this file start with something like this:

# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1       localhost

add the new server name to the bottom of the list here

127.0.0.1 virtualserver1.dev

Press control-o to save the file, then enter, and control-x to exit the editor.
Flush the DNS Cache to activate changes

dscacheutil -flushcache

3. Update the Virtual Host File

sudo nano /Applications/xampp/etc/extra/httpd-vhosts.conf

This file will look very similar to the text below. Delete everything in this file and add the virtual host information.

    ServerAdmin webmaster@dummy-host.example.com
    DocumentRoot "/Applications/XAMPP/xamppfiles/docs/dummy-host.example.com"
    ServerName dummy-host.example.com
    ServerAlias www.dummy-host.example.com
    ErrorLog "logs/dummy-host.example.com-error_log"
    CustomLog "logs/dummy-host.example.com-access_log" common

New Virtual Host File

# Virtual Hosts
#
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# 
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.

#
# Use name-based virtual hosting.
#
NameVirtualHost 127.0.0.1

    ServerAdmin webmaster@virtualserver1.dev
    DocumentRoot "/projects/virtualserver1/docs/public_html"
    ServerName virtualserver1.dev
    ServerAlias www.virtualserver1.dev
    
    Options Indexes FollowSymLinks Includes ExecCGI
    AllowOverride All
    Order allow,deny
    Allow from all
    
    ErrorLog "logs/virtualserver1-error_log"
    #Don't really need a log file for a local web server
    #CustomLog "logs/webtechman.dev-access_log" common

4. Update the HTTPD Config File

sudo nano /Applications/XAMPP/xamppfiles/etc/httpd.conf

Remove the comment from #Include /Applications/xampp/etc/extra/httpd-vhosts.conf
Original line

#Include /Applications/xampp/etc/extra/httpd-vhosts.conf

Updated line

Include /Applications/xampp/etc/extra/httpd-vhosts.conf

Create a test file for the “Document Root” folder identified in the new virtual host and save it as “index.php”.




 
 
 
 


Hello

5. Viewing The Virtual Environment

Navigate to “/Applications/XAMPP” and run XAMPP Control

Start the database and web server from the XAMPP Control

Open a web browser and navigate to http://localhost and see the default XAMPP page.

Open a web browser and navigate to http://localhost/phpmyadmin/ and see the MYSQL database manager.

Open a web browser and navigate to http://virtualserver1.dev/index.php and see the test page from the new virtual web server.

Adding Additional Virtual Web Servers

Additional virtual web servers can be created by repeating steps 2 & 3.  The new virtual web servers will need unique names, for example: “virtualserver2″, “virtualserver3″, “virtualserver4″, or “mydevserver”.

Fixing MySQL error 13 on Mac OS X 10.6.x: This error usually occurs when the curly quotes are used in the configuration files, which happens when copying and pasting code from the web.  This error can be fixed by changing these “HTML quotes” to normal “quotes”.

Summary

Setting up virtual web servers in the development environment is a very simple task.  Local instances of web server software allows web developers to experiment with features of web applications like WordPress blog software.  The new features can be tested locally before implemented in a production environment.  Each of these virtual environments can be configured to meet custom needs.  Learn more about Apache Web Server Name-based Virtual Hosting here.

Note: The “Document Root” is outside of the web server software installation, which allows replacing the current web server software with something like “Zend Server” without disrupting current web site files.

Why I Hate Open Source!

Working with #opensource: Upgrading

I manage a Social Media Platform created from Open Source software and here are the INSANE steps I go through for updates.

Step 1

Click on “upgrade automatically”.

buddypress-update-step-1

Step 2

Enter connection information.

buddypress-update-step-2

Step 3

Click on “activate plugin”, which returns me to a page showing “Plugin Activated”.

buddypress-update-step-3

Can you see why I hate Open Source?

I hate open source software, because it’s too easy! In the past, this type of process would take a specialized team of people hours upon hours to complete.  This task was completed in less than 10 minutes, thanks to Open Source and the brilliant members of #opensource communities.

Now I have the the time and money to go shoe shopping with my wife, thanks a lot #opensource?!?!  My wife overheard me and my associates talking about moving this platform into the cloud.  The cloud computing solution will save us even more money and time.  My wife is so excited, she added an additional page to the “honey do” list.

Special Thanks!

A special “Thank you!” to members of open source development communities.  I understand most of you have full-time jobs, families, and other interests.  You volunteer your time during lunch breaks, weekends, and the midnight hour to solve problems and share solutions.  My colleagues and I, plus countless people around the world have more time to focus on relationships with people around us because of your tireless dedication.  Thank You!

I also appreciate the work of Matt Mullenweg creator of WordPress and founder of Automatic.  Thanks to Andy Peatling and the BuddyPress Community.  You should see this article by Andy: “Give a Little“.

BuddyPress: Social networking in a box

Build a social network for your company, school, sports team or niche community all based on the power and flexibility of WordPress.

Visit BuddyPress.org

Visit BuddyPress.org

Cloud Computing with Amazon E2C

Amazon Elastic Compute Cloud (Amazon EC2) is a web service that provides resizable compute capacity in the cloud. It is designed to make web-scale computing easier for developers.

Visit Amazon Elastic Compute Cloud

Visit Amazon Elastic Compute Cloud