Install SUSE Manager in a Virtual Machine Environment using SUSE Manager image

1. Virtual Machine Manager (virt-manager) Settings

This chapter provides the required Kernel Virtual Machine (KVM) settings for SUSE Manager. KVM combined with Virtual Machine Manager (virt-manager) will be used as a sandbox for this installation.

You will find the VM images for SUSE Manager 4.3 in various formats. It includes the underlying OS bits (SUSE Linux Enterprise Server_15 SP4) and the SUSE Manager software current at the time of build. Download the appropriate SUSE Manager image for your environment from https://download.suse.com/.

This table specifies the minimum requirements. These are suitable for a quick test installation, such as a server with one client. If you want to use a production environment, review the requirements listed in Hardware Requirements.

Virtual machine settings overview

Installation Method

Import Existing Disk Image

OS:

SUSE Linux Enterprise 15 SP4

Memory:

16 GB

CPU’s:

4

Virtual Disks:

VirtIO Disk 1

SUSE-Manager-Server.x86_64-4.3.10-KVM.qcow2

VirtIO Disk 2

101 GB for /var/spacewalk

VirtIO Disk 3

50 GB for /var/lib/pgsql

VirtIO Disk 4

4 GB for swap

CDROM

Ignition or Cloud Init configuration disk

Name:

suse-manager-test-setup

Network

Bridge br0

For more information on SUSE Linux Enterprise Virtualization Guide, see https://documentation.suse.com/sles/15-SP4/html/SLES-all/book-virtualization.html.

SUSE Manager VM image does not set up root or any other user account. User or root authentications need to be set up during first boot. This can be done using Ignition or Cloud-Init methods.

2. SUSE Manager basic configuration using Ignition

Ignition is a provisioning tool that enables you to configure a system according to your specification on the first boot. When the system is booted for the first time, Ignition is loaded as part of an initramfs and searches for a configuration file within a specific directory (on a USB flash disk, or you can provide a URL).

Ignition uses a configuration file in the JSON format. The file is called config.ign.

The config.ign is a JSON configuration file that provides prescriptions for Ignition. You can either create the file manually in JSON, or you can use the Fuel Ignition tool to generate a basic set of prescriptions. The Fuel Ignition tool does not provide a full set of options, so you might have to modify the file manually. For more information, see https://ignite.opensuse.org/.

When installing, the configuration file config.ign must reside in the ignition subdirectory on the configuration media labeled ignition. The directory structure must look as follows:

<root directory>
└── ignition
    └── config.ign

If you intend to configure a QEMU/KVM virtual machine, provide the path to the config.ign file as an attribute of the qemu command. For example:

-fw_cfg name=opt/com.coreos/config,file=PATH_TO_config.ign

The config.ign file contains various data types: objects, strings, integers, booleans, and lists of objects. For the complete specification, see https://coreos.github.io/ignition/configuration-v3_3/.

2.1. Set root password using Ignition

The SUSE Manager VM image does not set up root or any other user account. User or root authentications need to be set up during first boot. The passwd attribute is used to add users. If you intend to log in the system, create root and set the root’s password and/or add the SSH key to the Ignition configuration. You need to hash the root password, for example, by using the openssl command:

openssl passwd -6

The command creates a hash of the password you chose. Use this hash as the value of the passwordHash attribute.

The users attribute must contain at least one name attribute. ssh_authorized_keys is a list of ssh keys for the user.

Create the root/ignition/config.ign file with the following content:

{
  "ignition": {
    "version": "3.2.0"
  },
  "passwd": {
    "users": [
      {
        "name": "root",
        "passwordHash": "$2a$10$qV298UV11u9lCFDjpHpCUe1cErBiVR.G3shukxs3.2PAO1xhJWs0K"
      }
    ]
  }
}

Prepare the Ignition ISO file using the command:

mkisofs -full-iso9660-filenames -o suma_ignition.iso -V ignition root

Attach the created suma_ignition.iso file as a volume to the virtual machine at first boot. This particular example is setting the root password to linux. Substitute your password hash for the one in this example.

3. SUSE Manager basic configuration using Cloud Init disk

Cloud Init is a provisioning tool that enables you to configure a system according to your specification on the first boot. When the system is booted for the first time, Cloud Init service is loaded and searches for a configuration file within a specific directory (on a USB flash disk, or you can provide a URL).

