Red Hat Training

A Red Hat training course is available for Red Hat Satellite

4.3. Managing Virtualized Client Systems

In order to manage and provision client systems, synchronize content from Red Hat Network's central servers to the Red Hat Satellite.
Synchronize at least the following channels:
For Red Hat Enterprise Linux 5:
  • Red Hat Enterprise Linux Server (v. 5 for 32-bit x86) - rhel-i386-server-5 (and all child channels)
  • Red Hat Network Tools for RHEL Server (v. 5 for 32-bit x86) - rhn-tools-rhel-i386-server-5
  • Red Hat Enterprise Linux Server Virtualization (v. 5 for 32-bit x86) - rhel-i386-server-vt-5 (and all child channels)
For Red Hat Enterprise Linux 6:
  • Red Hat Enterprise Linux Server (v. 6 for 64-bit x86_64) - rhel-x86_64-server-6 (and all child channels)
  • Red Hat Network Tools for RHEL Server (v. 6 for 64-bit x86_64) - rhn-tools-rhel-x86_64-server-6

4.3.1. Setting Up the Host System for Your Virtual Systems

Before creating guest systems, prepare the host system by creating a Red Hat Enterprise Linux Server kickstart profile. Use that kickstart profile to install the operating system on your host. Once these steps are complete, you can proceed to provision virtual guests.

4.3.1.1. Creating a Kickstart Profile for the Guest Systems

  1. Log in to the Satellite's web interface. Navigate to the Kickstart Overview screen by clicking the Manage Kickstarts link in the Tasks widget in Your Red Hat Network, or by clicking on the Systems tab, followed by the Kickstart subtab in the left navigation bar.
  2. On the Kickstart Overview page, click the Create a New Kickstart Profile link in the Kickstart Actions widget in the upper right corner.
    1. Enter a label for your profile that will enable you to distinguish it from your other profiles. For the remaining instructions, we'll assume the label is host-system-for-virtual-guests.
    2. For the Base Channel field, select Red Hat Enterprise Linux (v.5 or 6 for $ARCH) (where $ARCH is the architecture of your host system).

      Note

      You may install 32-bit Red Hat Enterprise Linux 5 or 6 on a 64-bit host system. If you choose to do this, however, please be aware that your guest systems must also run the 32-bit version of Red Hat Enterprise Linux.
    3. In the Kickstartable Tree field, select ks-rhel-$ARCH-server-5 (or 6) where $ARCH is the architecture of your host system.
    4. Select the Virtualization Type.

      Note

      If you are changing the Virtualization Type of an existing kickstart profile, it may also modify the bootloader and partition options, potentially overwriting any user customizations. Be sure to review the Partitioning tab to verify these settings when changing the Virtualization Type.
    5. Click the Next button in the lower right of the screen to continue on to the next step.

      Note

      If any of the fields are missing the options indicated above, you may not have successfully synced software channel content to your Satellite from Red Hat's servers.
  3. Select the location of the distribution files for the installation of your host system. There will already be a Default Download Location filled out and selected for you on this screen. Click the Next button on this screen to continue to Step 3.

    Note

    If the default download location is missing, you may not have successfully synced software channel content to your Satellite from Red Hat's server.
  4. Choose a root password to set on the host system you will be provisioning, and click Finish to finish creation of the profile.
  5. You will be shown the newly-created kickstart profile. You may browse through the various tabs of the profile and modify the settings as you see fit, but this is not necessary as the default settings work well for the majority of cases.
    In order to be able to remotely start and stop the guest using the Satellite web interface, you will need to include the package acpid.

4.3.1.2. Kickstarting Your Host System

