openSUSE Leap: Step-by-Step Guide for installing it on your virtualized environment
Introduction
openSUSE Leap is a robust and reliable Linux distribution, built from the same source code used to build SUSE Linux Enterprise (SLE) making it binary compatible with one of the most trusted operating systems to run mission critical workloads.
For those coming from CentOS/RHEL or other distributions like Debian or Arch, we have created this blog post to walk you through the step-by-step process of installing openSUSE Leap on Linux and Windows virtualized environments, covering two types of installations:
- Image installation, where we will use an image to quickly setup a VM
- Manual install, where we will go through the installation process step by step.
The installation process uses YaST in the background, openSUSE’s own installation and system configuration tool.
Download openSUSE Leap
Leap is available in various formats. To begin, please visit https://get.opensuse.org/leap/ .
For both manual and automated installs, we will download the Offline ISO image, which is 4GB. Alternatively, you can opt for the network image, which downloads necessary content from the internet. While this method conserves bandwidth and accelerates the initial setup, it can be slower if you need to repeat the process or install multiple VMs. If you plan to install more than one VM or make multiple attempts, downloading the full image is a worthwhile investment.
If you’re using a Linux terminal, you can download it using any of the following commands:
wget https://download.opensuse.org/distribution/leap/15.5/iso/openSUSE-Leap-15.5-DVD-x86_64-Media.iso
curl -O https://download.opensuse.org/distribution/leap/15.5/iso/openSUSE-Leap-15.5-DVD-x86_64-Media.iso
For the image install, we require a different file, to access this, click on ‘Alternative Downloads,’ which will lead you to the following screen:
Here, we’ll select the type of “Minimal Virtual Machine” that suits our environment. For this exercise, we’ll choose the KVM and XEN image.
If you’re using a Linux terminal, you can also download it using the following command:
wget https://download.opensuse.org/distribution/leap/15.5/appliances/openSUSE-Leap-15.5-Minimal-VM.x86_64-kvm-and-xen.qcow2
curl -O https://download.opensuse.org/distribution/leap/15.5/appliances/openSUSE-Leap-15.5-Minimal-VM.x86_64-kvm-and-xen.qcow2
Notice the “Live” section; these are bootable images that are ready for use. This is also an option, but keep in mind that they come with a limited set of packages and are not designed to be persistent.
Image install
Step 1: Create a new VM
We’ll begin by copying the image we just downloaded to the location where we store our VM disks. For instance:
cp /tmp/openSUSE-Leap-15.5-Minimal-VM.x86_64-kvm-and-xen.qcow2 /var/lib/VMs/myopensuseleap.qcow2
We’ll be using ‘virt-install’, a command-line tool for provisioning VMs, and ‘virt-manager‘, a desktop user interface for managing virtual machines through libvirt.
Here’s how to install them on your local Linux distribution:
- CentOS and derivatives:
yum install virt-install virt-manager
- Debian and derivatives (including Ubuntu)
apt install virt-manager virtinst
- Arch Linux and derivatives
pacman -S virt-install virt-manager
- Gentoo:
emerge virt-manager
- OpenBSD:
pkg_add virt-manager
With ‘virt-install’ we will create a new VM using the image we just copied:
virt-install --import --memory 2048 \
--disk /var/lib/VMs/myopensuseleap.qcow2 \
--osinfo opensuse15.4 --noautoconsole \
--name myopensuseleap
After executing the command, you’ll see something like the following:
Starting install...
Creating domain... | 0 B 00:00:00
Domain creation completed.
Step 2: Configure the OS
At this stage, we will use virt-manager to proceed with the installation.
This image is set up to use the server profile, which means it doesn’t have a graphical user interface. On the first screen, we’ll be greeted with a welcome message:
Then, in subsequent screens we will be prompted to:
- Select the keyboard layout
- Agree to the license agreement
- Choose the timezone
- Set a password for the root user.
- Upon completing the installation our new VM will be ready and we will be prompted to login with a valid user.
Manual install
For the manual install, we will use VMware Player, a free to use software available for multiple OS that allows you to run and create virtual machines.
Step 1: Create a new VM
The first step is to create a new VM where we will install OpenSUSE Leap. Here is how:
- Open VMware Player and click on “Create a New Virtual Machine”.
- Select “Use ISO image:” and browse for the ISO file we downloaded.
- The next step is to select the guest operating system. Typically, VMware Player will detect that we’re using openSUSE.
- The system will then prompt us to name our VM and choose where we want to store the VM files.
- Select the size of the disk.
- Finally, we can review the settings before launching the VM. In this case, we’ll leave it as is.
We can see the complete sequence in the picture below:
Step 2: Install Leap
- Once the VM starts, you’ll see a screen asking you to choose one of the given options. Select ‘Installation‘.
- After selecting ‘Installation‘, openSUSE will begin the process of detecting your hardware and loading the installation components.
- Next, you’ll be presented with the License Agreement. Proceed by clicking on ‘Next‘.
- You may be prompted to enable online repositories. If so, do it, as this will allow your system to stay up-to-date with the latest updates and security patches.
- Then, you’ll be asked to select the repositories you want. Unless you have specific requirements, you can leave it with the default settings. However, if you prefer not to install non-open-source software (OSS), you can deselect the Non-OSS repositories.
- You’ll be prompted to select the system role for this VM. In this example, I have chosen ‘Generic Desktop‘ which provides a light and fast GUI, but depending on the purpose of the VM or your preferences, you may choose another nicer looking desktop or a system role without GUI like Server or Transactional Server.
- Next, you’ll be asked how to partition the disk. You can use the defaults, but for more flexibility or if you want to use disk encryption, please select ‘Guided Setup‘.
- Initially, you’ll be asked if you want to use LVM, which provides flexibility to resize and extend easily. You’ll also have the option to use disk encryption to protect your data from unauthorized copying.
- The second step in the ‘Guided Setup‘ is to select file system related options. In this case, we suggest a separate filesystem for home using XFS.
- After this it will go back to the original partitioning screen where we just need to click “Next”.
- Then, you’ll be asked to set the Clock and Time Zone. I recommend setting up NTP for automatic synchronization, to make sure this is selected please click on “Other Settings”.
- And verify “Synchronize with NTP Server” is enabled and an NTP server is selected.
- Next, you’ll be prompted to create a non-admin user. For security reasons, it’s recommended to limit the privileges of applications by not using and admin user to run them. For production environment installations, please avoid selecting the option ‘Use this password for system administrator‘.
- In the final step, you’ll be asked to review the settings you selected. Here, I recommend ensuring NetworkManager is enabled by clicking the ‘switch to NetworkManager‘ option highlighted in green at the bottom.
- Clicking ‘Install‘ will commence the installation process.
Remote access
Now that we have installed Leap, let’s enable remote access. This will allow us to execute automation and management tasks remotely.
In this step, an SSH key is necessary. If you don’t have one already, you can generate it with the following command:
ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519
If you’ve opted for a Desktop installation, press Ctrl+Alt+F2. This action will direct you to a terminal screen (you can revert back to the graphical interface by pressing Ctrl+Alt+F7) where we can see what IP is assigned to the server.
We will use this IP to establish a connection and copy our SSH key to it, allowing us to connect later without using a password.
Please execute the following command to install your SSH key, replacing “myIP” with your new VM IP:
ssh-copy-id myuser@myIP
This will return a message like this:
Next, let’s try to login using our key:
ssh 'myuser@192.168.178.132'
Once we’re logged in, let’s configure sudo rights for our user:
sudo sh -c "echo '$USER ALL=(ALL:ALL) NOPASSWD: ALL '>/etc/sudoers.d/automation"
You’ll be asked for the root password, which should match your user password, based on the settings from previous steps. After this, you can prepend any command with ‘sudo’ to execute it as an admin user (root).
Note that for production environments, it’s always recommended to use a dedicated user for automation and avoid NOPASSWD.
Conclusions
Installing openSUSE Leap in a virtualized environment is a seamless process, granting you access to the reliability and features of openSUSE Leap, whether for personal or professional use. By following the step-by-step guide outlined in this blog post, you can swiftly set up a VM loaded with openSUSE Leap, and start experiencing the benefits of this enterprise-grade open-source distribution. If you would like to get involved or meet other member of the community please feel free to attend one of our community events.
Making yourself familiar with the installation of openSUSE Leap in a virtualized environment should be one of your first steps in your migration journey.
If you’re looking for further insights into what you can achieve by migrating to SUSE and openSUSE, check out other blogs in this series:
Ready to experience the power and flexibility of openSUSE Leap?
Related Articles
May 08th, 2023
Just Before Sapphire – Your SUSE+AWS News Round Up for SAP
Oct 25th, 2024