initCommon(); $template->displayHeader(); ?>

3. Server Configuration

This section describes how to set up a HTTP (Web) server to support Fedora installation and software management applications.

3.1. Installing The Apache Web Server

Fedora Core provides the Apache server in the httpd package. The httpd package is included on Fedora systems installed with the Server installation type. You may have installed it later in order to run websites or Web applications. Fedora Extras also offers alternative HTTP servers, which are beyond the scope of this document.

To install the httpd package, if you have not already done so, use the following command:

su -c 'yum install httpd'

Enter the password for the root account when prompted.

To start the service, use the following command:

su -c '/sbin/service httpd start'

Enter the password for the root account when prompted.

To enable this service to load automatically at boot time, use the following command:

su -c '/sbin/chkconfig --level 345 httpd on'

Enter the password for the root account when prompted.

The default firewall configuration for Fedora blocks access from remote systems. To enable other systems to connect to your HTTP service, use the system-config-securitylevel utility:

  1. Choose DesktopSystem SettingsSecurity Level.

  2. Enter the password for the root account when prompted.

  3. Select WWW (HTTP) from the list of services.

  4. When prompted, select Yes to update the firewall configuration.

3.2. Configuring The Apache Web Server

To enable HTTP access to the files in your mirror directory, create the configuration file /etc/httpd/conf.d/mirror.conf. The following listing is an example:

# The name at which the mirror will be shared, 
# followed by the name of the root directory of that tree.
Alias /mirror /var/www/mirror

# Share options for the mirror. 
# Only allow connections from localhost and 
# IP addresses which start with 192.168.1
    <Directory /var/www/mirror>
      AllowOverride None
      Order Deny,Allow
      Deny from all
      Allow from 127.0.0.1 192.168.1
      Options Indexes
    </Directory>

Example 2. Apache 2.x configuration file for Fedora mirror

You must use root privileges to create or copy files in the directory /etc/httpd/conf.d/.

To update an active httpd service with a new configuration, use the following command:

su -c '/sbin/service httpd reload'

Enter the password for the root account when prompted.

Your clients may now visit any area of your mirror by using the URL http://server.mydomain.org/mirror/path.

[Note]Apache and SELinux

The default SELinux configuration for Fedora permits Apache to use files in the /var/www/ directory. If you build your mirror in another directory, you may need to modify the SELinux policy.

3.3. Solving Dependencies

Every RPM package has a header that contains all the vital information about that package. This information includes name, version and release, contents, the capabilities provided by the package, and any prerequisites. These prerequisites may include dependencies. A dependency is a requirement for one or more additional packages.

Packages installed without satisfying their dependencies may not work correctly. Dependencies may create a problem for users who are trying to install a single package. Manually determining and resolving dependencies is difficult. Fedora Core provides the yum utility for solving these dependencies automatically, providing an improved user experience.

The Yellow Dog Updater Modified, or yum, is a Python-based system for computing and solving RPM dependencies. A yum client retrieves a cache of headers from its repository server, as well as a list of available RPM packages and their exact locations on the server. It can do this via HTTP or FTP, as well as using standard file system calls (either local or remote via NFS). The client computes solutions to any package dependencies using the downloaded header information, and requests all necessary RPM packages once it has finished. The yum command relies on rpm functions to perform many of the computations involved in the process.

A drawback to yum is that the first time it is run, it must download a header for every package installed on the system in order to determine available updates. However, running a local mirror nullifies this drawback. The yum command can download many megabytes of headers almost instantly on a standard Ethernet LAN. The yum utility is the most popular update method for Fedora Core.

For more information about using yum, refer to http://fedora.redhat.com/docs/yum/.

3.4. Configuring Repositories

A yum repository is a collection of packages on a server which supports yum clients. Repositories can serve both types of clients if desired.

To set up a yum repository, you must write a directory that contains information which the clients require to resolve RPM dependencies. The directory's name depends on the version of yum it supports. It is permissible to have both kinds of repository information in a single repository.

To support older yum clients, use the yum-arch command. To support current yum clients, use the createrepo command.

[Important]Supporting Fedora Core 3 and beyond

Fedora Core 3 ships with a newer version of yum. To support Fedora Core 3 yum clients, you must use createrepo on your server's repositories.

3.4.1. yum-arch

The yum-arch command creates a directory named headers/ which supports older versions of yum (before 2.2). The yum-arch program searches recursively through a target directory and any subdirectories for RPM packages, and includes them in the header data. The yum-arch command always creates the headers/ directory in the current working directory. Therefore you should change your working directory to the directory where you want headers/ to appear.

cd /var/www/mirror/fedora/linux/core/5/i386/os
su -c 'yum-arch -ls .'

Enter the root password at the prompt. The -l switch follows symbolic links. The -s switch includes SRPMS (source RPM packages) in the header list. The command above creates the yum header cache in the directory /var/www/mirror/fedora/linux/core/5/i386/os/headers/.

3.4.2. createrepo

The createrepo command creates repository information to support newer versions of yum (and possibly other repository client programs). The createrepo command stores this data in a folder named repodata. Run createrepo against the directory under which you want the repodata directory to appear. The createrepo program also searches recursively for RPM packages to include in the repository data.

The following command creates the repository data in the directory /var/www/mirror/fedora/linux/core/5/i386/os/repodata.

su -c 'createrepo /var/www/mirror/fedora/linux/core/5/i386/os'

To create repository data for package groups in addition to the package files, use the createrepo -g command. The -g option requires a parameter which points to the group file, relative to the given location of the package data. The following command creates the package group data corresponding to the repository directly above. Note the relative location of the group file /var/www/mirror/fedora/linux/core/5i386/os/Fedora/base/comps.xml.

su -c 'createrepo -g Fedora/base/comps.xml /var/www/mirror/fedora/linux/core/5/i386/os'

You may have certain clients who update their version of yum in a non-prescribed way. To minimize problems for your clients, create both kinds of repository data for any repositories. The extra repository information is relatively small and will not affect your mirror's proper function.

3.4.3. Repository Locations

Typically you will run yum-arch or createrepo against at least the following locations:

  • The stock distribution; for example, /var/www/mirror/fedora/linux/core/5/i386/os/. For yum-arch, use the -l and -s options to follow the linked directory SRPMS and include the source packages therein.

  • Official updates to the distribution; for example, /var/www/mirror/fedora/linux/core/updates/5/. Once again, for yum-arch use -l and/or -s if appropriate.

displayFooter('$Date: 2006/08/15 03:19:37 $'); ?>