6.2. Importing with RHN Satellite Synchronization Tool

Before distributing packages via RHN Satellite Server, the packages must first be uploaded to the Satellite. This section describes the process for importing packages and other channel data.

ImportantImportant
 

To populate custom channels correctly, you must first populate at least one Red Hat base channel. The RHN Satellite Synchronization Tool creates the necessary directory structures and permissions; without these, the custom channel tools will not work properly. For this reason, you should use these instructions to set up your base channel(s) and then refer to the RHN Channel Management Guide for steps to establish custom channels.

6.2.1. satellite-sync

The RHN Satellite Synchronization Tool enables an RHN Satellite Server to update its database metadata and RPM packages with those of RHN's central servers, another Satellite within your organization, or local media. To launch it, execute the following command as root:

satellite-sync

This tool can be used in a a closed environment, such as the one created with a disconnected install, or it may obtain data directly over the Internet. Closed environment imports can get their data from downloaded ISOs or from the XML data generated by RHN Satellite Exporter.

The RHN Satellite Synchronization Tool works incrementally, or in steps. For it to obtain Errata information, it must first know the packages contained. For the packages to be updated, the tool must first identify the associated channel(s). For this reason, the RHN Satellite Synchronization Tool performs its actions in the following order:

  1. channel-families — Import/synchronize channel family (architecture) data.

  2. channels — Import/synchronize channel data.

  3. rpms — Import/synchronize RPMs.

  4. packages — Import/synchronize full package data for those RPMs retrieved successfully.

  5. errata — Import/synchronize Errata information.

Each of these steps can be initiated individually for testing purposes with the effect of forcing the tool to stop when that step is complete. All steps that precede it, however, will have taken place. Therefore, calling the rpms step will automatically ensure the channels and channel-families steps take place first. To initiate an individual step, use the --step option, like so:

satellite-sync --step=rpms

In addition to --step, the RHN Satellite Synchronization Tool offers many other command line options. To use them, insert the option and the appropriate value after the satellite-sync command when launching import/synchronization.

OptionDescription
-h, --helpDisplay this list of options and exit.
-d=, --db=DBInclude alternate database connect string: username/password@SID.
-m=, --mount-point=MOUNT_POINT Import/sync from local media mounted to the Satellite. To be used in closed environments (such as those created during disconnected installs).
--list-channelsList all available channels and exit.
-c=, --channel=CHANNEL_LABEL Process data for this channel only. Multiple channels can be included by repeating the option. If no channels are specified, all channels on the Satellite will be freshened.
-p, --print-configurationPrint the current configuration and exit.
--no-sslNot Advisable - Turn off SSL.
--step=STEP_NAMEPerform the sync process only to the step specified. Typically used in testing.
--no-rpmsDo not retrieve actual RPMs.
--no-packagesDo not process full package data.
--no-errataDo not process Errata information.
--no-kickstartsDo not process kickstart data (provisioning only).
--force-all-packagesForcibly process all package data without conducting a diff.
--debug-level=LEVEL_NUMBER Override the amount of messaging sent to log files and generated on the screen set in /etc/rhn/rhn.conf, 0-6 (2 is default).
--emailEmail a report of what was imported/synchronized to the designated recipient of traceback email.
--traceback-mail=TRACEBACK_MAIL Direct sync output (from --email) to this email address.
-s=, --server=SERVER Include the hostname of an alternative server to connect to for synchronization.
--http-proxy=HTTP_PROXY Add an alternative HTTP proxy server in the form hostname:port.
--http-proxy-username=PROXY_USERNAME Include the username for the alternative HTTP proxy server.
--http-proxy-password=PROXY_PASSWORD Include the password for the alternative HTTP proxy server.
--ca-cert=CA_CERTUse an alternative SSL CA certificate by including the full path and filename.
--systemid=SYSTEM_IDFor debugging only - Include path to alternative digital system ID.
--systemid=SYSTEM_IDFor debugging only - Include path to alternative digital system ID.
--batch-size=BATCH_SIZE For debugging only - Set maximum batch size in percent for XML/database-import processing. Open man satellite-sync for more information.

Table 6-2. Satellite Import/Sync Options

If no options are included, satellite-sync synchronizes all channels that already exist in the Satellite's database. By default, the --step (all steps) option is enabled.

Keep in mind that the --channel option requires the channel label, not its name. For instance, use "rhel-i386-as-3" not "Red Hat Enterprise Linux 3 i386." Use the --list-channels option to obtain a list of all channels by label. All displayed channels are available for importing and synchronizing.

6.2.2. Preparing for Import from Local Media

To perform the RHN Satellite Server import, the following prerequisites must be met:

