2.10 Setting up a Local Yum Server Using an ISO Image

To set up a local yum server (for example, if you have a network of systems that do not have Internet access):

  1. Choose one of the systems to be the yum server, and create a local yum repository on it as described in Section 2.9, “Creating a Local Yum Repository Using an ISO Image”.

  2. Install the Apache HTTP server from the local yum repository.

    # yum install httpd
  3. If SELinux is enabled in enforcing mode on your system:

    1. Use the semanage command to define the default file type of the repository root directory hierarchy as httpd_sys_content_t:

      # /usr/sbin/semanage fcontext -a -t httpd_sys_content_t "/var/OSimage(/.*)?"

    2. Use the restorecon command to apply the file type to the entire repository.

      # /sbin/restorecon -R -v /var/OSimage
    Note

    The semanage and restorecon commands are provided by the policycoreutils-python and policycoreutils packages.

  4. Create a symbolic link in /var/www/html that points to the repository:

    # ln -s /var/OSimage /var/www/html/OSimage
  5. Edit the HTTP server configuration file, /etc/httpd/conf/httpd.conf, as follows:

    1. Specify the resolvable domain name of the server in the argument to ServerName.

      ServerName server_addr:80

      If the server does not have a resolvable domain name, enter its IP address instead.

    2. Verify that the setting of the Options directive in the <Directory "/var/www/html"> section specifies Indexes and FollowSymLinks to allow you to browse the directory hierarchy, for example:

      Options Indexes FollowSymLinks
    3. Save your changes to the file.

  6. Start the Apache HTTP server, and configure it to start after a reboot.

    # service httpd start
    # chkconfig httpd on
  7. If you have enabled a firewall on your system, configure it to allow incoming HTTP connection requests on TCP port 80.

    For example, the following command configures iptables to allow incoming HTTP connection requests and saves the change to the firewall configuration:

    # iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
    # service iptables save
  8. Edit the repository file on the server (for example, /etc/yum.repos.d/OL63.repo):

    [OL63]
    name=Oracle Linux 6.3 x86_64
    baseurl=http://server_addr/OSimage/OL6.3_x86_64
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY
    gpgcheck=1 
    enabled=1 

    Replace server_addr with the IP address or resolvable host name of the local yum server.

  9. On each client, copy the repository file from the server to the /etc/yum.repos.d directory.

  10. In the /etc/yum.repos.d directory, edit any other repository files, such as public-yum-ol6.repo or ULN-base.repo, and disable all entries by setting enabled=0.

  11. On the server and each client, test that you can use yum to access the repository.

    # yum repolist
    Loaded plugins: refresh-packagekit, security
    ...
    repo id                          repo name                                status
    OL63                             Oracle Linux 6.3 x86_64                  25,459
    repolist: 25,459