5.2 Setting up a Local ULN Mirror

To set up a local system as a local ULN mirror:

  1. Enable the system as a Yum Server within ULN System Management. You can do this using the ULN web interface .

    This option disables system specific logic that is applied when a system attempts to subscribe to channels that do not apply to its architecture or platform version. For example, when a system is enabled as a Yum Server within ULN System Management, it is able to subscribe to channels for alternate architectures or operating system versions.

    Enable the Yum Server option using the ULN web interface

    1. Using a browser, log in at https://linux.oracle.com with the ULN user name and password that you used to register the system

    2. On the Systems tab, click the link named for your system in the list of registered machines.

    3. On the System Details page, click Edit.

    4. On the Edit System Properties page, select the Yum Server check box and click Apply Changes.

  2. Subscribe the system to the channels that you intend to mirror. You can do this either using the ULN web interface, or by using the uln-channel command.

    Note

    You must subscribe the system to the latest and addons channels for the installed operating system release (Oracle Linux 6 or Oracle Linux 7) and the relevant system architecture to be able to install the uln-yum-mirror package. This package contains the uln-yum-mirror script that enables the system to act as a local ULN mirror.

    If you subsequently update the list of channels to which the system is subscribed, the uln-yum-mirror script updates the channels that the system mirrors.

    If you have an Oracle Linux Premier Support account and you want the yum server to host Ksplice packages for local Ksplice Offline clients, subscribe to the Ksplice for Oracle Linux channels for the architectures and Oracle Linux releases that you want to support.

    For a complete and up-to-date list of the available release channels, log on to ULN at https://linux.oracle.com.

    To subscribe your system to the channels that you want to mirror, use the ULN web interface .

    Subscribe your system to channels using the ULN web interface

    1. Log in to https://linux.oracle.com with your ULN user name and password.

    2. On the Systems tab, click the link named for the system in the list of registered machines.

    3. On the System Details page, click Manage Subscriptions.

    4. On the System Summary page, select channels from the list of available or subscribed channels and click the arrows to move the channels between the lists.

    5. When you have finished selecting channels, click Save Subscriptions.

  3. Install the Apache HTTP server.

    # yum install httpd
  4. Create a base directory for the yum repositories, for example /var/yum or /var/www/html/yum.

    # mkdir -p /var/www/html/yum
    Note

    The yum repository owner must have read and write permissions on this directory.

  5. If you created a base directory for the yum repository that is not under /var/www/html and 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/yum(/.*)?"
    2. Use the restorecon command to apply the file type to the entire repository.

      # /sbin/restorecon -R -v /var/yum
  6. If you created a base directory for the yum repository that is not under /var/www/html, create a symbolic link in /var/www/html that points to the repository, for example:

    # ln -s /var/yum /var/www/html/yum
  7. 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.

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

    • On Oracle Linux 6, type the following commands:

      # service httpd start
      # chkconfig httpd on
    • On Oracle Linux 7, enter the following commands:

      # systemctl start httpd
      # systemctl enable httpd
  9. If you enabled a firewall on your system, configure it to allow incoming HTTP connection requests on TCP port 80.

    • On Oracle Linux 6, type the following commands:

      # iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
      # service iptables save
    • On Oracle Linux 7, type the following commands:

      # firewall-cmd --add-service=http
      # firewall-cmd --permanent --add-service=http
  10. Install the uln-yum-mirror package:

    # yum install uln-yum-mirror

    This package contains the uln-yum-mirror script that enables the system to act as a local ULN mirror.

    Note

    If you have not subscribed the system to the correct Oracle Linux latest and addons channels for your system, the command fails with the following error:

    No package uln-yum-mirror available
  11. To configure the operation of the /usr/bin/uln-yum-mirror script, edit the /etc/sysconfig/uln-yum-mirror file.

    For example, if the base directory for the yum repositories is not /var/www/html/yum, set the value of the REP_BASE parameter to the correct base directory:

    REP_BASE=/var/yum

    Installing the uln-yum-mirror package also configures an anacron job (/etc/cron.daily/uln-yum-mirror) that updates the local yum repositories once every day. You can disable this job by setting the value of CRON_ENABLED to 0:

    CRON_ENABLED=0

    For more information about the configuration options in /etc/sysconfig/uln-yum-mirror file, see Section 5.3, “ULN Mirror Configuration” .

    The repositories are populated when the anacron job runs the /usr/bin/uln-yum-mirror script. Alternatively, you can run the script manually at any time to update the repositories. See Section 5.4, “Updating the Repositories on a Local ULN Mirror” .