8 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 Creating a Local Yum Repository Using an ISO Image.

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

    sudo 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:

      sudo /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.

      sudo /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:

    sudo 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.

    sudo systemctl start httpd
    sudo systemctl enable httpd
  7. If you have enabled a firewall on your system, configure it to allow incoming HTTP connection requests on TCP port 80, for example:

    sudo firewall-cmd --zone=zone --add-port=80/tcp
    sudo firewall-cmd --permanent --zone=zone --add-port=80/tcp
  8. Disable all existing yum repositories on the server and each client system.

    In the /etc/yum.repos.d directory, edit any existing repository files and disable all entries by setting enabled=0. If you have the yum-utils package installed, as described in Using Yum Utilities to Manage Configuration, you can disable all repositories by running:

    sudo yum-config-manager --disable \*                  
  9. Edit the repository file on the server (for example, /etc/yum.repos.d/OL75.repo):

    [OL75]
    name=Oracle Linux 7.5 x86_64
    baseurl=http://server_addr/OSimage/OL7.5_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.

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

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

    sudo yum repolist
    Loaded plugins: refresh-packagekit, security
    ...
    repo id                          repo name                                status
    OL75                             Oracle Linux 7.5 x86_64                  5,070
    repolist: 5,070