Applies to SUSE Linux Enterprise Desktop 12 SP2

3 Mirroring Repositories on the SMT Server

On the SMT server you can mirror the installation and update repositories locally. This allows you to bypass per-machine downloads and the bandwidth use that goes with it.

Important
Important: SUSE Linux Enterprise Server 9 Repositories

As SUSE Linux Enterprise Server 9 is no longer supported, SMT does not mirror SUSE Linux Enterprise Server 9 repositories.

3.1 Mirroring Credentials

Before you create a local mirror of the repositories, you need appropriate organization credentials. You can get the credentials from SUSE Customer Center.

To get the credentials from SUSE Customer Center, follow these steps:

  1. Visit SUSE Customer Center at http://scc.suse.com and log in.

  2. If you are member of multiple organizations, chose the organization you want to work with from the drop-down box on the top right.

  3. Click Organization in the top menu.

  4. Click the Organizational credentials tab.

  5. To show the password, click Show password.

The obtained credentials should be set with the YaST SMT Server Configuration module or manually written to the /etc/smt.conf file. For more information about the /etc/smt.conf file, see Section 7.2.1, “/etc/smt.conf”.

Tip
Tip: Merging Multiple Organization Site Credentials

SMT can only work with one mirror credential at a time; multiple credentials are not supported. If a customer creates a new company, it results in a new mirror credential. This is not convenient as some products are available via the first set and other products via the second set. To request a merge of credentials, the customer is advised to send an e-mail to <> (for EMEA-based customers only—Europe, the Middle East and Africa) with the applicable customer and site IDs. The EMEA PIC team will verify the records. The contact for NALAAP is <> (North America, Latin America, and Asia Pacific).

3.2 Managing Software Repositories with SMT Command Line Tools

This section describes tools and procedures for viewing information about software repositories available through SMT, configuring these repositories and setting up custom repositories on the command line. For details on the YaST SMT Server Management module, see Chapter 4, Managing Repositories with YaST SMT Server Management.

3.2.1 Updating the Local SMT Database

The local SMT database needs to be updated periodically with the information downloaded from SUSE Customer Center. These periodic updates can be configured with the SMT Management module, as described in Section 2.5, “Setting the SMT Job Schedule with YaST”.

To update the SMT database manually, use the smt-sync command. For more information about the smt-sync command, see Section 7.1.2.7, “smt-sync”.

3.2.2 Enabled Repositories and Repositories That Can Be Mirrored

The database installed with SMT contains information about all software repositories available on SUSE Customer Center. However, the used mirror credentials determine which repositories can really be mirrored. For more information about getting and setting organization credentials, see Section 3.1, “Mirroring Credentials”.

Repositories that can be mirrored have the MIRRORABLE flag set in the repositories table in the SMT database. The fact that a repository can be mirrored does not mean that it needs to be mirrored. Only repositories with the DOMIRROR flag set in the SMT database will be mirrored. For more information about configuring which repositories should be mirrored, see Section 3.2.4, “Selecting Repositories to Be Mirrored”.

3.2.3 Getting Information about Repositories

Use the smt-repos command to list available software repositories and additional information. Using this command without any options lists all available repositories, including repositories that cannot be mirrored. In the first column, the enabled repositories (repositories set to be mirrored) are marked with Yes. Disabled repositories are marked with No. The other columns show ID, type, name, target, and description of the listed repositories. The last columns show whether the repository can be mirrored and staging is enabled.

Use the --verbose option, to get additional information about the URL of the repository and the path it will be mirrored to.

The repository listing can be limited to only repositories that can be mirrored or to enabled repositories. To list only repositories that can be mirrored, use the -m or --only-mirrorable option: smt-repos -m.

To list only enabled repositories, use the -o or --only-enabled option: smt-repos -o (see Example 3.1, “Listing All Enabled Repositories”).