Kickstart your host system using your newly-created kickstart profile. There are three different scenarios for kickstarting your host system. Please read through these scenarios below, and follow the instructions for the scenario that applies best to you:
4.3.1.2.1. Your Host System Does Not have Red Hat Enterprise Linux Installed
Create a boot CD to initiate the kickstart on your host system. You will be able to use the kickstart profile we created in earlier steps to provision the host. Note you must have physical access to the machine you intend to use in order to follow these steps:
  1. You will find an ISO to create a boot CD for your host by using ssh to log into your Satellite. It is at the following location on your satellite:
    /var/satellite/rhn/kickstart/ks-rhel-i386-server-5.3/images/boot.iso
    

    Note

    It is possible to use a flash-memory USB key to boot your system in order to kickstart it. See the Red Hat Enterprise Linux Installation Guide for tips on how to do this. Note that your host system's hardware must support boot via these devices.
  2. Insert the boot CD in the drive and reboot the system, making sure the CD-ROM drive is set as the primary boot device in the system's BIOS.
  3. After reboot, you will find yourself at a boot prompt. Type the following command at this prompt to start your kickstart:
    linux \
    ks=http://your-satellite.example.com/ks/label/the profile label you created earlier

    Note

    For some systems, you may need to add ksdevice=eth0 to the command above or disable one of two or more NICs in the system's BIOS to avoid confusion during the kickstart process.
  4. The kickstart for your host system will begin. It will take around fifteen minutes to complete. Upon successful completion of this kickstart, you will have provisioned a host system for your virtual guest and registered it to your Satellite.
4.3.1.2.2. Your Host System Has Red Hat Enterprise Linux 6 or 7 Installed
Register your host system to your Satellite and check to see if the required KVM packages are installed on the system. If they are not, install them using the Satellite.

Note

On Red Hat Enterprise Linux 6, virtualization is only supported on 64-bit Intel and AMD machines.

Note

The Xen virtualization host is not currently supported on Red Hat Enterprise Linux 6.
  1. Register your host system to your Red Hat Satellite. Use ssh to connect to your host system then issue the following command as root:
    # rhnreg_ks --serverUrl=http://your-satellite.example.com/XMLRPC \
        --username=username --password=password
    

    Note

    If your host system is already registered to a different Red Hat Network server, add the --force option to the command above.
  2. Open up the host system's profile in the Satellite web interface. Log into the web interface of your Satellite at https://your-satellite.example.com/. Click on the Systems tab in the top navigational bar. You will see the host system you just registered - click on its profile name to access its system profile page.
  3. Make sure your system has access to the software channels it needs to access the software required for hosting virtual guests. From your host system's profile page, click on the Alter Channel Subscriptions link on the profile page under the Subscribed Channels header. Check the RHEL Virtualization and Red Hat Network Tools for RHEL Server checkboxes and click the Change Subscriptions button underneath the list of channels.
  4. Check if the necessary software installed for hosting virtual guests is on the system. On the host system, issue the following command as root:
    For Red Hat Enterprise Linux 6:
    # rpm -q qemu-kvm rhn-virtualization-host python-virtinst
    
    For Red Hat Enterprise Linux 7:
    # rpm -q qemu-kvm rhn-virtualization-host virt-install
    
    If rpm indicates these packages are not installed, you must install them by running the following command as root on the system:
    For Red Hat Enterprise Linux 6:
    # yum install qemu-kvm rhn-virtualization-host python-virtinst
    
    For Red Hat Enterprise Linux 7:
    # yum install qemu-kvm rhn-virtualization-host virt-install
    
  5. Restart the machine to pick up the changes, or use the appropriate modprobe command for your processor:
    # modprobe kvm_intel
    
    or:
    # modprobe kvm_amd
    
  6. Install and run the osad package in order for your host system to be responsive to commands sent from the Satellite, such as start, pause, resume, and shutdown. To install:
    # yum install -y osad
    
    After installation, start the osad process:
    # /sbin/service osad restart
    
  7. Your host system will now be ready for Red Hat Network virtual guest provisioning.

4.3.1.3. Your Host System Has Red Hat Enterprise Linux 5 Installed