Although it is possible to conduct the import directly from the RHN website, this should be done only if Channel Content ISOs are not available. It takes a long time to populate a channel from scratch over the Internet. For this reason, Red Hat urges you to use ISOs, if they are available, for initial import.

6.2.2.1. Preparing Channel Content ISOs

Channel Content ISOs are special collections that contain both packages and XML dumps of metadata. The ISO images can be downloaded from the RHN website on a machine connected to the Internet and then transferred to the Satellite. After logging in, click Channels in the top navigation bar and then the name of the channel for your version of RHN Satellite Server. Click the Downloads tab and use the instructions on the page to obtain the Channel Content ISOs, available by version of Red Hat Enterprise Linux. If the desired Channel Content ISOs do not appear, ensure your RHN Entitlement Certificate has been uploaded to RHN and correctly identifies the target channels.

Channel Content ISOs are mounted and then copied to a temporary repository directory. Before mounting the ISOs, ensure the temporary repository has enough disk space to copy all the contents into a single directory. For a single channel, the approximate required space is 3 GB. The process to copy Channel Content ISOs is to mount each one, copy its contents to the temporary repository, and then unmount the ISO. Each channel consists of several ISOs. Once finished, the administrator should delete the temporary directory and all of its contents. Follow these steps:

  1. Log into the machine as root.

  2. Insert the first Channel Content ISO that has been burned to disc.

  3. Create a directory in /mnt/ to store the file(s) with the command:

    mkdir /mnt/import/
  4. Mount the ISO file from within the directory containing it using the command:

    mount iso_filename /mnt/import -o loop
  5. Create a target directory for the files, such as:

    mkdir /var/rhn-sat-import/
  6. This sample command assumes the administrator wants to copy the contents of the ISO (mounted in /mnt/import/) into /var/rhn-sat-import/:

    cp -ruv /mnt/import/* /var/rhn-sat-import/
  7. Then unmount /mnt/import in preparation for the next CD or ISO:

    umount /mnt/import
  8. Repeat these steps for each Channel Content ISO of every channel to be imported.

6.2.2.2. Preparing RHN Satellite Exporter Data

In order to perform the import from data previously exported using RHN Satellite Exporter, you must first copy that data onto the local system. Steps such as the following will enable you to procede to running the import as described in Section 6.2.3 Running the Import.

  1. Log into the machine as root.

  2. Create a target directory for the files, such as:

    mkdir /var/rhn-sat-import/
  3. Make the export data available on the local machine in the directory created in the previous step. This can be done by copying the data directly, or by mounting the data from another machine using NFS. It is perhaps easiest to copy the data into the new directory with a command such as the following:

    scp -r [email protected]:/var/sat-backup/* /var/rhn-sat-import

Now that the data is available, you can procede to performing the import.

6.2.3. Running the Import

The rhns-satellite-tools package provides the satellite-sync program for managing all package, channel, and errata imports and synchronizations.

The following process assumes in the previous step the user has copied all data to /var/rhn-sat-import.

The first step in importing channels into the database is listing the channels available for import. This is accomplished with the command:

satellite-sync --list-channels --mount-point /var/rhn-sat-import

The next step is to initiate the import of a specific channel. Do this using a channel label presented in the previous list. The command will look like:

satellite-sync -c rhel-i386-as-3 --mount-point /var/rhn-sat-import

NoteNote
 

Importing package data can take up to two hours per channel. You may begin registering systems to channels as soon as they appear in the RHN Satellite Server's website. No packages are necessary for registration, although updates cannot be retrieved from the Satellite until the channel is completely populated.

You may repeat this step for each channel or include them all within a single command by passing each channel label preceded by an additional -c flag, like so:

s
atellite-sync -c channel-label-1 \
              -c channel-label-2 \
--mount-point /var/rhn-sat-import

This conducts the following tasks in this order:

  1. Populating the tables describing common features for channels (channel families). This can also be accomplished individually by passing the --step=channel-families option to satellite-sync.

  2. Creating a particular channel in the database and importing the metadata describing the channel. Individually, use the --step=channels option.

  3. Moving the RPM packages from the temporary repository into their final location. Individually, use the --step=rpms option.

  4. Parsing the header metadata for each package in the channel, uploading the package data, and associating it with the channel. Individually, use the --step=packages option.

  5. Identifying Errata associated with the packages and including them in the repository. Individually, use the --step=errata option.

After running the preceding sample command, the population of the channel should be complete. All of the packages should have been moved out of the repository; this can be verified with the command cd /var/rhn-sat-import/; ls -alR | grep rpm. If all RPMs have been installed and moved to their permanent locations, then this count will be zero, and the administrator may safely remove the temporary repository (in this case, /var/rhn-sat-import/).