13 Creating operating system images #
There are multiple ways to create custom operating system images from SUSE Linux Enterprise Server for SAP Applications. The preferred way is generally to use KIWI NG, which ingests an XML configuration file and then runs fully automatically.
Alternatively, you can also create an image from an existing installation that is cleaned up before re-use.
13.1 Creating images with KIWI NG #
KIWI NG is a tool to create operating system images that can be easily copied to new physical or virtual machines. This section will present information on creating SLES for SAP images with KIWI NG.
SUSE Linux Enterprise Server for SAP Applications now supports creating images with KIWI NG using the template from
the package kiwi-template-sap
. However, there are
certain restrictions in the current implementation:
Only building VMX disk images is supported. Building other image types is not supported.
You must provide an ISO image of SUSE Linux Enterprise Server for SAP Applications at
/tmp/SLES4SAP.iso
, as the Open Build Service does not contain all necessary packages.
To build a basic image, use the following two commands:
Build the root file system:
#
kiwi
-p SLES4SAP --root fsrootBuild the VMX image:
#
kiwi
--create fsroot --type vmx -d build
To enable running graphical installations using SAPinst, the default settings of the image enable the following:
Installation of an IceWM desktop
The service
xrdp
is started automatically, so you can connect to the machine via RDP. For more information, see Chapter 12, Connecting via RDP.
For more information about KIWI NG and SLES for SAP:
On the KIWI NG configuration for SLES for SAP, see
/usr/share/kiwi/image/SLES4SAP/README
.On KIWI NG in general, see the openSUSE-KIWI Image System Cookbook (https://doc.opensuse.org/projects/kiwi/doc/).
13.2 Cleaning up an instance before using it as a master image #
In some cases, it makes sense to use an image of an already-configured master instance on multiple systems instead of generating a KIWI NG image from scratch. For example, when your image needs to contain additional software or configuration that cannot be installed using KIWI NG.
However, normally such an image would contain certain configuration data that should not be copied along with the rest of the system.
To avoid needing to clean up manually, use the script clone-master-clean-up
(available
from the package of the same name).
It deletes the following data automatically:
Swap device (zero-wiped, then re-enabled)
SUSE registration information and repositories from SUSE, and the Zypper ID
User and host SSH keys and domain and host names
The generated
HANA-Firewall
script (but not the configuration itself)Shell history, mails, cron jobs, temporary files (
/tmp
,/var/tmp
), log files (/var/log
), random seeds,systemd
journal,collectd
statistics,postfix
configuration, parts of/root
/var/cache
,/var/crash
,/var/lib/systemd/coredump
Additionally, the following configuration is restored to defaults:
Network interfaces that do not use DHCP and network configuration (
/etc/hostname
,/etc/hosts
, and/etc/resolv.conf
)sudo
settings
Additionally, you can choose to set up a new root
password.
UUID-based entries in /etc/fstab
are replaced by
device strings. This script also ensures that if the first-boot section
of the installation workflow was used for the original installation, it is
run again on the next boot.
13.2.1 Configuring clone-master-clean-up
#
Before running clone-master-clean-up
, the script can be configured in the following ways:
To configure the script to not clean up certain data, use the configuration file
/etc/sysconfig/clone-master-clean-up
.This file also gives short explanations of the available options.
To configure the script to clean up additional directories or files, create a list with the absolute paths of such directories and files:
/additional/file/to/delete.now /additional/directory/to/remove
Save this list as
/var/adm/clone-master-clean-up/custom_remove
.
13.2.2 Using clone-master-clean-up
#
To use the script, do:
#
clone-master-clean-up
Then follow the instructions.
13.2.3 For more information #
The following sources provide additional information about clone-master-clean-up
:
For general information, see the man page
clone-master-clean-up
.For information on which files and directories might additionally be useful to delete, see
/var/adm/clone-master-clean-up/custom_remove.template
.