You should register your host system to your Satellite and check to see if the required Xen or KVM packages are installed on the system. If they are not, install them using the Satellite.
  1. Register your host system to your Satellite. Use ssh to connect to your host system. Register your host system to your satellite issuing the following command as root:
    # rhnreg_ks --serverUrl=http://your-satellite.example.com/XMLRPC \
        --username=username --password=password
    

    Note

    If your host system is already registered to a different Red Hat Network server, add the --force option to the command above.
  2. Open up the host system's profile in the Satellite web interface. Log into the web interface of your Satellite at https://your-satellite.example.com/. Click on the Systems tab in the top navigational bar. You will see the host system you just registered - click on its profile name to access its system profile page.
  3. Make sure your system has access to the software channels it needs to access the software required for hosting virtual guests. From your host system's profile page, click on the Alter Channel Subscriptions link on the profile page under the Subscribed Channels header. Check the RHEL Virtualization and Red Hat Network Tools for RHEL Server checkboxes and click the Change Subscriptions button underneath the list of channels.
  4. Check to see if you have the necessary software installed for hosting virtual guest on the system. On the host system, issue the following command as root:
    # rpm -q xen kernel-xen rhn-virtualization-host
    
    For KVM, issue the following command as root:
    # rpm -q kvm kmod-kvm rhn-virtualization-host python-virtinst
    
    If rpm indicates these packages are not installed, you must install them by running the following command as root on the system:
    # yum install xen kernel-xen rhn-virtualization-host
    
    For KVM users, install by running the following command as root:
    # yum install kvm kmod-kvm rhn-virtualization-host python-virtinst
    
    For Xen, you will then need to edit the /etc/grub.conf configuration file to boot the new xen kernel by default. To do this, select the lines in grub.conf that pertain to the xen kernel from the beginning of the title line to the end of the initrd line, copy the lines, delete them, and paste them into the file as the first kernel entry in grub.conf. Also ensure that the value of the default variable at the top of grub.conf is set to a value of '0'.

    Note

    If you ever update the kernel on the host system, the standard kernel is the default choice upon reboot. To ensure that the Xen kernel is chosen by default, change the following value in the /etc/sysconfig/kernel file:
    DEFAULTKERNEL=kernel
    
    Change the value to kernel-xen:
    DEFAULTKERNEL=kernel-xen
    
  5. Restart the machine to pick up the changes, or use the appropriate modprobe command for your processor:
    # modprobe kvm_intel
    
    or:
    # modprobe kvm_amd
    
  6. Reboot the system ensuring that it boots into the xen kernel. Use the command uname -r to see if the running kernel is a xen kernel. If you do not see the Xen string in the name of the kernel you have not booted into the correct kernel.

    Note

    If the system already has Xen and kernel-xen installed you do not need to reboot after installing rhn-virtualization-host.
  7. Install and run the osad package in order for your host system to be responsive to commands sent from the Satellite, such as start, pause, resume, and shutdown. To install:
    # yum install -y osad
    
    After installation start the osad process:
    # /sbin/service osad restart
    
  8. Your host system will now be ready for Red Hat Network virtual guest provisioning.

4.3.2. Setting Up Your Virtual Systems

To work with virtual guest systems create a kickstart profile that will allow you to easily provision virtual guests.

4.3.2.1. Create a Kickstart Profile for the Guest Systems

  1. Log on to the Satellite's web interface. Navigate to the Kickstart Overview screen by clicking on the Manage Kickstarts link in the Tasks widget in Overview, or by clicking on Systems in the top navigation bar and then Kickstart from the left navigation bar.
  2. On the Kickstart Overview page, click the Create a new Kickstart Profile link in the Kickstart Actions widget in the upper right corner.
  3. The next page displayed is Step 1 of the kickstart profile creation process:
    1. Enter a label for the profile that will allow you to distinguish it from the other profiles. A good choice would be guest-system.
    2. For the Base Channel field, select Red Hat Enterprise Linux $PRODUCT (v.5 or 6 for $ARCH) where $ARCH is the architecture of your host system's operating system and $PRODUCT is either Server or Client.

      Note

      Red Hat Enterprise Linux Client 5 or Red Hat Enterprise Linux Client 6 may not be available for selection if you did not synchronize the Client software channels to your Satellite.

      Note

      The channel labels for Red Hat Enterprise Linux 5 or Red Hat Enterprise Linux 6 and Red Hat Enterprise Linux 5 Desktop or Red Hat Enterprise Linux 6 Desktop refer to 'server' and 'client' respectively.
    3. For the Kickstartable Tree field, select ks-rhel-$ARCH-$PRODUCT-5.3 where $ARCH is the architecture of your host system and $PRODUCT is either 'server' or 'client', depending on which product with which you would like to provision your guest.
    4. Select the Virtualization Type.

      Note

      If you are changing the Virtualization Type of an existing kickstart profile, it may also modify the bootloader and partition options, potentially overwriting any user customizations. Be sure to review the Partitioning tab to verify these settings when changing the Virtualization Type.
    5. Click the Next button in the lower right of the screen to continue on to the next step.
  4. For Step 2 of the kickstart profile creation process, select the location of the distribution files for the installation of your guest system. There will already be a Default Download Location filled out and selected for you on this screen. Click the Next button on this screen to continue to Step 3.

    Note

    Red Hat Enterprise Linux Client 5 or Red Hat Enterprise Linux Client 6 may not be available for selection if you did not synchronize the Client software channels to your Satellite.
  5. For Step 3 of the kickstart profile creation process, choose a root password for the guest system you are provisioning, and click Next to finish creation of the profile.
