Tomcat Installaiton Final Document
Tomcat Installaiton Final Document
A web application (or webapp), unlike standalone application, runs over the Internet.
Examples of webapps are google, amazon, ebay, facebook and twitter.
A webapp is typically a 3-tier (or multi-tier) client-server database application run over
the Internet as illustrated in the diagram below. It comprises five components:
1. HTTP Server: E.g., Apache HTTP Server, Apache Tomcat Server, Microsoft Internet
Information Server (IIS), nginx, Google Web Server (GWS), and others.
2. HTTP Client (or Web Browser): E.g., Internet Explorer (MSIE), FireFox, Chrome, Safari, and
others.
3. Database: E.g., Open-source MySQL, Apache Derby, mSQL, SQLite, PostgreSQL,
OpenOffice's Base; Commercial Oracle, IBM DB2, SAP SyBase, MS SQL Server, MS Access;
and others.
4. Client-Side Programs: could be written in HTML Form, JavaScript, VBScript, Flash, and
others.
5. Server-Side Programs: could be written in Java Servlet/JSP, ASP, PHP, Perl, Python, CGI, and
others.
HTTP is an application layer protocol runs over TCP/IP. The IP provides support for routing
and addressing (via an unique IP address for machines on the Internet); while TCP supports
multiplexing via 64K ports from port number 0 to 65535. The default port number
assigned to HTTP is TCP port 80.
HTTP is a pull protocol, a client pulls a page from the server (instead of server pushes
pages to the clients).
Tomcat is an HTTP application runs over TCP/IP. In other words, the Tomcat server runs on
a specific TCP port in a specific IP address. The default TCP port number for HTTP
protocol is 80, which is used for the production HTTP server. For test HTTP server, you
can choose any unused port number between 1024 and 65535.
PreRequirement
Apt-get
The Advanced Package Tool, or APT, is a free software user interface that works
with core libraries to handle the installation and removal of software on
the Debian GNU/Linux distribution and its variants.APT simplifies the process of
managing software on Unix-like computer systems by automating the retrieval,
configuration and installation of software packages, either from precompiled files or
by compiling source code.
APT was originally designed as a front-end for dpkg to work with Debian's .deb packages,
but it has since been modified to also work with the RPM Package Manager system
via APT-RPM.The Fink project has ported APT to Mac OS X for some of its own package
management tasks,and APT is also available in OpenSolaris.
The apt-get utility is a powerful and free package management command line
program, that is used to work with Ubuntus APT (Advanced Packaging Tool) library
to perform installation of new software packages, removing existing software packages,
upgrading of existing software packages and even used to upgrading the entire
operating system.
Name
apt-get - APT package handling utility - command-line interface
Synopsis
apt-get [options] [-o config=string] [-c=cfgfile] command [pkg]
Description
apt-get is the command-line tool for handling packages, and may be considered the
user's "back-end" to other tools using the APT library. Several "front-end" interfaces
exist, such as synaptic and aptitude.
Commands
Unless the -h, or --help option is given, one of the commands below must be present.
What is apt-cache?
The apt-cache command line tool is used for searching apt software package cache. In
simple words, this tool is used to search software packages, collects information of
packages and also used to search for what available packages are ready for installation
on Debian or Ubuntu based systems.
Architecture: all
Version: 1.10-40
Depends: netcat-traditional (>= 1.10-39)
Filename: pool/universe/n/netcat/netcat_1.10-40_all.deb
Size: 3340
MD5sum: 37c303f02b260481fa4fc9fb8b2c1004
SHA1: 0371a3950d6967480985aa014fbb6fb898bcea3a
SHA256: eeecb4c93f03f455d2c3f57b0a1e83b54dbeced0918ae563784e86a37bcc16c9
Description-en: TCP/IP swiss army knife -- transitional package
This is a "dummy" package that depends on lenny's default version of
netcat, to ease upgrades. It may be safely removed.
Description-md5: 1353f8c1d079348417c2180319bdde09
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Origin: Ubuntu
4. How Do I Check Dependencies for Specific Packages?
Use the showpkg sub command to check the dependencies for particular software
packages. whether those dependencies packages are installed or not. For example, use
the showpkg command along with package-name.
$ apt-cacheshowpkgvsftpd
Package: vsftpd
Versions:
2.3.5-3ubuntu1
(/var/lib/apt/lists/in.archive.ubuntu.com_ubuntu_dists_quantal_main_binaryi386_Packages)
Description Language:
File:
/var/lib/apt/lists/in.archive.ubuntu.com_ubuntu_dists_quantal_main_binary-i386_Packages
MD5: 81386f72ac91a5ea48f8db0b023f3f9b
Description Language: en
File:
/var/lib/apt/lists/in.archive.ubuntu.com_ubuntu_dists_quantal_main_i18n_Translation-en
MD5: 81386f72ac91a5ea48f8db0b023f3f9b
Reverse Depends:
ubumirror,vsftpd
harden-servers,vsftpd
Dependencies:
2.3.5-3ubuntu1 - debconf (18 0.5) debconf-2.0 (0 (null)) upstart-job (0 (null)) libc6 (2
2.15) libcap2 (2 2.10) libpam0g (2 0.99.7.1) libssl1.0.0 (2 1.0.0) libwrap0 (2 7.6-4~)
adduser (0 (null)) libpam-modules (0 (null)) netbase (0 (null)) logrotate (0 (null)) ftpserver (0 (null)) ftp-server (0 (null))
Provides:
2.3.5-3ubuntu1 - ftp-server
Reverse Provides:
packages which are not already installed neither retrieved and installed to satisfy
upgrade dependencies.
$ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages have been kept back:
linux-headers-genericlinux-image-generic wine1.5 wine1.5-i386
The following packages will be upgraded:
activity-log-manager-common
activity-log-manager-control-centeradium-themeubuntualacarte
alsa-base app-install-data-partner appmenu-gtk appmenu-gtk3 apportapport-gtk apt
apt-transport-https apt-utilsaptdaemonaptdaemon-data at-spi2-core bamfdaemon basefiles bind9-host
...
However, if you want to upgrade, unconcerned of whether software packages will be
added or removed to fulfill dependencies, use the dist-upgrade sub command.
$ sudo apt-get dist-upgrade
8. How Do I Install or Upgrade Specific Packages?
The install sub command is tracked by one or more packages wish for installation or
upgrading.
$ sudo apt-get install netcat
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
netcat-traditional
The following NEW packages will be installed:
netcatnetcat-traditional
0 upgraded, 2 newly installed, 0 to remove and 328 not upgraded.
Need to get 67.1 kB of archives.
After this operation, 186 kB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://in.archive.ubuntu.com/ubuntu/ quantal/universe netcat-traditional i386 1.1040 [63.8 kB]
Get:2 http://in.archive.ubuntu.com/ubuntu/ quantal/universe netcat all 1.10-40 [3,340 B]
Fetched 67.1 kB in 1s (37.5 kB/s)
Selecting previously unselected package netcat-traditional.
(Reading database ... 216118 files and directories currently installed.)
Unpacking netcat-traditional (from .../netcat-traditional_1.10-40_i386.deb) ...
Selecting previously unselected package netcat.
Unpacking netcat (from .../netcat_1.10-40_all.deb) ...
Processing triggers for man-db ...
Setting up netcat-traditional (1.10-40) ...
Setting up netcat (1.10-40) ...
What is Sudo
sudo (/sudu/[2] or /sudo/[2][3])
is
a program for Unix-like computer operating
systems that allows users to run programs with the security privileges of another user
(normally the superuser, or root).[4] Its name is a contraction of "substitute user do",
meaning to do something as a different user (typically as root, the "superuser"). [5]
Unlike the su command, users typically supply their own password to sudo rather than
the root password. After authentication, and if the /usr/local/etc/sudoers (sometimes
found at /etc/sudoers) configuration file permits the user access, then the system will
invoke the requested command. The sudoers configuration file enables a huge amount of
configurability, including but not limited to: enabling root commands only from the
invoking terminal; not requiring a password for certain commands; requiring a password
per user or group; requiring re-entry of a password every time or never requiring a
password at all for a particular command line. It can also be configured to permit passing
arguments or multiple commands, and even supports commands with regular
expressions.
NAME
sudo, sudoedit - execute a command as another user
SYNOPSIS
sudo -h | -K | -k | -L | -l | -V | -v
sudo [-bEHPS] [-p prompt] [-u username|#uid] [VAR=value] {-i | -s | command}
sudoedit [-S] [-p prompt] [-u username|#uid] file ...
DESCRIPTION
sudo allows a permitted user to execute a command as the superuser or another user,
as specified in the sudoers file. The real and effective uid and gid are set to match those
of the target user as specified in the passwd file and the group vector is initialized based
on the group file (unless the -P option was specified). If the invoking user is root or if the
target user is the same as the invoking user, no password is required.
Otherwise, sudo requires that users authenticate themselves with a password by default
(NOTE: in the default configuration this is the users password, not the root password).
Once a user has been authenticated, a timestamp is updated and the user may then use
sudo without a password for a short period of time (5minutes unless overridden
in sudoers).
When invoked as sudoedit, the -e option (described below), is implied.
sudo determines who is an authorized user by consulting the file /etc/sudoers. By
giving sudothe -v flag, a user can update the time stamp without running a command.
The password prompt itself will also time out if the users password is not entered
within 5 minutes (unless overridden via sudoers).
If a user who is not listed in the sudoers file tries to run a command via sudo, mail is
sent to the proper authorities, as defined at configure time or in the sudoers file (defaults
to root). Note that the mail will not be sent if an unauthorized user tries to run sudo with
the -l or -v flags. This allows users to determine for themselves whether or not they are
allowed to use sudo.
If sudo is run by root and the SUDO_USER environment variable is set, sudo will use this
value to determine who the actual user is. This can be used by a user to log commands
through sudo even when a root shell has been invoked. It also allows the -e flag to
remain useful even when being run via a sudo-run script or program. Note however, that
the sudoers lookup is still done for root, not the user specified by SUDO_USER.
sudo can log both successful and unsuccessful attempts (as well as errors) to syslog(3),
a log file, or both. By default sudo will log via syslog(3) but this is changeable at
configure time or via the sudoers file.
Then, depending on the version you want to install, execute one of the following
commands:
Oracle JDK 6
This is an old version but still in use.
sudo apt-get install oracle-java6-installer
Oracle JDK 7
This is the latest stable version.
sudo apt-get install oracle-java7-installer
Oracle JDK 8
sudo apt-get install oracle-java8-installer
Managing Java (optional)
When there are multiple Java installations on your Computer, the Java version to use as
default can be chosen. To do this, execute the following command:
sudo update-alternatives --config java
It will usually return something like this if you have 2 installations (if you have more, it
will of course return more):
There are 2 choices for the alternative java (providing /usr/bin/java).
Selection
*0
Path
/usr/lib/jvm/java-7-oracle/jre/bin/java
Priority
1062
/usr/lib/jvm/java-6-openjdkamd64/jre/bin/java
1061
/usr/lib/jvm/java-7-oracle/jre/bin/java
1062
Status
auto
mode
manual
mode
manual
mode
It is the same selection screen as the previous command and should be used in the same
way. This command can be executed for all other commands which have different
installations. In Java, this includes but is not limited to: keytool, javadoc and jarsigner.
Tomcat 7.0
"7.0.{xx}"
(where {xx} denotes the latest upgrade number) Binary distribution Core "tar.gz"
package (e.g., "apache-tomcat-7.0.{xx}.tar.gz", about 8 MB).
2.File is Down Loaded In Downloads Folder.
3.Extract files from that tar file and store it under a separate directory.
4.Installation can be done through apt-get by typing:
sudo apt-get install tomcat7
It will ask for admin password.
5.Create a simple html page as follows and save as hello.jsp
<html>
<head><title>Hello</title></head>
<body>Hello World</body>
</html>
6.Type sudo nautilus in terminal without double codes
A window will appear, in that open path
filesystem/var/lib/samba/
In this directory, make a new folder usershares if it is not present.
7.Now open path
filesystem/var/lib/tomcat7/webapps
8.In that directory, create a new folder jsp and put the hello.jsp file in that directory.
9.To run in browser type URL http://localhost:8080/jsp/hello.jsp or
http://YOURIPADDRESS:8080/jsp/hello.jsp
8080 is a port number for apache tomcat server.
Note: ip address can be found by typing ifconfig in terminal.