Chapter 10. Create and Synchronize a Red Hat Repository

10.1. Create a Repository

  1. On the Red Hat Update Appliance (RHUA), log in to the Red Hat Update Infrastructure Management Tool.

    [root@rhua ~]# rhui-manager
  2. In the Red Hat Update Infrastructure Management Tool home screen, press r to select manage repositories.

    -= Red Hat Update Infrastructure Management Tool =-
    
    -= Home =-
    
    r   manage repositories
    c   manage content delivery servers (CDS)
    l   manage HAProxy load-balancer instances
    s   synchronization status and scheduling
    e   create entitlement certificates and client configuration RPMs
    n   manage Red Hat entitlement certificates
    u   manage RHUI users
    
                                          Connected: rhua.example.com
    ---------------
  3. Press a to select add a new Red Hat content repository.

    ----------------------------------------------------------------------------------
            	-= Red Hat Update Infrastructure Management Tool =-
    
    = Repository Management =-
    
    l   list repositories currently managed by the RHUI
    i   display detailed information on a repository
    a   add a new Red Hat content repository
    c   create a new custom repository (RPM content only)
    d   delete a repository from the RHUI
    u   upload content to a custom repository (RPM content only)
    p   list packages in a repository (RPM content only)
    
                                                  	Connected: rhua.example.com
    ------------------------------------------------------------------------------
    
    rhui (repo) => a
  4. Wait for the Red Hat Update Infrastructure Management Tool to determine the entitled repositories. This might take several minutes.

                                                 	Connected: rhua.example.com
    
    ------------------------------------------------------------------------------
    
    rhui (repo) => a
    
    Loading latest entitled products from Red Hat...
    
    Determining undeployed products...
  5. The Red Hat Update Infrastructure Management Tool prompts for a selection method.

    ... product list calculated
    
    Import Repositories:
    
    1  - All in Certificate
    2  - By Product
    3  - By Repository
    
    Enter value (1-3) or 'b' to abort:
  6. Press 2 to select the By Product method.
  7. Add Red Hat repositories to the RHUA by entering the number beside each repository that you want to include. The only repositories that will display are Red Hat repositories that are included in your entitlement certificate but have not yet been added.
  8. Press c when your are finished selecting the repositories. The Red Hat Update Infrastructure Management Tool displays the repositories to be deployed and prompts for confirmation.
  9. Press y to proceed. A screen message indicates each successful deployment.
  10. Check that the correct repositories have been installed by pressing l to access the list repositories currently managed by the RHUI screen.

10.2. Synchronize a Repository

The initial synchronization of Red Hat content can take a while, typically 10 to 20 minutes. Begin synchronizing as soon as possible.

  1. Navigate to the Red Hat Update Infrastructure Management Tool home screen.

    [root@rhua ~]# rhui-manager
  2. Press s to select synchronization status and scheduling.

    -= Red Hat Update Infrastructure Management Tool =-
    
    -= Home =-
    
    r   manage repositories
    c   manage content delivery servers (CDS)
    l   manage HAProxy load-balancer instances
    s   synchronization status and scheduling
    e   create entitlement certificates and client configuration RPMs
    n   manage Red Hat entitlement certificates
    u   manage RHUI users
    
                                          Connected: rhua.example.com
    ---------------
  3. Press sr to select sync an individual repository immediately.

    ------------------------------------------------------------------------------
            	-= Red Hat Update Infrastructure Management Tool =-
    
    -= Synchronization Status =-
    
    dr  display repo sync summary
    vr  view the details of the last repository sync
    sr  sync an individual repository immediately
    
                                                  	Connected: rhua.example.com
    
    ------------------------------------------------------------------------------
  4. Select the repository and press c to confirm.
  5. Press y to proceed.
  6. Enter dr to select display repo sync summary.

    ------------------------------------------------------------------------------
    
    rhui (sync) => dr
    ------------------------------------------------------------------------------
            	-= Red Hat Update Infrastructure Management Tool =-
    
    -= Repository Synchronization Status =-
    
    Last Refreshed: 13:59:27
    
    (updated every 5 seconds, ctrl+c to exit)
    
    Next Sync                	Last Sync                	Last Result
    
    ------------------------------------------------------------------------------
    
    Red Hat Enterprise Linux 7 Server - Extras from RHUI (RPMs) (x86_64)
    
    02-29-2016 19:54         	02-29-2016 13:59         	Success
    
                                                  	Connected: rhua.example.com
    ------------------------------------------------------------------------------