Example 3.1: Listing All Enabled Repositories
tux:~ # smt-repos -o
.---------------------------------------------------------------------------------------------------------------------.
| Mirr| ID | Type | Name                    | Target        | Description                             | Can be M| Stag|
+-----+----+------+-------------------------+---------------+-----------------------------------------+---------+-----+
| Yes |  1 | zypp | ATI-Driver-SLE11-SP2    | --            | ATI-Driver-SLE11-SP2                    | Yes     | Yes |
| Yes |  2 | zypp | nVidia-Driver-SLE11-SP2 | --            | nVidia-Driver-SLE11-SP2                 | Yes     | No  |
| Yes |  3 | nu   | SLED11-SP2-Updates      | sle-11-x86_64 | SLED11-SP2-Updates for sle-11-x86_64    | Yes     | No  |
| Yes |  4 | nu   | SLES11-SP1-Updates      | sle-11-x86_64 | SLES11-SP1-Updates for sle-11-x86_64    | Yes     | Yes |
| Yes |  5 | nu   | SLES11-SP2-Core         | sle-11-x86_64 | SLES11-SP2-Core for sle-11-x86_64       | Yes     | No  |
| Yes |  6 | nu   | SLES11-SP2-Updates      | sle-11-i586   | SLES11-SP2-Updates for sle-11-i586      | Yes     | No  |
| Yes |  7 | nu   | WebYaST-Testing-Updates | sle-11-i586   | WebYaST-Testing-Updates for sle-11-i586 | Yes     | No  |
'-----+----+------+-------------------------+---------------+-----------------------------------------+---------+-----'

You can also list only repositories with a particular name or show information about a repository with a particular name and target. To list repositories with a particular name, use the smt-repos repository_name command. To show information about a repository with a particular name and target, use the smt-repos repository_name target command.

To get a list of installation repositories from remote, see Section 8.7, “Listing Accessible Repositories”.

3.2.4 Selecting Repositories to Be Mirrored

Only enabled repositories can be mirrored. In the database, the enabled repositories have the DOMIRROR flag set. Repositories can be enabled or disabled using the smt-repos command.

To enable one or more repositories, follow these steps:

  1. If you want to enable all repositories that can be mirrored or just choose one repository from the list of all repositories, run the smt-repos -e command.

    You can limit the list of repositories by using the relevant options. To limit the list to only repositories that can be mirrored, use the -m option: smt-repos -m -e. To limit the list to only repositories with a particular name, use the smt-repos -e repository_name command. To list only a repository with a particular name and target, use the command smt-repos -e repository_name target.

    If you want to enable all repositories belonging to a certain product, use the --enable-by-prod or -p option followed by the name of the product and, optionally, its version, architecture, and release:

    smt-repos -p product[,version[,architecture[,release]]]

    For example, to enable all repositories belonging to SUSE Linux Enterprise Server 10 SP3 for PowerPC architecture, use the smt-repos -p SUSE-Linux-Enterprise-Server-SP3,10,ppc command. The list of known products can be obtained with the smt-list-products command.

  2. If more than one repository is listed, choose the one you want to enable by specifying its ID listed in the repository table and pressing Enter. If you want to enable all the listed repositories, use a and press Enter.

To disable one or more repositories, follow these steps:

  1. If you want to disable all enabled repositories or just choose one repository from the list of all repositories, run the smt-repos -d command.

    If you want to choose the repository to be disabled from a shorter list, or if you want to disable all repositories from a limited group, you can use any of the available options to limit the list of repositories. To limit the list to only enabled repositories, use the -o option: smt-repos -o -d. To limit the list to only repositories with a particular name, use the smt-repos -d repository_name command. To list only a repository with a particular name and target, use the smt-repos -d repository_name target command.

  2. If more than one repository is listed, choose which one you want to disable by specifying its ID listed in the repository table shown and pressing Enter. If you want to disable all the listed repositories, use a and press Enter.

3.2.5 Deleting Mirrored Repositories

You can delete mirrored repositories that are no longer used. If you delete a repository, it will be physically removed from the SMT storage area.

To delete a repository with a particular name, use the smt-repos --delete command. To delete the repository in a namespace, specify the --namespace dirname option.