Cloud Init uses few configuration files in the YAML format. Used files are named meta-data, network-config and user-data.

Cloud Init allows numerous sources where to store configuration data. In this guide we use local iso image with volume id cidata as a source. The directory structure must look as follows:

<root directory>
└── meta-data
└── network-config
└── user-data

If you intend to configure a QEMU/KVM virtual machine, provide the path to the config.ign as an attribute of the qemu command. For example:

-fw_cfg name=opt/com.coreos/config,file=PATH_TO_config.ign

The Cloud Init allows many management options. For a complete specification, refer to Cloud Init specification (https://cloudinit.readthedocs.io/en/latest/index.html).

3.1. Set up root password using Cloud Init

You need to hash the root password, for example, by using the openssl command:

openssl passwd -6

The command creates a hash of the password you chose. Use this hash as the value of the password attribute.

Prepare the needed configuration files using the following commands:

touch network-config
touch meta-data

Create a file named user-data with the following content:

#cloud-config
chpasswd:
  expire: false
  users:
    - name: root
      password: $2a$10$qV298UV11u9lCFDjpHpCUe1cErBiVR.G3shukxs3.2PAO1xhJWs0K

Prepare Cloud Init ISO file using the command:

mkisofs -rational-rock -joliet -o suma_cloudinit.iso -V cidata network-config meta-data user-data

Attach the created suma_cloudinit.iso file as a volume to the creating virtual machine. This particular example is setting root password to linux. Substitute your password hash for the one in this example

4. SUSE Manager Virtual Machine Settings

Create three additional virtual disks required for the SUSE Manager storage partitions.

Procedure: Creating the Required Partitions with KVM
  1. Create a new virtual machine using the downloaded SUSE Manager KVM image and select Import existing disk image.

  2. Set SUSE Linux Enterprise 15 SP4 as the installed operating system.

  3. Configure RAM and number of CPUs (at least 16 GB RAM and 4 CPUs).

  4. Name your KVM machine and select the Customize configuration before install check box.

  5. Click Add Hardware to create three new virtual disks with these specifications. These disks will be partitioned and mounted in [proc.sumavm.susemgr.prep].

    Storage size values are the absolute minimum—only suitable for a small test or demo installation. Especially /var/spacewalk/ may quickly need more space. Also consider to create a separate partition for /srv where Kiwi images are stored.

    VirtIO Storage Disks Name Sizing

    VirtIO Disk 2

    spacewalk

    500 GB

    VirtIO Disk 3

    pgsql

    100 GB

    VirtIO Disk 4

    swap

    4 GB

  6. Click Add Hardware to attach a virtual CDROM device with the prepared Ignition or Cloud Init disk.

  7. Click Begin Installation to boot the new VM from the SUSE Manager image. Wait until the login prompt is presented. Log in using credentials set by configuration disk.

5. Preparing virtual machine for SUSE Manager

Before starting obtain your SUSE Manager Registration Code from SUSE Customer Center - https://scc.suse.com.

Procedure: Preparing for SUSE Manager run
  1. Log in as root.

  2. Register SUSE Manager with SCC. For example, replace <productnumber> with 4.3 and <architecture> with x86_64:

    SUSEConnect -e <EMAIL_ADDRESS> -r <SUSE_MANAGER_CODE> \
      -p SUSE-Manager-Server/<productnumber>/<architecture>
  3. Validate the authorized extensions by running the list extensions command:

    SUSEConnect --list-extensions
  4. Add SUSE Manager repositories:

    SUSEConnect -p sle-module-basesystem/15.4/x86_64
    SUSEConnect -p sle-module-server-applications/15.4/x86_64
    SUSEConnect -p sle-module-web-scripting/15.4/x86_64
    SUSEConnect -p sle-module-suse-manager-server/<productnumber>/x86_64
  5. Prepare SUSE Manager storage: suma-storage command automatically prepares and configures previously created external storage for use with SUSE Manager. In the following command the first parameter is the device for SUSE Manager data, the second parameter is the device for the database.

    suma-storage /dev/vdb /dev/vdc
  6. The virtual machine is now ready for SUSE Manager to be set up.

For proceeding with SUSE Manager setup, see SUSE Manager Setup.