Table of Contents

APACHE 2 WEB SERVER INSTALL

John T. Rine

Objective

The objective of this project is to successfully install the Apache 2 Web server and then create a Web page and place it on the Server and access the Web page across the network using a Web browser.

Materials/Reading/Prerequisites

To do this project, you will need to have successfully completed:

Background

Web servers use the client/server model. That is, the client makes a request, and the server responds by fullfilling that request.When a URL to a Web page is entered into the Web browser, the browser segments it into protocol, server, and resource (page). The browser then sends a request for a particular page (resource to the server, and the server responds by sending the requested page; in the case of a Web page, it sends it encoded as HTML. When the browser gets the page, it interprets it and then displays it. There are many protocols used for different purposes across the Internet for example, HTTP-Hypertext Transfer Protocol, FTP-File Transfer Protocol, and HTTPS-Secure HTTP. The communication protocol used to request and serve unsecure Web pages is HTTP. As we learned in our networking fundamentals course, the well known port for HTTP is port 80. So a Web server listens at port 80 (usually) for a request from a Web client.

Procedure

After logging in as root, I performed an apt-get install of the apache 2 Web server packages.

root@dhcp-179:/home/bob# apt-get install apache2 apache2-doc apache2-utils
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  apache2-mpm-worker apache2.2-common
Suggested packages:
  apache2-suexec apache2-suexec-custom
The following NEW packages will be installed:
  apache2 apache2-doc apache2-mpm-worker apache2-utils apache2.2-common
0 upgraded, 5 newly installed, 0 to remove and 0 not upgraded.
Need to get 2,779 kB of archives.
After this operation, 15.1 MB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://security.debian.org/ squeeze/updates/main apache2-utils i386 2.2.16-6+squeeze1 [165 kB]
Get:2 http://security.debian.org/ squeeze/updates/main apache2.2-common i386 2.2.16-6+squeeze1 [307 kB]
Get:3 http://security.debian.org/ squeeze/updates/main apache2-mpm-worker i386 2.2.16-6+squeeze1 [2,230 B]
Get:4 http://security.debian.org/ squeeze/updates/main apache2 i386 2.2.16-6+squeeze1 [1,386 B]
Get:5 http://security.debian.org/ squeeze/updates/main apache2-doc all 2.2.16-6+squeeze1 [2,304 kB]
Fetched 2,779 kB in 7s (387 kB/s)                                                             
Selecting previously deselected package apache2-utils.
(Reading database ... 124913 files and directories currently installed.)
Unpacking apache2-utils (from .../apache2-utils_2.2.16-6+squeeze1_i386.deb) ...
Selecting previously deselected package apache2.2-common.
Unpacking apache2.2-common (from .../apache2.2-common_2.2.16-6+squeeze1_i386.deb) ...
Selecting previously deselected package apache2-mpm-worker.
Unpacking apache2-mpm-worker (from .../apache2-mpm-worker_2.2.16-6+squeeze1_i386.deb) ...
Selecting previously deselected package apache2.
Unpacking apache2 (from .../apache2_2.2.16-6+squeeze1_i386.deb) ...
Selecting previously deselected package apache2-doc.
Unpacking apache2-doc (from .../apache2-doc_2.2.16-6+squeeze1_all.deb) ...
Processing triggers for man-db ...
Setting up apache2-utils (2.2.16-6+squeeze1) ...
Setting up apache2.2-common (2.2.16-6+squeeze1) ...
Enabling site default.
Enabling module alias.
Enabling module autoindex.
Enabling module dir.
Enabling module env.
Enabling module mime.
Enabling module negotiation.
Enabling module setenvif.
Enabling module status.
Enabling module auth_basic.
Enabling module deflate.
Enabling module authz_default.
Enabling module authz_user.
Enabling module authz_groupfile.
Enabling module authn_file.
Enabling module authz_host.
Enabling module reqtimeout.
Setting up apache2-mpm-worker (2.2.16-6+squeeze1) ...
Starting web server: apache2.
Setting up apache2 (2.2.16-6+squeeze1) ...
Setting up apache2-doc (2.2.16-6+squeeze1) ...
Reloading web server config: apache2.
root@dhcp-179:/home/bob# 
root@dhcp-179:/home/bob# 
root@dhcp-179:/home/bob# apt-get install libapache2-mod-ruby
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  libapache-ruby1.8 libreadline5 libruby1.8
Suggested packages:
  liberuby
The following NEW packages will be installed:
  libapache-ruby1.8 libapache2-mod-ruby libreadline5 libruby1.8
0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded.
Need to get 2,180 kB of archives.
After this operation, 8,147 kB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://debian.uchicago.edu/debian/ squeeze/main libreadline5 i386 5.2-7 [135 kB]
Get:2 http://debian.uchicago.edu/debian/ squeeze/main libruby1.8 i386 1.8.7.302-2 [1,965 kB]
Get:3 http://debian.uchicago.edu/debian/ squeeze/main libapache-ruby1.8 all 1.2.6-2 [20.5 kB]
Get:4 http://debian.uchicago.edu/debian/ squeeze/main libapache2-mod-ruby i386 1.2.6-2 [59.7 kB]
Fetched 2,180 kB in 5s (407 kB/s)         
Selecting previously deselected package libreadline5.
(Reading database ... 126955 files and directories currently installed.)
Unpacking libreadline5 (from .../libreadline5_5.2-7_i386.deb) ...
Selecting previously deselected package libruby1.8.
Unpacking libruby1.8 (from .../libruby1.8_1.8.7.302-2_i386.deb) ...
Selecting previously deselected package libapache-ruby1.8.
Unpacking libapache-ruby1.8 (from .../libapache-ruby1.8_1.2.6-2_all.deb) ...
Selecting previously deselected package libapache2-mod-ruby.
Unpacking libapache2-mod-ruby (from .../libapache2-mod-ruby_1.2.6-2_i386.deb) ...
Setting up libreadline5 (5.2-7) ...
Setting up libruby1.8 (1.8.7.302-2) ...
Setting up libapache-ruby1.8 (1.2.6-2) ...
Setting up libapache2-mod-ruby (1.2.6-2) ...
Enabling module ruby.
Run '/etc/init.d/apache2 restart' to activate new configuration!
root@dhcp-179:/home/bob# apt-get install libapache2-mod-perl2
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  libapache2-reload-perl libbsd-resource-perl libdevel-symdump-perl
The following NEW packages will be installed:
  libapache2-mod-perl2 libapache2-reload-perl libbsd-resource-perl libdevel-symdump-perl
0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded.
Need to get 1,146 kB of archives.
After this operation, 4,063 kB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://debian.uchicago.edu/debian/ squeeze/main libdevel-symdump-perl all 2.08-3 [16.6 kB]
Get:2 http://debian.uchicago.edu/debian/ squeeze/main libapache2-mod-perl2 i386 2.0.4-7 [1,077 kB]
Get:3 http://debian.uchicago.edu/debian/ squeeze/main libapache2-reload-perl all 0.10-2 [19.9 kB]
Get:4 http://debian.uchicago.edu/debian/ squeeze/main libbsd-resource-perl i386 1.2904-1 [32.5 kB]
Fetched 1,146 kB in 2s (418 kB/s)               
Selecting previously deselected package libdevel-symdump-perl.
(Reading database ... 127688 files and directories currently installed.)
Unpacking libdevel-symdump-perl (from .../libdevel-symdump-perl_2.08-3_all.deb) ...
Selecting previously deselected package libapache2-mod-perl2.
Unpacking libapache2-mod-perl2 (from .../libapache2-mod-perl2_2.0.4-7_i386.deb) ...
Selecting previously deselected package libapache2-reload-perl.
Unpacking libapache2-reload-perl (from .../libapache2-reload-perl_0.10-2_all.deb) ...
Selecting previously deselected package libbsd-resource-perl.
Unpacking libbsd-resource-perl (from .../libbsd-resource-perl_1.2904-1_i386.deb) ...
Processing triggers for man-db ...
Setting up libdevel-symdump-perl (2.08-3) ...
Setting up libapache2-mod-perl2 (2.0.4-7) ...
Enabling module perl.
Run '/etc/init.d/apache2 restart' to activate new configuration!
Setting up libapache2-reload-perl (0.10-2) ...
Setting up libbsd-resource-perl (1.2904-1) ...
root@dhcp-179:/home/bob# 
root@dhcp-179:/home/bob# 
root@dhcp-179:/home/bob# apt-get install libapache2-mod-python
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Suggested packages:
  libapache2-mod-python-doc
The following NEW packages will be installed:
  libapache2-mod-python
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 122 kB of archives.
After this operation, 537 kB of additional disk space will be used.
Get:1 http://debian.uchicago.edu/debian/ squeeze/main libapache2-mod-python i386 3.3.1-9+b1 [122 kB]
Fetched 122 kB in 0s (240 kB/s)           
Selecting previously deselected package libapache2-mod-python.
(Reading database ... 128129 files and directories currently installed.)
Unpacking libapache2-mod-python (from .../libapache2-mod-python_3.3.1-9+b1_i386.deb) ...
Setting up libapache2-mod-python (3.3.1-9+b1) ...
Reloading web server config: apache2.
Processing triggers for python-central ...
root@dhcp-179:/home/bob# apt-get install python-mysqldb
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  libmysqlclient16 mysql-common
Suggested packages:
  python-egenix-mxdatetime mysql-server-5.1 mysql-server python-mysqldb-dbg
The following NEW packages will be installed:
  libmysqlclient16 mysql-common python-mysqldb
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 2,101 kB of archives.
After this operation, 4,788 kB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://debian.uchicago.edu/debian/ squeeze/main mysql-common all 5.1.49-3 [70.9 kB]
Get:2 http://debian.uchicago.edu/debian/ squeeze/main libmysqlclient16 i386 5.1.49-3 [1,935 kB]
Get:3 http://debian.uchicago.edu/debian/ squeeze/main python-mysqldb i386 1.2.2-10+b1 [95.8 kB]
Fetched 2,101 kB in 5s (374 kB/s)        
Selecting previously deselected package mysql-common.
(Reading database ... 128154 files and directories currently installed.)
Unpacking mysql-common (from .../mysql-common_5.1.49-3_all.deb) ...
Selecting previously deselected package libmysqlclient16.
Unpacking libmysqlclient16 (from .../libmysqlclient16_5.1.49-3_i386.deb) ...
Selecting previously deselected package python-mysqldb.
Unpacking python-mysqldb (from .../python-mysqldb_1.2.2-10+b1_i386.deb) ...
Setting up mysql-common (5.1.49-3) ...
Setting up libmysqlclient16 (5.1.49-3) ...
Setting up python-mysqldb (1.2.2-10+b1) ...
Processing triggers for python-support ...
root@dhcp-179:/home/bob# apt-get install libapache2-mod-php5 php5 php-pear php5-xcache
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  apache2-mpm-prefork libonig2 libqdbm14 php5-cli php5-common php5-suhosin
Suggested packages:
  php5-dev
The following packages will be REMOVED:
  apache2-mpm-worker
The following NEW packages will be installed:
  apache2-mpm-prefork libapache2-mod-php5 libonig2 libqdbm14 php-pear php5 php5-cli
  php5-common php5-suhosin php5-xcache
0 upgraded, 10 newly installed, 1 to remove and 0 not upgraded.
Need to get 7,101 kB of archives.
After this operation, 20.3 MB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://debian.uchicago.edu/debian/ squeeze/main libonig2 i386 5.9.1-1 [134 kB]
Get:2 http://security.debian.org/ squeeze/updates/main apache2-mpm-prefork i386 2.2.16-6+squeeze1 [2,286 B]
Get:3 http://security.debian.org/ squeeze/updates/main php5-common i386 5.3.3-7+squeeze1 [541 kB]
Get:4 http://debian.uchicago.edu/debian/ squeeze/main libqdbm14 i386 1.8.77-4 [147 kB]
Get:5 http://debian.uchicago.edu/debian/ squeeze/main php5-suhosin i386 0.9.32.1-1 [80.8 kB]
Get:6 http://debian.uchicago.edu/debian/ squeeze/main php5-xcache i386 1.3.0-7 [86.4 kB]
Get:7 http://security.debian.org/ squeeze/updates/main libapache2-mod-php5 i386 5.3.3-7+squeeze1 [2,888 kB]
Get:8 http://security.debian.org/ squeeze/updates/main php5-cli i386 5.3.3-7+squeeze1 [2,857 kB]
Get:9 http://security.debian.org/ squeeze/updates/main php-pear all 5.3.3-7+squeeze1 [364 kB] 
Get:10 http://security.debian.org/ squeeze/updates/main php5 all 5.3.3-7+squeeze1 [1,068 B]   
Fetched 7,101 kB in 15s (445 kB/s)                                                            
dpkg: apache2-mpm-worker: dependency problems, but removing anyway as you requested:
 apache2 depends on apache2-mpm-worker (= 2.2.16-6+squeeze1) | apache2-mpm-prefork (= 2.2.16-6+squeeze1) | apache2-mpm-event (= 2.2.16-6+squeeze1) | apache2-mpm-itk (= 2.2.16-6+squeeze1); however:
  Package apache2-mpm-worker is to be removed.
  Package apache2-mpm-prefork is not installed.
  Package apache2-mpm-event is not installed.
  Package apache2-mpm-itk is not installed.
(Reading database ... 128207 files and directories currently installed.)
Removing apache2-mpm-worker ...
Stopping web server: apache2 ... waiting .
Selecting previously deselected package apache2-mpm-prefork.
(Reading database ... 128203 files and directories currently installed.)
Unpacking apache2-mpm-prefork (from .../apache2-mpm-prefork_2.2.16-6+squeeze1_i386.deb) ...
Setting up apache2-mpm-prefork (2.2.16-6+squeeze1) ...
Starting web server: apache2.
Selecting previously deselected package libonig2.
(Reading database ... 128208 files and directories currently installed.)
Unpacking libonig2 (from .../libonig2_5.9.1-1_i386.deb) ...
Selecting previously deselected package libqdbm14.
Unpacking libqdbm14 (from .../libqdbm14_1.8.77-4_i386.deb) ...
Selecting previously deselected package php5-common.
Unpacking php5-common (from .../php5-common_5.3.3-7+squeeze1_i386.deb) ...
Selecting previously deselected package libapache2-mod-php5.
Unpacking libapache2-mod-php5 (from .../libapache2-mod-php5_5.3.3-7+squeeze1_i386.deb) ...
Selecting previously deselected package php5-cli.
Unpacking php5-cli (from .../php5-cli_5.3.3-7+squeeze1_i386.deb) ...
Selecting previously deselected package php-pear.
Unpacking php-pear (from .../php-pear_5.3.3-7+squeeze1_all.deb) ...
Selecting previously deselected package php5.
Unpacking php5 (from .../php5_5.3.3-7+squeeze1_all.deb) ...
Selecting previously deselected package php5-suhosin.
Unpacking php5-suhosin (from .../php5-suhosin_0.9.32.1-1_i386.deb) ...
Selecting previously deselected package php5-xcache.
Unpacking php5-xcache (from .../php5-xcache_1.3.0-7_i386.deb) ...
Processing triggers for man-db ...
Setting up libonig2 (5.9.1-1) ...
Setting up libqdbm14 (1.8.77-4) ...
Setting up php5-common (5.3.3-7+squeeze1) ...
Setting up libapache2-mod-php5 (5.3.3-7+squeeze1) ...

Creating config file /etc/php5/apache2/php.ini with new version
Reloading web server config: apache2.
Setting up php5-cli (5.3.3-7+squeeze1) ...

Creating config file /etc/php5/cli/php.ini with new version
update-alternatives: using /usr/bin/php5 to provide /usr/bin/php (php) in auto mode.
Setting up php-pear (5.3.3-7+squeeze1) ...
Setting up php5 (5.3.3-7+squeeze1) ...
Setting up php5-suhosin (0.9.32.1-1) ...
Setting up php5-xcache (1.3.0-7) ...
root@dhcp-179:/home/bob# apt-get install php5-suhosin
Reading package lists... Done
Building dependency tree       
Reading state information... Done
php5-suhosin is already the newest version.
php5-suhosin set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
root@dhcp-179:/home/bob# apt-get install php5-mysql
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  php5-mysql
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 66.8 kB of archives.
After this operation, 250 kB of additional disk space will be used.
Get:1 http://security.debian.org/ squeeze/updates/main php5-mysql i386 5.3.3-7+squeeze1 [66.8 kB]
Fetched 66.8 kB in 2s (27.0 kB/s)     
Selecting previously deselected package php5-mysql.
(Reading database ... 128521 files and directories currently installed.)
Unpacking php5-mysql (from .../php5-mysql_5.3.3-7+squeeze1_i386.deb) ...
Processing triggers for libapache2-mod-php5 ...
Reloading web server config: apache2.
Setting up php5-mysql (5.3.3-7+squeeze1) ...
root@dhcp-179:/home/bob# cd ..
root@dhcp-179:/home# cd /
root@dhcp-179:/# cd /etc/apache2
root@dhcp-179:/etc/apache2# ls
apache2.conf  envvars	  magic		  mods-enabled	sites-available
conf.d	      httpd.conf  mods-available  ports.conf	sites-enabled
root@dhcp-179:/etc/apache2# cd /var/www
root@dhcp-179:/var/www# ls
index.html

Next, I created a simple Web page using gedit text editor and named it “index.html”:

<html>
<center><b>Anthony</b></center>
<center><p><img src="dancing-bear.gif"></center>
</html>

Next, I placed both index.html and the graphic file, “dancing bear.gif” into the /var/www directory.
Lastly, I accessed the Web page successfully using both 127.0.0.1 (localhost-loop back address) and 10.80.2.179 (the machine's IP address). loop back address

Machine's IP Address

References