10.3. Check Repository Synchronization

  1. Run the following command to check whether a repository is being synchronized.

    [root@rhua ~]# rhui-manager status
  2. If you see a running job, as shown below, do not reboot. Wait until the result is something other than Running.

    [root@rhua ~]# rhui-manager status
    Red Hat Enterprise Linux High Availability (for RHEL 6 Server) (RPMs) from RHUI (6Server-x86_64)  Success
    
    Red Hat Enterprise Linux High Availability (for RHEL 7 Server) (RPMs) from RHUI (7Server-x86_64)  Running
  3. If you must reboot, or if the system was rebooted for a reason beyond your control, check the output of rhui-manager status when the system is up. You can also check the Pulp task list with the following command.

    [root@rhua ~]# pulp-admin -u admin -p admin tasks list
  4. Use the actual password of the admin user after the -p switch. If you see No tasks found, then the synchronization process was safely interrupted. You can now synchronize the repository manually in rhui-manager, or you can wait for the next available time slot, during which the repository will synchronize automatically.
  5. Run rhui-manager status or the aforementioned pulp-admin command at any time to determine the status of the repository.

    Sometimes an attempt to synchronize a repository whose synchronization was interrupted can fail. The state is Running, and there is also a running Pulp task, but nothing is being transferred. If the status has been Running for an excessive amount of time, check whether there is an issue by examining the repository synchronization status.

  6. Find out the name of the repository in the Pulp task list. For example,

    [root@rhua ~]# pulp-admin -u admin -p admin tasks list
    +----------------------------------------------------------------------+
                                     Tasks
    +----------------------------------------------------------------------+
    
    Operations:  sync
    Resources:   rhel-x86_64-6-rhui-2-rpms-6Server-x86_64 (repository)
    State:       Running
    Start Time:  2017-05-24T08:16:48Z
    Finish Time: Incomplete
    Task Id:     6e44a32d-2e11-41f2-bbe6-996531c5cda0
    
    Operations:  publish
    Resources:   rhel-x86_64-6-rhui-2-rpms-6Server-x86_64 (repository)
    State:       Waiting
    Start Time:  Unstarted
    Finish Time: Incomplete
    Task Id:     13f5d531-2f0d-4a73-9d27-b4fd126b6f13
  7. Check the synchronization status. If you see the following output, there is a problem.

    [root@rhua ~]# pulp-admin -u admin -p admin rpm repo sync status --repo-id rhel-x86_64-6-rhui-2-rpms-6Server-x86_64
    +----------------------------------------------------------------------+
          Repository Status [rhel-x86_64-6-rhui-2-rpms-6Server-x86_64]
    +----------------------------------------------------------------------+
    
    This command may be exited via ctrl+c without affecting the request.
    
    
    Downloading metadata...
    [-]
    ... completed
    
    Downloading repository content...
    [-]
    [==================================================] 100%
    RPMs:       0/0 items
    Delta RPMs: 0/0 items
    
    ... completed
    
    Downloading distribution files...
    [==================================================] 100%
    Distributions: 0/0 items
    ... completed
    
    Importing errata...
    [-]
    ... completed
    
    Importing package groups/categories...
    [-]
    ... completed
    
    Cleaning duplicate packages...
    [-]
    ... completed
  8. You have to cancel the open Pulp tasks and try synchronizing the affected repository again to resolve the problem and ensure that the repository is available on the RHUA. Use pulp-admin again as follows to view the task IDs.

    [root@rhua ~]# pulp-admin -u admin -p admin tasks list
    +----------------------------------------------------------------------+
                                     Tasks
    +----------------------------------------------------------------------+
    
    Operations:  sync
    Resources:   rhel-x86_64-6-rhui-2-rpms-6Server-x86_64 (repository)
    State:       Running
    Start Time:  2017-05-24T08:16:48Z
    Finish Time: Incomplete
    Task Id:     6e44a32d-2e11-41f2-bbe6-996531c5cda0
    
    Operations:  publish
    Resources:   rhel-x86_64-6-rhui-2-rpms-6Server-x86_64 (repository)
    State:       Waiting
    Start Time:  Unstarted
    Finish Time: Incomplete
    Task Id:     13f5d531-2f0d-4a73-9d27-b4fd126b6f13
  9. Cancel the tasks.

    [root@rhua ~]# pulp-admin -u admin -p admin tasks cancel --task-id 6e44a32d-2e11-41f2-bbe6-996531c5cda0
    Task cancel is successfully initiated.
    
    [root@rhua ~]# pulp-admin -u admin -p admin tasks cancel --task-id 13f5d531-2f0d-4a73-9d27-b4fd126b6f13
    Task cancel is successfully initiated.
  10. Run rhui-manager status and verify that the status is Canceled.
  11. Try synchronizing the repository again in rhui-manager. Use the same pulp-admin commands as earlier to monitor the progress. If you run into the same problem again, the repository is likely in an irreparable state and will have to be removed from RHUA and added again.
  12. View the Pulp task list to obtain the task IDs.
  13. Cancel the running and waiting tasks.
  14. Use rhui-manager to remove the repository.
  15. In edge cases, the repository cannot be removed because rhui-manager reports: "Task deletion is still occurring, any actions taken while this is not complete can result in errors." If that happens, restart the Pulp services.

    1. For RHEL 6:

      # service pulp_workers restart; service pulp_resource_manager restart; service pulp_celerybeat restart
    2. For RHEL 7:

      # systemctl restart pulp_workers; systemctl restart pulp_resource_manager; systemctl restart pulp_celerybeat
  16. Replace restart with status in the above commands to verify each service has restarted.
  17. Add the repository again in rhui-manager.
  18. Synchronize it immediately, or wait for the next automated synchronization.

Report a bug