Section 11.1. Installing Apache Software

   

11.1 Installing Apache Software

The Apache server software is bundled with many Unix systems. Frequently, Apache is installed as part of the initial operating system installation. For example, the initial installation of a Red Hat system presents a screen that allows the user to select the Apache software by clicking on an icon labeled Apache Web Server.

Frequently, users select the Apache server software even when they don't plan to run a web server. You might be surprised to find an Apache server installed and running on client desktop workstations. Try a ps test:

$ ps ax | grep httpd   321  ?  S    0:00 httpd   324  ?  S    0:00 httpd   325  ?  S    0:00 httpd   326  ?  S    0:00 httpd   329  ?  S    0:00 (httpd)   330  ?  S    0:00 (httpd)   331  ?  S    0:00 (httpd)   332  ?  S    0:00 (httpd)   333  ?  S    0:00 (httpd)   334  ?  S    0:00 (httpd)   335  ?  S    0:00 (httpd)   2539  p1 D    0:00 grep http

The daemon that Apache installs to provide web services is the Hypertext Transport Protocol daemon (httpd). Use the process status (ps) command to check for all processes in the system, and the grep command to display only those with the name httpd. Running this test on a freshly installed system will show you if Apache is installed and running.

If Apache is running, start the Netscape web browser and enter "localhost" in the search box. Figure 11-1 shows the result on a sample Red Hat 7 system. Not only is Apache installed and running, it is configured and responding with a web page. Users of desktop Linux systems are sometimes surprised to find out they are running a fully functional web server. Of course, if you're the administrator of a web server system, this is exactly what you want to see Apache installed, up, and running.

Figure 11-1. Default Apache server web page
figs/tcp3_1101.gif

If the Apache software is not installed on your system, you need to install the package. The easiest way to install optional software on a Linux system is to use a package manager. Several good ones are available. Most Linux systems support the Red Hat Package Manager (rpm), so we'll use that in the following example.

11.1.1 Using the Red Hat Package Manager

Use the Red Hat Package Manager to install needed software, remove unneeded software, and check what software is installed. rpm has many options for the developers who build the packages, but for a network administrator, rpm comes down to three basic commands:

rpm --install package

The --install option installs software.

rpm --uninstall package

The --uninstall option removes software.

rpm --query

The --query option lists a software package that is already installed. Use --all with the --query option to list all installed packages.

You must know the name of a package to install it with rpm. To find the full name of the Apache package, mount the Linux CD-ROM and look in the RPMS directory. Here is an example from a Red Hat 7.2 system:

$ cd /mnt/cdrom/RedHat/RPMS $ ls *apache* apache-1.3.20-16.i386.rpm apacheconf-0.8.1-1.noarch.rpm

This example assumes that the CD-ROM was mounted on /mnt/cdrom. It shows that two Apache software packages are included in the Red Hat distribution: the web server software and a Red Hat configuration tool. Install apache-1.3.20-16.i386.rpm with this command to get the web server software:

# rpm  -- install apache-1.3.20-16.i386.rpm

After installing the package, check that it is installed with this rpm command:

$ rpm  -- query apache apache-1.3.20-16

Once the Apache package is installed, make sure the httpd daemons are started at boot time. On a Red Hat system, the script /etc/init.d/httpd starts the daemons. Use chkconfig or a similar command to add the script to the boot process. The following example adds the httpd startup script to the boot process for runlevels 3 and 5:

# chkconfig  -- list httpd httpd           0:off   1:off   2:off   3:off   4:off   5:off   6:off # chkconfig  -- level 35  httpd on # chkconfig  -- list httpd httpd           0:off   1:off   2:off   3:on    4:off   5:on    6:off

The first chkconfig command lists the status of the httpd script for every runlevel. The response shows that httpd is off for all seven runlevels, meaning that the script is not run. We want to start the web server at runlevel 3, which is the multiuser runlevel, and at runlevel 5, which is the default runlevel for this Red Hat system. The second chkconfig command does this. The --level argument specifies that runlevel 3 and runlevel 5 are affected note that the 3 and the 5 are run together with no intervening spaces. The httpd on argument says that the httpd script should be executed for those two runlevels. The last chkconfig command again lists the status of the httpd script for all runlevels. This time it shows that httpd will be executed for runlevel 3 and runlevel 5.

The next time this Red Hat system reboots, the web server will be running. To start the web server without rebooting, invoke the httpd script from the command line:

# /etc/init.d/httpd start Starting httpd:                                            [  OK  ]

Installing Apache on a Linux system is straightforward. It is often installed during the initial system setup; if not, it can usually be installed from the CDs that came with the system. Installing Apache on a Solaris system is just as simple because Solaris 8 also includes Apache as part of the operating system. If your Unix system does not include Apache, download it from the Internet.

11.1.2 Downloading Apache

Apache is available from http://www.apache.org in both source and binary forms. The Apache source is available for Unix systems in both compressed and zipped tarballs. You can download and compile the source, but the easiest way to get Apache is as a precompiled binary. Figure 11-2 shows just some of the versions of Unix for which precompiled httpd server daemons are available.

Figure 11-2. Binary distributions at the Apache web site
figs/tcp3_1102.gif

The binaries are listed by operating system. Assume you have a FreeBSD system. Click on the freebsd link, and you're presented with a long list of zipped tarballs. Each tarball relates to a different version of FreeBSD and contains an Apache binary distribution. Select the binary that is appropriate for your version of FreeBSD and download it to a working directory. Make a backup copy of the current daemon and extract the new daemon with tar. The software should now be installed and ready to run with the configuration files from your current configuration.

       


    TCP/IP Network Administration
    Advanced Topics in Global Information Management, Vol. 3 (Advanced Topics in Global Information Management Series)
    ISBN: 1591402514
    EAN: 2147483647
    Year: 2001
    Pages: 181

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net