--delete lists all repositories, and by entering the ID number or by entering the name and target you can delete the specified repositories. If you want to delete all repositories, enter a.

Note
Note: Detecting Repository IDs

Every repository has a sha1sum that you can use as an ID. You can get the repository's sha1sum by calling smt-repos -v.

3.2.6 Mirroring Custom Repositories

Using SMT you can also mirror repositories that are not available at the SUSE Customer Center. Those repositories are called custom repositories. Use the smt-setup-custom-repos command for this purpose. Custom repositories can also be deleted.

When adding a new custom repository, smt-setup-custom-repos adds a new record in the database, and sets the mirror flag to true by default. If needed, you can disable mirroring later.

To set up a custom repository to be available through SMT, follow these steps:

  1. If you do not know the ID of the product the new repositories should belong to, use smt-list-products to get the ID. For the description of the smt-list-products, see Section 7.1.2.4, “smt-list-products”.

  2. Run

    smt-setup-custom-repos --productid product_id \
    --name repository_name --exturl repository_url

    In this command product_id is the ID of the product the repository belongs to, repository_name represents the name of the repository and repository_url is the URL the repository is available at. In case the added repository needs to be available for more than one product, specify the IDs of all products that should use the added repository.

    For example, to set My repository available at http://example.com/My_repository to the products with the IDs 423, 424, and 425, use the following command:

    smt-setup-custom-repositories --productid 423 --productid 424 \
    --productid 425 --name 'My_repository' \
    --exturl 'http://example.com/My_repository'
Note
Note: Mirroring Unsigned Repositories

In its default configuration, SUSE Linux Enterprise 10 does not allow the use of unsigned repositories. Therefore, if you want to mirror unsigned repositories and use them on client machines, be aware that the package installation tool—YaST or zypper—will ask you whether to use repositories that are not signed.

To remove an already-set custom repository from the SMT database, use smt-setup-custom-repositories --delete ID, where ID represents the ID of the repository to be removed.

3.3 The /srv/www/htdocs Structure for SLE 11

The path to the directory containing the mirror is set by the MirrorTo option in the /etc/smt.conf configuration file. For more information about /etc/smt.conf, see Section 7.2.1, “/etc/smt.conf”. If the MirrorTo option is not set to the Apache htdocs directory /srv/www/htdocs/, the following links need to be created. In case the directories already exist, they need to be removed prior to creating the link (the data from those directories will be lost!):

  • /srv/www/htdocs/repo/$RCE should point to /MirrorTo/repo/$RCE/

  • /srv/www/htdocs/repo/RPMMD to /MirrorTo/repo/RPMMD/

  • /srv/www/htdocs/repo/testing to /MirrorTo/repo/testing/ and

  • /srv/www/htdocs/repo/full to /MirrorTo/repo/full/

The directory specified by the option MirrorTo and the subdirectories listed above must exist. Files, directories and links in /MirrorTo need to belong to the user smt and the group www.

For example, if the MirrorTo is set to /mirror/data:

l /srv/www/htdocs/repo/
total 16
lrwxrwxrwx 1 smt  www    22 Feb  9 14:23 $RCE -> /mirror/data/repo/$RCE/
drwxr-xr-x 4 smt  www  4096 Feb  9 14:23 ./
drwxr-xr-x 4 root root 4096 Feb  8 15:44 ../
lrwxrwxrwx 1 smt  www    23 Feb  9 14:23 RPMMD -> /mirror/data/repo/RPMMD/
lrwxrwxrwx 1 smt  www    22 Feb  9 14:23 full -> /mirror/data/repo/full/
drwxr-xr-x 2 smt  www  4096 Feb  8 11:12 keys/
lrwxrwxrwx 1 smt  www    25 Feb  9 14:23 testing -> /mirror/data/repo/testing/
drwxr-xr-x 2 smt  www  4096 Feb  8 14:14 tools/

The links can be created using the ln -s commands. For example:

