How to install SUSE SLES 15 SP6 in Hyper-V and install Ansible on it

Published by Rhein-Ruhr-Informatik on

This guide covers the process of installing SUSE Linux Enterprise Server (SLES) 15 SP6 on a Hyper-V virtual machine, followed by installing Ansible for automation tasks. The setup includes configuring the virtual machine in Hyper-V, installing SLES from an ISO image, and optionally enhancing performance with Hyper-V guest tools. After completing the OS installation, we activated the SUSE Package Hub repository to access necessary packages and install Ansible using the zypper package manager. This setup results in a fully functional SLES environment within Hyper-V, ready for enterprise automation with Ansible.

Prepare the environment to install the ISO image in the Hyper-V

In my Bare-Metal the Hyper-V hypervisor is already installed. Here you can find the method of installing it:

https://learn.microsoft.com/en-us/training/modules/configure-manage-hyper-v/2-define-hyper-v

So, you need to enable the Hyper-V feature in Windows by executing the command in PowerShell:

PS C:\WINDOWS\system32> Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All

After we have successfully installed Hyper-V, it is important to create and configure the virtual network. To prepare the environment to be able to install SUSE, I used Windows PowerShell to create network adapter using commands:

  • Get-NetAdapter
  • Import-Module Hyper-V
  • $ethernet = Get-NetAdapter -Name "Ethernet"
  • New-VMSwitch -Name "virtuelles Netzwerk" -NetAdapterName $ethernet.Name -AllowManagementOS $true -Notes "Geteiltes virtuelles Netzwerkinterface

The other step is to dedicate the storage space for the SUSE VM. Steps I followed are:

 Create the directory for the SLES:

I have dedicated 50GB of storage:

After the environment preparation, we downloaded the SUSE SLE-15-SP6-Full-x86_64-GM-Media1.iso iso image from the SUSE official website: https://www.suse.com/download/sles/ and saved locally:

Then we continued to install the SUSE over Hyper-V Manager following the steps:

Select new and then Virtual Computer

Name the VM and continue.

Select Generation 1 and continue.

Setting the memory. In our case we have dedicated 4096MB.

Setting the memory. In our case we have dedicated 4096MB.

Naming the virtual storage connection, select the path and setting the amount of storage.

After the configurations above, we started via PowerShell the VM with the command Start-VM -Name “sles”, and the installation began. The starting installation is shown in this picture below:

In this image is shown the beginning of the installation.

Initializing Network Configuration.

It will be updating the Installer…

Here we need to set the language and to select the Product.

We selected German language and the SUSE Linux Enterprise Server 15 SP6.

Selecting the License agreement and continue.

Here are some modules I have selected for the late use.

Installation the Add-On-Products.

In this case I have selected the HA-Node.

This is how the partitioning looks like.

Setting the time zone and continue.

Setting the local username and password.

Continue with installation.

Confirming the installation.

Installation process…

To be able to start with a new SUSE VM, we have selected the Boot Linux System.

Activating the SUSE GNOME Desktop

To be able to use SUSE GUI we need to install the GNOME desktop packages showing below:

Then installing GNOME desktop pattern:

And we need to system target to graphical.target

SUSE GUI image Is shown below:

Register the SUSE VM for accessing repositories including Package Hub

To be able to install the packages we need, it is important to register our system on SUSE Customer Center and get the registration code. SUSE offers a two-month free subscription code.

In the image below showing the repositories which are not activated:

After Subscription evaluation we can find the registration code to be able to access the SUSE repository.

Now we can follow the steps of how to register our system with the registration using the command:

Then we can enable the Base-system Module repository:

And after enabling the repositor, we refresh them to update the metadata:

All repositories have been refreshed

With the command we can see repositories status.

zypper repos | egrep -E “Yes”

Ansible installation in SLES 15 SP6

We can install ansible in SLES 15 SP6 using package-hub repository:

https://packagehub.suse.com/search/?q=ansible

Before going to install it, possible we need to check which SUSE service-pack version is installed in our environment.

And then finding the right ansible release version in the web-page https://packagehub.suse.com/packages/ansible/

Check for the connection status.

Zypper-Update

We need to check if the Package_Hub is activated with the command shown below:

zypper lr -u | egrep -E “Package_Hub”

If it’s not, we can do it as it is shown:

We can search for ansible with the command in the image above.

Here we can see that ansible with the status “not installed”

Starting the ansible installation. After the installation we can check the version:

And, like this to see the Status:

Conclusion

This article provides a comprehensive guide for IT administrators seeking to streamline their operations and improve efficiency by integrating SUSE Linux Enterprise Server (SLES) and Ansible in virtualized environments. By leveraging the powerful automation capabilities of Ansible, IT teams can automate various tasks, such as provisioning, configuration, and deployment, significantly reducing manual effort and potential human error. The article delves into specific use cases and best practices, making it a valuable resource for enterprises of all sizes looking to modernize their IT infrastructure and achieve greater agility.

Categories: BlogLinux

en_USEnglish