This chapter introduces topics that will give you more control over your SMT server, but are beyond the usual workflow.
Creating backups of the SMT server regularly can help restore it quickly and reliably if the server fails.
There are three main areas on the SMT server to back up:
Configuration files
Package repositories
The database
The SMT server configuration is stored in the
/etc/smt.conf file and files in the
/etc/smt.d directory.
As SMT depends on the services provided by the Apache Web server and
Maria DB database engine, you need to back up their configuration files as
well. Apache's configuration files are located in the
/etc/apache2 directory, while the configuration files
for Maria DB are /etc/my.cnf,
/etc/mysqlaccess.conf, and files in the
/etc/my.cnf.d directory.
Package repositories are stored in the
/srv/www/htdocs/repo directory. Although you can
normally mirror the repositories on the restored server from the update
server as well, the download can take a long time. Therefore backing up the
repositories saves you time and bandwidth. Furthermore, backing up
the repositories is necessary if you are using repository staging and
want to restore the snapshots of the repositories (see
Section 3.6, “Testing and Filtering Update Repositories with Staging”).
The size of the software repositories can be huge and you will need to transfer them from the update server.
Use your preferred tool to back up the configuration and repository files.
SMT uses the Maria DB database to store information about clients, registrations, machine data, which repositories are enabled for mirroring, or custom repositories. Unlike the configuration files and repositories, the database information cannot be recovered without a valid backup.
To back up the SMT database, you can for example create a cron job that performs an SQL dump into a plain text file:
mysqldump -u root -p smt_db_password smt > /backup_dir/smt-db-backup.sql
Then include the resulting file to your normal backup jobs.
In some restricted environments it is not possible for SMT servers to access the Internet because they are located in disconnected or isolated networks. By using some special parameters on the SMT commands and a mobile disk, it is possible to accommodate for this.
You need to have one external SMT server that mirrors the repositories from SUSE Customer Center. Then you can 'mirror' these repositories to the SMT servers on the isolated network using the mobile storage medium.
Although the initial setup of this solution requires additional configuration, the regular update synchronization with SUSE Customer Center and distribution to isolated servers is simple. The steps required during the initial setup consist of:
Installation and configuration of the external SMT server.
Installation of the internal server.
Modification of /etc/smt.conf and cron setup on the
internal SMT server.
Copying of the SUSE Customer Center data on the external SMT server and importing it to the internal one.
Enabling and disabling of repositories on the internal server.
Creation of an SMT database replacement file (which can be used instead of the normal Maria DB database when performing the mirror jobs) on the internal server.
Day-to-day operation includes:
On the external server run the smt-mirror job based on
the database replacement file that writes to the mobile disk.
Synchronization of the mirrored repositories from the mobile disk to the internal SMT server.
A detailed description of the individual steps follows:
Install and configure SMT as described in Chapter 1, SMT Installation.
Enable the repositories to be consumed by the internal SMT servers.
Perform a normal repository mirroring from SUSE Customer Center with
smt-mirror.
Attach a removable disk to the server and mount it.
Export the required SUSE Customer Center data to a directory on the mounted removable disk:
Create the directory with proper permissions to hold the data. Because
the smt commands run as the
smt user (whose numeric UID
can differ between the servers), we need to make the permissions for
the directories on the mobile disk less restrictive:
chmod o+w /path/to/scc/dir/on/mobile/disk
Export the SUSE Customer Center data:
smt-sync --todir /path/to/scc/dir/on/mobile/disk
Set up a directory with proper permissions:
mkdir /path/to/repository/on/mobile/disk chmod o+w /path/to/repository/on/mobile/disk
Unmount and detach the removable disk.
Ensure you have a working SUSE Linux Enterprise Server installation source.
Install SMT the same way as on the external server with the following exceptions:
Select in the dialog.
Ignore the error message when running the synchronization script in the phase of the wizard.
Abort the wizard and then click in the list of installed add-on products.
Re-launch the YaST Subscription Management Tool Server Configuration module (yast2
smt-server), and go to the
tab.
Delete "SCC Registration" and "Synchronization of Updates" jobs.
Click to finish the wizard, provide the SMT user password, and acknowledge the synchronization error again.
Prevent registration data upstream synchronization to SUSE Customer Center by setting
forwardRegistration = false
in /etc/smt.conf.
Connect the mobile disk and mount it.
Populate the SMT database with the SUSE Customer Center data previously created:
smt-sync --fromdir /path/to/scc/dir/on/mobile/disk
Enable mirroring of the desired repositories with smt-repos
-e.
Create a database replacement file on the mobile hard disk:
smt-sync --createdbreplacementfile /path/to/dbrepl/file/on/mobile/disk
Unmount and detach the removable disk.
Now the configuration of both the external and internal SMT servers is complete. However, the update repository is still empty. After you run the following daily operation routines for the first time, the repository will get synchronized, and the internal SMT server will be ready to serve clients.
Connect the mobile disk and mount it.
Perform a mirror to a directory on the mobile disk based on the file on the mobile disk:
smt-mirror --dbreplfile /path/to/dbrepl/file/on/mobile/disk \ --fromlocalsmt --directory /path/to/repository/on/mobile/disk \ -L /var/log/smt/smt-mirror-example.log
Update the database on the mobile disk with the product and subscription info from SUSE Customer Center:
smt-sync --todir /path/to/scc/dir/on/mobile/disk
Optionally, scan the mobile disk for viruses and/or other unwanted content.
Unmount and disconnect the mobile disk.
Connect the mobile disk and mount it.
Update the SUSE Customer Center data on the server:
smt-sync --fromdir /path/to/scc/dir/on/mobile/disk
Mirror from the mobile disk to the server:
smt-mirror --fromdir /path/to/repository/on/mobile/disk
Update the SUSE Customer Center data on the mobile disk with local changes in the mirror status since the last synchronization:
smt-sync --createdbreplacementfile /path/to/dbrepl/file/on/mobile/disk
Unmount and disconnect the mobile disk.