for LINK in \$RCE RPMMD full testing; do
ln -s /mirror/data/repo/${LINK}/ && chown -h smt.www ${LINK}
done
Note
Note: The /srv/www/htdocs/repo Directory

The /srv/www/htdocs/repo directory must not be a symbolic link.

3.4 The /srv/www/htdocs Structure for SLE 12

The repository structure in the /srv/www/htdocs directory matches the structure as it comes from SUSE Customer Center. There are the following directories in the structure (selected examples, similar for other products and architectures):

repo/SUSE/Products/SLE-SDK/12/x86_64/product/

contains the -POOL repository of SDK (the GA version of all packages).

repo/SUSE/Products/SLE-SDK/12/x86_64/product.license/

contains EULA associated with the product.

repo/SUSE/Updates/SLE-SDK/12/x86_64/update/
repo/SUSE/Updates/SLE-SDK/12/s390x/update/
repo/SUSE/Updates/SLE-SERVER/12/x86_64/update/

contain update repositories for respective products.

repo/full/SUSE/Updates/SLE-SERVER/12/x86_64/update/
repo/testing/SUSE/Updates/SLE-SERVER/12/x86_64/update/

contain repositories optionally created for staging of respective repositories.

3.5 Using the Test Environment

You can mirror repositories to a test environment instead of the production environment. The test environment can be used with a limited number of client machines before the tested repositories are moved to the production environment. The test environment can be run on the main SMT server.

The testing environment uses the same structure as the production environment, but it is located in the /srv/www/htdocs/repos/testing/ subdirectory.

To mirror a repository to the testing environment, you can use the Staging tab in the YaST SMT Management module, or the command smt-staging.

To register a client in the testing environment, modify /etc/SUSEConnect on the client machine by setting:

namespace: testing

To move the testing environment to the production environment, manually copy or move it using the cp -a or mv command.

You can enable staging for a repository in the Repositories tab of the SMT Management module or with the smt-repos command. The mirroring happens automatically to repo/full/.

If you have an SLE11-based update repository with patches, SMT tools can help you with the management. With these tools you can select patches and create a snapshot and copy it into repo/testing/. After tests are finished you can copy the contents of repo/testing into the production area /repo.

SLE10-based update repositories are not supported by SMT tools. Not all of these repositories support selective staging. In this case you must mirror the complete package.

Recommended work flow:

repo => repo/full,
repo/full => repo/testing,
repo/testing => repo

3.6 Testing and Filtering Update Repositories with Staging

You can test repositories on any clients with smt-staging before moving them to the production environment. You can select new update repositories manually to be installed on clients.

For staging, you can either use the smt-staging command, or use the YaST SMT Management module. For more details, see Section 4.3, “Staging Repositories”.

SMT Staging Schema
Figure 3.1: SMT Staging Schema

Repositories with staging enabled are mirrored to the /MirrorTo/repo/full subdirectory. This subdirectory is usually not used by your clients. Incoming new updates are not automatically visible to the clients before you get a chance to test them. Later you can generate a testing environment of this repository, which goes to /MirrorTo/repo directory.

If you have an SLE 11-based update repository with patches, SMT tools can help you with the management. With these tools you can select patches and create a snapshot and put it into repo/testing/. After tests are finished you can put the content of repo/testing into the production area /repo. repo/testing/ and /repo is called the default staging group. You can create additional staging groups as needed with the smt-staging creategroup command.

Note
Note: SLE 10-based Update Repositories

SLE 10-based update repositories are not supported by SMT tools. Not all of these repositories support selective staging. In this case you need to mirror the complete package.

Enabling Staging

To enable or disable staging, use the smt-repos command with --enable-staging or -s:

smt-repos --enable-staging

You can enable the required repositories by entering the ID number or by entering the name and target. If you want to enable all repositories enter a.

Generating Testing and Production Snapshots

To create the testing repository in the default staging group enter:

smt-staging createrepo Repository_ID -–testing

Now you can test the installation and functionality of the patches in testing clients. If no problems are discovered during testing, create the production repository by entering:

smt-staging createrepo Repository_ID --production