This completes kickstart profile creation. After completing Step 3 you will be taken to the profile details. You may browse through the various tabs of the profile and modify the settings as you see fit, but this is not necessary as the default settings work well for the majority of cases. While the interface allows you to allocate less, we strongly recommend allocating at least 3 GB of storage for your guest system with this kickstart profile.

4.3.2.2. Provisioning Your Guest Systems

  1. Log into the Satellite's web interface. Browse to your host system's profile by clicking on the Systems tab in the top navigation bar, and click on the system's name.
  2. To schedule a kickstart for a guest system, go to the VirtualizationProvisioning tab in the host system's profile. For the Guest Name field choose guest1. For the Memory Allocation, Virtual CPUs, and Storage fields, the default values should be fine. Feel free to change these as desired, taking note of the advice provided for each field in the interface. For the Kickstart Profile field, select the previously created guest system profile.
  3. Click on the Schedule Kickstart and Finish button in the lower-right corner of the screen. You will be taken to the Kickstart Status page where you can follow along with the guest's kickstart progress. The status screen will indicate when the kickstart is successfully completed. To view your new guest, click on the Virtualization tab of the host system's profile on the Satellite. To view a list of virtual systems, navigate to SystemsSystemsVirtual Systems.

    Note

    If you do not see the Initiate a kickstart guest message on the Kickstart Status page shortly after scheduling the kickstart of the guest, you may be missing osad on your host.
    Host systems require the osad package in order to be responsive to commands sent from the Satellite, such as start, pause, resume, and shutdown. If osad is not installed and running, the host system will not receive these commands from the web interface for 2.5 hours, or the next time that the Red Hat Network daemon runs.
    You can check whether or not osad is installing and running by checking the OSA Status field in the host system's profile on the Satellite. If the OSA Status field does not exist or the field indicates that the system has not contacted Satellite in several minutes you will need to install osad before you can successfully provision a guest on the host system. Run yum install -y osad as root.

    Note

    You may receive the following message from the Kickstart Status page during the guest's kickstart:
    The install process on the guest system has not communicated to Red Hat Network in
    the past n minutes.  This may be due to a hung install process, or it
    may just be due to a slow install because of hardware constraints.  A
    log of the installation process is available, you may wish to review
    it to troubleshoot this issue.
    
    This message should not cause alarm unless more than twenty minutes have passed. To check if the kickstart is continuing look at the installation log to make sure there are no errors, reload the Kickstart Status page, and check that the Last File Request field continues to be updated.
  4. If you would like to register additional guests to your host, repeat the steps above. It is important to remember that you can only provision one guest at a time. If you attempt to schedule a guest kickstart while another is currently taking place, the current guest kickstart process will be canceled and the new guest kickstart process will begin.
  5. View your newly-created virtual guest's system in the Satellite's web interface by clicking on the Virtualization tab in the host system's profile. Then, click on the profile name of your virtual system to view its Satellite system profile.

4.3.2.3. Managing Your Virtual Guest Entitlements

Red Hat Satellite features Flex Guest entitlements that enable you to assign entitlements to your virtual guests without consuming a standard entitlement reserved for physical systems.
To manage your Flex Guest entitlements, click Overview -> Subscription Management -> Virtualization Entitlements -> Flex Guest Entitlement Consumers. This page lists all virtual guests consuming Flex Guest entitlements.
To find and convert any virtual guests that consume standard entitlements, click the Guests Consuming Regular Entitlements subtab.

4.3.3. Working With Your Virtual Systems

Once you have set up your virtual system, you can then manage and customize it via various methods, including connecting via SSH and via the virtualization management interface on the host system.

Note

This section deals primarily with Xen hosts. In Red Hat Enterprise Linux 6, Xen is currently not supported, and KVM is the recommended virtualization method. See the Red Hat Enterprise Linux Virtualization Guide for detailed instructions on KVM usage.

4.3.3.1. Logging into Virtual Systems Directly via SSH

  1. You will need to locate the virtual system's IP address. Locate it by navigating to the SystemsVirtual Systems tab and clicking on the virtual system's profile name.
  2. On the virtual system's profile page, you'll find the IP address in the left-hand column in the IP Address field.
  3. Connect to the IP address by using ssh as root with the password you set for the virtual system in the kickstart profile.