To create testing and production repositories in a named staging group first create the group and then the repositories in this group:

smt-staging creategroup Groupname Testingdir Productiondir
smt-staging createrepo --group Groupname Repository_ID -–testing
smt-staging createrepo --group Groupname Repository_ID -–production

This can help you if you, for example, want to combine SLES11-SP1-Updates and SLES11-SP2-Updates of the sle-11-x86_64 architecture into one repository of a group:

smt-staging creategroup SLES11SP1-SP2-Up test-sp1-sp2 prod-sp1-sp2
smt-staging createrepo --group SLES11SP1-SP2-Up \
  SLES11-SP1-Updates sle-11-x86_64 --testing
smt-staging createrepo --group SLES11SP1-SP2-Up \
  SLES11-SP2-Updates sle-11-x86_64 --testing
smt-staging createrepo --group SLES11SP1-SP2-Up \
  SLES11-SP1-Updates sle-11-x86_64 --production
smt-staging createrepo --group SLES11SP1-SP2-Up \
  SLES11-SP2-Updates sle-11-x86_64 --production

For group names, these characters are allowed: -_, a-zA-Z, and 0-9.

Filtering Patches

You can allow or forbid all or selected patches with the allow or forbid commands by their ID or Category:

smt-staging forbid --patch ID
smt-staging forbid --category Categoryname
Signing Changed Repositories

If you filter one or more patches from a repository, the original signature becomes invalid. The repository needs to be signed again. The smt-staging createrepo command takes care of that automatically if you configure the SMT server.

To enable signing of changed metadata, the admin needs to generate a new signing key. This can be done with GPG like this:

mkdir some_dir
gpg --gen-key --homedir some_dir
sudo mv some_dir /var/lib/smt/.gnupg
sudo chown smt:users -R /var/lib/smt/.gnupg
sudo chmod go-rwx -R /var/lib/smt/.gnupg

Then the ID of the newly generated key, as seen in the gpg --gen-key command output, must be written into /etc/smt.conf, option signingKeyID.

At this point the clients do not know about this new key. To import the new key to clients during their registration, the following can be done:

sudo -u smt gpg --homedir /var/lib/smt/.gnupg \
  --export -a signingKeyID \
  > /MirrorTo/repo/keys/smt-signing-key.key

In this example, MirrorTo stands for the base directory where repositories will be mirrored. When done, clients can import this key during the registration process.

Registering Clients in the Testing Environment

To register a client in the testing environment, modify the /etc/SUSEConnect on the client machine by setting:

namespace: testing

3.7 Repository Preloading

Although SUSE servers with software repositories are accelerated, deploying multiple SMT servers may become time consuming if each new SMT server must mirror the same repositories.

To save time when deploying new SMT servers, the repositories can be preloaded from another server/disk instead. Follow these steps:

  1. Enable the repositories to be mirrored with the SMT, for example:

    smt-repos -e SLES12-Updates sle-12_x86_64
  2. Perform a dry run of smt-mirror to get the repository directories created:

    smt-mirror -d --dryrun -L /var/log/smt/smt-mirror.log

    Using the repository above and the default MirrorTo, this will create

    /srv/www/htdocs/repo/repoindex.xml
    /srv/www/htdocs/repo/$RCE/SLES12-Updates/sle-12-x86_64/*
  3. Now you can copy over the repositories from another SMT server, for example:

    rsync -av 'smt12:/srv/www/htdocs/repo/\$RCE/SLES12-Updates/sle-12-x86_64/' \
     '/srv/www/htdocs/repo/$RCE/SLES12-Updates/sle-12-x86_64/'
  4. To get the repository data fixed up, perform a normal smt-mirror:

    smt-mirror -d -L /var/log/smt/smt-mirror.log
Important
Important: Possible Error Messages

Be prepared for errors such as repomd.xml is the same, but repo is not valid. Start mirroring. These errors occur, since the metadata about the preloaded repositories in the server's database is incorrect until this initial mirror of the repositories has completed.

Print this page