4.3.3.2. Gaining Console Access Via the Host

  1. Connect to the host system and determine the ID number of the guest you would like to work with. Connect to the host system via ssh and run the following command:
    # xm list
    
    This will provide you with a list all of the guests created on your Satellite, including their ID number. The guest we created earlier, guest1, will be in this list with an ID number. For example, if this guest has been assigned an ID of 2, then:
  2. Run the following command to access the console of this virtual system:
    # xm console 2
    
    You will immediately be able to view a login prompt on guest1.
  3. Log in to guest1 as root using the same password you set in the kickstart profile you used to provision the system.
    (There may be some messages on the screen. In this case, hit the Enter key on your keyboard to receive a fresh login prompt.)
  4. To exit the guest console and return to the host system's command prompt, you may hit the Ctrl and ] keys on your keyboard simultaneously.

4.3.3.3. Installing Software Via the Satellite Web Interface

  1. Browse to the virtual system's profile in your Satellite's web interface by logging in and navigating to SystemsSystemsVirtual Systems and clicking on the name of your virtual system's profile.
  2. In the virtual system's profile, click on the Software+Packages tab.
  3. Click on Install New Packages in the Packages tab menu.
  4. Select the packages you wish to install and click the Install Selected Packages button in the lower right-hand corner of the screen.
  5. Review the package install details and click on the Confirm button in the lower right-hand corner of the screen.
  6. The package install will take place the next time the guest system checks in with the Satellite. To force the install to take place immediately, you may run the rhn_check command on the guest system.

4.3.3.4. Installing Software Via Yum From the Virtual System

Your virtual system was registered to your Satellite as part of the guest provisioning process, so the yum command can be used to install and update software. For example, to install the text editor vim, issue the following command as root:
# yum install -y vim-enhanced

4.3.3.5. Restarting Guests when Host Reboots

By default, when a host system reboots, the guests are not restarted and must be manually started by the administrator.
However, the rhn-virtualization-host service can restart guests automatically in the event of a host system reboot.
To use this service, follow these steps:
  1. Locate the guest's config file on the host in /etc/sysconfig/rhn/virt/. It will be named by UUID, but the correct file can be found by using the grep command to search for the guest name within the UUID files.
  2. When you have found the UUID file corresponding to your guest system, create a symbolic link from the UUID file to the /etc/sysconfig/rhn/virt/auto/ directory.
    # ln -s /etc/sysconfig/rhn/virt/GUEST_UUID.xml /etc/sysconfig/rhn/virt/auto/
    

4.3.3.6. Deleting Virtual Systems

Deleting a virtual system is a multi-step process.
  1. Shut down the virtual system that you wish to delete. You may do this by browsing to the host system's profile in the Satellite web interface, clicking on the virtualization tab, and selecting the virtual systems that you would like to delete. Finish shutting down by clicking the Shutdown Systems button at the bottom of the screen.
  2. Delete the virtual system from Satellite. This is accomplished by selecting the virtual system's checkbox and clicking the Delete System button at the bottom of the screen.

    Note

    Allow for at least two minutes between shutting down a virtual system and deleting it. Otherwise, the virtual system may not shut down properly and you will delete it while it is running. If you delete a virtual system from Satellite while it is running, it will reappear on the Satellite the next time it checks in. If this happens, simply shutdown the system, wait two minutes, and delete it again.
  3. Delete the disk image for the virtual system you would like to delete. You will find the disk image for guest1, for example, at the following location on the host system:
    /var/lib/xen/disk-images/guest1.disk
    
    Delete it with the following command:
    # rm /var/lib/xen/disk-images/guest1.disk
    
    If guest1 was on a KVM host system the disk image could be found at:
    /var/lib/libvirt/images/guest1.img
    
  4. Finally, you must delete the Red Hat Network configuration files from the host system. To locate the Red Hat Network configuration file for guest1, run the following command:
    # grep guest1 /etc/sysconfig/rhn/virt/*.xml
    
    Then delete the file indicated. For example:
    # rm /etc/sysconfig/rhn/virt/14e5cfbf72342515236ad74b260c2f6b.xml
    
  5. You have successfully deleted a guest system from your host system and from Satellite.