How to run openSUSE Leap Linux on Hyper-V

I’ve written articles about using two popular Linux server distributions, Ubuntu and CentOS, on Hyper-V. Those distributions have large, strong communities, but truthfully, I chose them primarily because of my own familiarity. I decided that I should start branching out into other popular offerings. So, as you probably discovered from the title, this article will introduce openSUSE Leap on Hyper-V.

If you’ve been on the fence about incorporating Linux into your environment, then you have been waiting for this article.

About openSUSE and openSUSE Leap

The SUSE distribution family provides substantial offerings. openSUSE sits at the root. SUSE, who provides the impressive enterprise stack, builds upon openSUSE, not the other way around. I didn’t spend a great deal of time researching those enterprise products, but they are doing some good work, especially in the management space. All of those products include a price tag, however. I’m not opposed to a company turning a profit from its work, but I’m assuming that most of you are here because your price range hovers at “free”.

openSUSE can meet that price point. It also offers enterprise-grade quality. There are two branches of openSUSE. The first is Tumbleweed. Its name signifies its philosophy as a rolling release. Its products, components, and packages receive near-continuous updates. According to its blurb, it targets developers and desktop users that want cutting/bleeding edge technology.

Leap is the second openSUSE offering. It operates on the more familiar regulated release cycle. So, you won’t find the absolute latest packages in Leap, but you also won’t need to worry (as much) about breaking any third-party software that your organization relies upon.

Why openSUSE Leap?

Before we can decide between Tumbleweed and Leap, we must address a more pressing question: why choose openSUSE at all? As I’ve said before, I don’t feel strongly about any distribution. I know that some rigidly adhere to a specific distribution and they all have their reasons. I just want whatever gets the job done with minimal frustration.

I like Ubuntu, but I find its refusal to allow remote connection by the root account causes me more harm than good. sudo minimizes the issue for SSH, to be sure. However, I was recently tasked with some involved  work on Apache configuration files, which are root-owned. I really needed mouse-driven copy/paste functionality. None of my solutions were elegant and most caused me problems at one point or another. Also, I have some concerns about the long-term direction of the Ubuntu project. So, while I find the server edition of Ubuntu easy enough to use, it’s no longer my first choice.

I’ve been working with CentOS more ever since writing my article on it. It’s growing on me; I confess to having developed some level of fondness for it. However, it’s a bit slower on release cycles than I would like. It’s difficult to match the certainty that CentOS offers, though. If you’re mostly dealing with popular FOSS projects (such as a LAMP stack), then CentOS might not be your best choice. If your organization uses software provided by a third party and they prefer CentOS, then choose CentOS.

Now we arrive at openSUSE. I must say, they sort of had me at hello:

opensuse_hello

Truthfully, I was hooked by the management capabilities. As I started working with my first openSUSE system, I did what I knew from CentOS and Ubuntu. Things mostly worked, but I felt a little disappointed with the package management system. Specifically, I wasn’t entirely certain how to get it to remove unreferenced package dependencies. So, I did some searching, and was directed to a little gem called YAST:

opensuse_yast

YAST is a character-mode menu-based management system for openSUSE. If you’re not quite ready to jump from graphical Windows to command-line Linux, YAST can carry you over the divide.

Underneath all of that, openSUSE uses rpm. That means that you’ll be able to run many things on openSUSE that you could run on Red Hat’s derivations.

Why Leap instead of Tumbleweed?

Personally, I would choose Leap for my datacenter. Leap is more predictable, and in a sense more reliable. Since we’re installing under Hyper-V and don’t care about driver updates, Tumbleweed is a safer choice than it would be when directly installed on a hardware platform, but regular release cycles always make our vendors feel better. openSUSE’s Tumbleweed home page also talks about making the choice. My todo list contains an entry to fire up Tumbleweed on my Client Hyper-V installation, but I’m going to use Leap on my server platforms.

Downloading openSUSE Leap

Acquiring the software is your first step. I would start on the Leap homepage, as the download page will change with the version number. As the site exists today, a relatively large Install Leap button sits prominently in the center. Click it to go to the download page.

On the download page, you can choose between the full 4.7 gigabyte DVD package or a network-based install image. Unlike the other distributions that I’ve used, you can’t choose any sort of a minimal installer ISO. If you’re only going to be installing one or two instances or you have a really big Internet pipe and would rather not store bits, then the network installer will suit you fine. For me, I chose the full download. That’s what the following instructions use.

How to Build a Hyper-V Virtual Machine for openSUSE Leap

Like the other distributions, Leap does not demand many resources. I use the same build for Leap virtual machines that I do for Ubuntu Server and CentOS:

  • 2 vCPUs, no reservation. All modern operating systems work noticeably better when they can schedule two threads as opposed to one. You can turn it up later if you’re deployment needs more.
  • Dynamic Memory on; 512MB startup memory, 256MB minimum memory, 1GB maximum memory. You can always adjust Dynamic Memory’s maximum upward, even when the VM is active. Start low.
  • 40GB disk is probably much more than you’ll ever need. I use a dynamically expanding VHDX because there’s no reason not to. The published best practice is to create this with a forced 1 megabyte block size, which must be done in PowerShell. I didn’t do this on my first several Linux VMs and noticed that they do use several gigabytes more space, although still well under 10 apiece. I leave the choice to you.
  • I initially had troubles using Generation 2 VMs with Linux, but I’m having better luck recently. If you use Generation 2 with your Leap VMs on Hyper-V 2012 R2/8.1 or earlier, remember to disable Secure Boot. If using 2016, you can leave Secure Boot enabled as long as you select the “Microsoft Certification Authority”.
  • If your Hyper-V host is a member of a failover cluster and the Linux VM will be HA, use a static MAC address. Linux doesn’t respond well when its MAC addresses change.

The following is a sample script that you can use or modify to create a Linux virtual machine in Hyper-V:

#function New-LinuxVM {
	#requires -Modules Hyper-V
	[CmdletBinding(SupportsShouldProcess=$true)]
	param
	(
		[Parameter(Mandatory=$true, Position=1)][String]$VMName,
		[Parameter()][String]$VHDXName = '',
		[Parameter()][String]$VMStoragePath = '',
		[Parameter()][String]$VHDStoragePath = '',
		[Parameter()][String]$InstallISOPath = '',
		[Parameter()][Switch]$Cluster,
		[Parameter()][String]$VMSwitchName = '',
		[Parameter()][Uint32]$StartupMemory = 512MB,
		[Parameter()][Uint32]$MinimumMemory = 256MB,
		[Parameter()][Uint32]$MaximumMemory = 1GB,
		[Parameter()][Uint32]$VHDXSizeBytes = 40GB
	)

	if([String]::IsNullOrEmpty($VHDXName))
	{
		$VHDXName = '{0}.vhdx' -f $VMName
	}
	if($VHDXName -notmatch '.vhdx$')
	{
		$VHDXName += '.vhdx'
	}
	if([String]::IsNullOrEmpty($VMStoragePath))
	{
		$VMStoragePath = (Get-VMHost).VirtualMachinePath
	}
	if(-not (Test-Path -Path $VMStoragePath))
	{
		Write-Error -Message ('VM path {0} does not exist.' -f $VMStoragePath)
		return
	}
	if([String]::IsNullOrEmpty($VHDStoragePath))
	{
		$VHDStoragePath = (Get-VMHost).VirtualHardDiskPath
	}
	if(-not (Test-Path -Path $VHDStoragePath))
	{
		Write-Error -Message ('Storage path {0} does not exist.' -f $VHDStoragePath)
		return
	}
	$VHDStoragePath = Join-Path -Path $VHDStoragePath -ChildPath $VHDXName
	if([String]::IsNullOrEmpty($InstallISOPath) -or -not (Test-Path -Path $InstallISOPath -PathType Leaf))
	{
		Write-Error -Message ('ISO {0} does not exist' -f $InstallISOPath)
		return
	}
	if([String]::IsNullOrEmpty($VMSwitchName))
	{
		$VMSwitchName = (Get-VMSwitch | ? SwitchType -eq 'External')[0].Name
	}
	if([String]::IsNullOrEmpty($VMSwitchName))
	{
		Write-Error -Message ('No virtual switch specified')
		return
	}

	$VM = New-VM -Name $VMName -MemoryStartupBytes $StartupMemory -SwitchName $VMSwitchName -Path $VMStoragePath -Generation 2 -NoVHD
	Set-VMMemory -VM $VM -DynamicMemoryEnabled $true -MinimumBytes $MinimumMemory -MaximumBytes $MaximumMemory
	Set-VMProcessor -VM $VM -Count 2
	Start-VM -VM $VM
	Stop-VM -VM $VM -Force
	New-VHD -Path $VHDStoragePath -SizeBytes $VHDXSizeBytes -Dynamic -BlockSizeBytes 1MB
	$VMVHD = Add-VMHardDiskDrive -VM $VM -ControllerType SCSI -ControllerNumber 0 -ControllerLocation 0 -Path $VHDStoragePath -Passthru
	$VMDVDDrive = Add-VMDvdDrive -VM $VM -ControllerNumber 0 -ControllerLocation 1 -Passthru
	$VMNetAdapter = Get-VMNetworkAdapter -VM $VM
	Set-VMNetworkAdapter -VMNetworkAdapter $VMNetAdapter -StaticMacAddress ($VMNetAdapter.MacAddress)
	Set-VMFirmware -VM $VM -BootOrder $VMDVDDrive, $VMVHD, $VMNetAdapter -EnableSecureBoot On -SecureBootTemplate 'MicrosoftUEFICertificateAuthority'
	Set-VMDvdDrive -VMDvdDrive $VMDVDDrive -Path $InstallISOPath
	if($Cluster)
	{
		Add-ClusterVirtualMachineRole -VMName $VMName
	}
#}

Note: I have been using a 1 megabyte block size (instead of the default 32MB) for all Linux virtual machines since I learned about the dramatic difference it made for Ubuntu systems (which use the ext4 file system by default). A reader pointed out on my CentOS article that it didn’t seem to matter for that distribution. My untested assumption is that the xfs file system that CentOS made the difference. Leap uses btrfs by default. I have not tested larger block sizes with that file system, either.

Installing openSUSE Leap on Hyper-V

If you followed the script above, then you have a virtual machine with the installation ISO attached. Otherwise, you’ll need to create your own VM and manually attach the ISO. However you get there, start up your new virtual machine with the ISO mounted and its virtual DVD drive selected as the primary boot device.

openSUSE’s installer is polished and smooth. I’d say its presentation shames all other Linux distributions that I’ve tried. However, it has many steps; more than I feel are necessary to install an operating system.

My VM (on Server 2016) uses Secure Boot. If yours is the same, then you can choose Yes at the initial screen requesting openSUSE certificate validation:

opensuse_install1

Choose Installation to get started:

opensuse_install2

The installation begins with a fairly strange combination of items: the EULA acceptance screen includes your language and keyboard selection. In my case, that all worked out, but if you want something other than the defaults, take care not to click through this screen too quickly:

opensuse_install3

Once you accept the EULA, the installer will scan your system and perform some preloading. Just click Next once that completes.

opensuse_install4

If you want to add non-default software repositories and packages during the install phase, you have that option here. I tend to stick with the same OS install philosophy that I’ve held since Windows 95: do the dead minimum necessary to install the OS. It’s easier to build on a successful minimal installation than it is to fix a complicated broken installation. I recommend that you leave these checkboxes empty and click Next.

opensuse_install5

This screen looks scary, but don’t worry. It’s just showing you how it wants to use the disk. Each line shows a step in that process. Many of those lines deal with “subvolumes”, which are a feature of the btrfs file system. Essentially, the system can perform targeted snapshots of each subvolume. So, if you have a mariadb installation that places its data files into /var/lib/mariadb, then you can instruct the system to snapshot that location if you have a use for that. You might be thinking, “But I’ll never use mariadb on this system!” In that case, you can do nothing; the subvolume will just exist, not doing anything or consuming any space. Alternatively, you can click the Edit Proposal Settings button to make any changes as you see fit. I simply take the defaults, myself.

opensuse_install6

Next you’ll select your time zone. If you have special circumstances, use the Other Settings button to explore related options.

opensuse_install7

Your effort so far is rewarded with another fun EULA, this time for the main openSUSE repository. Yay.

opensuse_install8

Now, choose your operating environment. I only install server mode. I don’t know what the current graphical requirements are for either KDE or Gnome and how well a Hyper-V virtual machine can suit them. I’d like to explore those options, but not today.

opensuse_install9

Create your personal administrative user account. I did test the Import User Data from a Previous Installation with a CentOS install, and it works perfectly well. It does not retain the old installation itself; it merely transfers information.

opensuse_install10

This screen looks like a simple summary page, but it needs some serious attention. Don’t just happily click Install. First, click enable next to SSH service will be disabled. Doing so ensures that you can remotely manage the system. You can enable SSH later if you miss it. For the second part, click System and Hardware Settings. Instructions follow this screenshot.

opensuse_install11

Clicking System and Hardware Settings brings you to the Detected Hardware screen. At the bottom of this screen, click the Kernel Settings button. Instructions follow this screenshot.

opensuse_install11.1

You should now see the Kernel Settings screen. Switch to the Kernel Settings tab. Under Global I/O Scheduler, select NOOP [noop]. Click OK on this screen and the previous screen and you will be returned to the summary page. Now you can click Install.

opensuse_install11.2

Your work is complete. You can relax while openSUSE installs. You can also flip through the tabs to view Details and the release notes, if you’d like. Once installation finishes, reboot into your new openSUSE install.

opensuse_install12

openSUSE Post-Install Wrap-up for Hyper-V

I’ve added this section because it appears on my Ubuntu and CentOS posts. openSUSE installs all of the Hyper-V tools right out of the box and you selected the I/O scheduler during install, so there’s really nothing left to prepare. If you’re already familiar with Linux, I have nothing else for you. If you forgot to enable SSH or change the scheduler, I’ll use them as examples when I demonstrate YAST later in this article.

Before moving along, I recommend that you double-check Microsoft’s page regarding Hyper-V support for SUSE. There wasn’t anything to do the last time that I looked, but the page might change and/or you might find some interesting data on the feature charts. At the very bottom of that page, you can find a link to Microsoft’s best practices for Linux on Hyper-V, which might also contain interesting information for you.

10 Tips for Getting Started with openSUSE Leap Linux on Hyper-V

This section is for those with Windows backgrounds. If you already know Linux, you probably won’t get anything out of this section. I will write it from the perspective of a seasoned Windows user. Nothing here should be taken as a slight against Linux.

1. Text Acts Very Differently

Above all, remember this: Linux is CaSE-SENsiTiVe.

  • yast and Yastare two different things. The first is a command. The second is a mistake.
  • File and directory names must always be typed exactly.

Password fields do not echo anything to the screen.

2. Things Go the Wrong Way

In Windows, you’re used to C: drives and D: drives and SMB shares that start with \.

In Linux, everything begins with the root, which is just a single /. Absolutely everything hangs off of the root in some fashion. You don’t have a D: drive. Starting from /, you have a dev location, and drives are mounted there. For the SATA virtual drives in your Hyper-V machine, they’ll all be sda, sdb, sdc, etc. Partitions will then be numbered. So, /dev/sda2 would be the equivalent to your Windows D: drive if it’s the second partition on the first virtual drive.

Directory separators are slashes (/) not backslashes (). A directory that you’ll become familiar with is usr. It lives at /usr.

Moving around the file system should be familiar, as the Windows command line uses similar commands. Linux typically uses ls where Windows uses dir, but CentOS accepts dir. cd and mkdir work as they do on Windows. Use rm to delete things. Use cp to copy things. Use mv to move things.

Running an executable in the folder that you currently occupy by just typing its name does not work. PowerShell behaves the same way, so that may not be strange to you. Use dot and slash to run a script or binary in the same folder:

./scriptfile

Linux doesn’t use file extensions. Instead, it uses attributes. So, if you create the equivalent of a batch file and then try to execute it, Linux won’t have any idea what you want to do. You need to mark it as executable first. Do so like this:

chmod +x ./thatscriptfileyouwanttouse

As you might expect, -x removes the executable attribute.

The default Linux shell does have tab completion, but it’s not the same as what you find on Windows. It will only work for files and directories, for starters. Second, it doesn’t cycle through possibilities the way that PowerShell does. The first tab press works if there is only one way for the completion to work. A second tab press will show you all possible options. You can use other shells with more power than the default, although I’ve never done it.

3. Quick Help is Available

Most commands and applications have a h and/or a help parameter that will give you some information on running them. –help is often more detailed than -h. You can sometimes type man commandname to get other help (“man” is short for “manual”). It’s not as consistent as PowerShell help, but then PowerShell’s designers got to work with the benefits of hindsight and rigidly controlled design and distribution.

4. You Can Go Home

You’ve got your own home folder, which is the rough equivalent of the “My Documents” folder in Windows. It’s at the universal alias ~. So, cd ~ takes you to your home folder. You can reference files in it with ~/filename.

5. Boss Mode

“root” is the equivalent of “Administrator” on Windows. But, the account you made has nearly the same powers — although not exactly on demand. You won’t have root powers until you specifically ask for them with “sudo”. It’s sort of like “Run as administrator” in Windows, but a lot easier. In fact, the first time you use sudo, the intro text tells you a little bit about it:

opensuse_firstsudo

So basically, if you’re going to do something that needs admin powers, you just type “sudo” before the command, just like it says. The first time, it will ask for a password. It will remember it for a while after that. However, 99% of what I do is administrative stuff, so I pop myself into a sudo session that persists until I exit, like this:

sudo -s

You’ll have to enter your password once, and then you’ll be in sudo mode. You can tell that you’re in sudo mode because the dollar sign in te prompt will change to a hash sign:

centos_sudos

I only use Linux for administrative work, so I commonly switch use sudo -s. However, I always log in with my “Eric” account. Remember that even when it’s not in sudo mode, it’s still respected as an admin-level account. If you will be using a Linux system as your primary (i.e., you’ll be logged in often), create a non-administrative account to use. You can flip to your admin account or root anytime:

su eric

Always respect the power of these accounts.

6. “Exit” Means Never Having to Say Goodbye

People accustomed to GUIs with big red Xs sometimes struggle with character mode environments. “exit” works to end any session. If you’re layered in, as in with sudo or su, you may need to type “exit” a few times. “logout” works in most, but not all contexts.

7. Single-Session is for Wimps

One of the really nifty things about Linux is multiple concurrent sessions. When you first connect, you’re in terminal 1 (tty1). Press [Alt]+[Right Arrow]. Now you’re in tty2! Keep going. 6 wraps back around to 1. [Alt]+[Left Arrow] goes the other way.

You need to be logged in to determine which terminal you’re viewing. Just type tty.

8. Patches, Updates, and Installations, Oh My.

Pretty much all applications and OS components are “packages”. “yast”, “zypper”, and “rpm” are your package managers. yast and zypper work together, but they’re a bit disjointed from rpm. Until you get some experience, I would recommend using yast. I have an upcoming section that deals with yast, so I’ll save major package management for that part.

I think my favorite tool on openSUSE is cnf. This nifty tool, which is an acronym for “command not found”, will hunt down the package that contains a command that you want to use. So, let’s say that I’m trying to perform some DNS lookups but nslookup won’t run. I first try to use zypper to install nslookup, but there’s no such package. So, I just use cnf nslookup. In my particular case, I really do have the proper package installed, but it tells me what package it’s in anyway:

opensuse_cnfIf I didn’t have it, I could use zypper to install it:

sudo zypper install bind-utils

To locate, download, and install updates for packages on your system:

sudo zypper update

If you want patches:

sudo zypper patch

I’m not entirely clear on the distinction between patches and updates; items appear in each that do not appear in the other. My assumption would be that patches would keep your software within the same version where updates would include version updates, but my simple perusal doesn’t seem to support that. If you want everything, I would use update first, then patch.

You can remove packages with remove (take care to use the -u switch every time!):

sudo zypper remove bind-utils -u

zypper does not appear to include an autoremove option like apt and yum. I recommend using YAST for package management. If you want to use zypper, take care to always use -u when removing software.

List all available packages:

sudo zypper search | less

Search for one or more packages by name:

sudo zypper search python | less

Use zypper by itself to see all available options.

9. System Control

Linux’s equivalent to Task Manager is top. Type top at a command prompt and you’ll be taken right to it. Use the up and down arrows and page up and page down to move through the list. Type a question mark [?] to be taken to the help menu that will show you what else you can do. Type [Q] to quit.

10. OK, I’m Done Now

If you’ve used the shutdown command in Windows, then you’ll have little trouble transitioning to Linux. shutdown tells Linux to shut down gracefully with a 1 minute timer. All active sessions get a banner telling them what’s coming.

Immediate shutdown (my favorite):

shutdown now

You can use -r to reboot, if you like:

shutdown -r now

There’s also an -H switch, which I take to mean “halt the system immediately without waiting for anything to shut down”. I don’t use that.

There’s also a convenient reboot command, if you don’t want to use shutdown. It’s very simple:

reboot

Useful Tools for openSUSE Leap

Manipulating your Leap environment from the VMConnect console will get tiring quickly. Here are some tools to make managing it much easier.

YAST

YAST (Yet Another Setup Tool) alone makes openSUSE stand above most other distributions when it comes to ease of management. Since you’re installing in a Hyper-V virtual machine, you’ll want to work with it remotely. Make sure to take a peek at the upcoming PuTTY instructions to optimize your experience (by that, I mean that YAST looks terrible under PuTTY defaults).

Get comfortable with your keyboard. You might be tempted to use your mouse in YAST — no dice. If you look at the sections and menu headings, they’ll have one letter that’s a different color from the rest. Use [Alt] with that key to jump to that section or function. For instance, [Alt]+[C] will cancel most screens and return to the previous. [Alt]+[A] usually accepts any changes (like an OK button). [Tab] cycles through sections.

Also, be patient. YAST is not terribly fast. If you have a list with many items, don’t hold your arrow key down. You’ll regret it.

Always start yast as root:

sudo yast

Let’s look at a few common YAST functions.

YAST Software Management

YAST loads up to its Software page. [Tab] or right arrow to jump to the other side, where you can run an online update. Arrow down to Software Management and press [Enter] to work with software packages.

If you hit [Enter], every package state in every known repository will be listed. Expect that to take a very long time and be more or less unmanageable. Rather than that, press [Alt]+[P] to jump to the Search Phrase box and enter something to look for. As an example, I’ll search for “apache”, which will load entries related to the Apache web server (and other Apache projects). Pressing [Enter] from the Search Phrase box will retrieve all matches, enter them into the list box on the right, and switch input focus to that screen. From there, you can use the up and down arrow keys to scroll the list:

opensuse_yast_apache_sw

An item with “i” beside it is currently installed. Items with a + will be installed once you use [Alt]+[A] or [F10]. Items with a – will be removed. Use the spacebar to move through all possible actions. You can also press [Alt]+[T] to expand the actions sub-dialog. That will show you the options; pressing [Enter] on one will apply it to the currently selected item. Use [ESC] to close it, then [Shift]+[Tab] to switch back to the list. You can go back to the Search Phrase block and get new items without disturbing any selections that you’ve already made, so you can get all necessary packages in a single visit.

If you don’t have nano and/or the openssh packages on your system already, use this time to practice locating and installing packages.

YAST will automatically take care of dependencies for you. I prefer zypper when installing many packages at once so that I don’t have to hunt through several lists. However, I recommend that you use yast for all of your package removal management activities. It will ensure that you won’t wind up with orphaned dependencies.

Use yast to Change Kernel Settings

Did you forget to change the I/O scheduler to NOOP during install? No problem.

  1. From the main page of yast, arrow down to System on the left, then [Tab] or right arrow to the system submenu.
  2. Arrow down to Kernel Settings and press [Enter].
  3. Press [Alt]+[K] to switch to the Kernel Settings tab.
  4. Press [Alt]+[I] to open the scheduler options list. Arrow down to NOOP [noop] and press [Enter].
    opensuse_noop
  5. Press [Alt]+[O] to apply the changes. You’ll be automatically returned to the main menu.

Use yast to Set Host Name and IP

My openSUSE system picked up some random name that got lodged in my DHCP server; I think it was for my Kindle. Whatever you got, you’d probably like to change it. If you’re going to assign a static IP, you’ll go to nearly the same place.

  1. From the yast main screen, arrow down to System, then press [Tab] or right arrow to move to the system submenu.
  2. Arrow down to Network Settings and press [Enter].
  3. [Alt]+[C] if prompted to install SuSEfirewall (unless you want the firewall, which I won’t cover)
  4. You will start on the Overview. If you want to set the IP addresss:
    1. [Tab] down to the desired adapter and press [Alt]+[I] to edit (IP address)
    2. Press [Alt]+[T] to change to Static assignment. [Tab] to enter data into the relevant fields.opensuse_yast_ip
    3. Press [Alt]+[N] to accept the assignment and return to the Overview.
  5. To change the host name:
    1. [Tab] to select the menu row and then right arrow to Hostname/DNS,or just press [Alt]+[S].
    2. [Tab] through fields, entering data as necessary; change Set Hostname via DHCP to No. If items are set via DHCP (like the DNS servers), then you don’t need to enter them.
      opensuse_yast_hostname
    3. [F10] or [Alt]+[O] to accept.
  6. To change the system’s default gateway (unless delivered via DHCP):
    1. [Tab] to the menu bar or press [Alt]+[U] to jump to the Routing tab.
    2. [Tab] or hotkey through the fields. Enter IPv4/IPv6 default gateway(s) as necessary. If you have additional routing requirements, use the Add, Edit, and Delete functions as appropriate.
      opensuse_yast_routing
    3. [F10] or [Alt]+[O] to accept.

YAST has many more features than I have energy to describe. Explore!

Text Editors

My preferred character mode is nano. Just type nano at any prompt and press [Enter] and you’ll be in the nano screen. The toolbar at the bottom shows you what key presses are necessary to do things, ex: [CTRL]+[X] to exit. Don’t forget to start it with sudo if you need to change protected files.

The remote text editing tool that I use from my Windows desktop is Notepad++. You can use it alongside WinSCP (shown in a bit) for more reliable operations, but it can connect to a Linux machine on its own. It is a little flaky — I sometimes get Access Denied errors with it that I don’t get in any other remote tool (setting it to Active mode seems to help a little). But, the price is hard to beat. If I run into real problems, I run things through my home folder. To connect Notepad++ to your host:

  1. In NPP, go to Plugins->NppFTP->Show NppFTP Window (only click if it’s not checked):
    NPP FTP Window Selector

    NPP FTP Window Selector

     

  2. The NppFTP window pane will appear at the far right. Click the icon that looks like a gear (which is, unfortunately, gray in color so it always looks disabled), then click Profile Settings:NPP FTP Profile Item
  3. In the Profile Settings window, click the Add New button. This will give you a small window where you can provide the name of the profile you’re creating. I normally use the name of the system.
    Add FTP Profile
  4. All the controls will now be activated.
    1. In the Hostname field, enter the DNS name or the IP address of the system you’re connecting to (if you’re reading straight through, you might not know this yet).
    2. Change the Connection type to SFTP.
    3. If you want, save the user name and password. I don’t know how secure this is. I usually enter my name and check Ask for password. If you don’t check that and don’t enter a password, it will assume a blank password.
      NPP FTP Profile

      NPP FTP Profile

       

  5. You can continue adding others or changing anything you like (I suggest going to the Transfers tab and setting the mode to Active). Click Close when ready.
  6. To connect, click the Connect icon which will now be blue-ish. It will have a drop-down list where you can choose the profile to connect to.NPP FTP Connect
  7. On your first connection, you’ll have to accept the host’s key:NPP Host Key
  8. If the connection is successful, you’ll attach to your home folder on the remote system. Double-clicking an item will attempt to load it. Using the save commands in NPP will save back to the Linux system directly.NPP FTP Directory

Remember that NPP is a Windows app, and as a Windows app, it wants to save files in Windows format (I know, weird, right?). Windows expects that files encoded in human-readable formats will end lines using a carriage-return character and a linefeed character (CRLF, commonly seen escaped as rn). Linux only uses the linefeed character (LF, commonly seen escaped as n). Some things in Linux will choke if they encounter a carriage return. Any time you’re using NPP to edit a Linux file, go to Edit -> EOL Conversion -> UNIX/OSX Format.

NPP EOL Conversion

NPP EOL Conversion

 

WinSCP

WinSCP allows you to move files back and forth between your Windows machine and a Linux system. It doesn’t have the weird permissions barriers that Notepad++ struggles with, but it also doesn’t have its editing powers.

  1. Download and install WinSCP. I prefer the Commander view but do as you like.
  2. In the Login dialog, highlight New Site and fill in the host’s information (while not shown here, I recommend that you change the File protocol to SCP):WinSCP Profiles
  3. Click Save to keep the profile. It will present a small dialog asking you to customize how it’s saved. You can change the name or create folders or whatever you like.
  4. With the host entry highlighted, click Login. You’ll be prompted with a key on first connect:WinSCP Key
  5. Upon clicking Yes, you’ll be connected to the home folder. If you get a prompt that it’s listening on FTP, something went awry because the install process we followed does not include FTP. Check the information that you plugged in and try the connection again.
  6. WinSCP integrates with the taskbar for quick launching:WinSCP Taskbar
  7. Right-click on any remote file and hover over Edit. Then click Configure. Use the Add button to add your own editors (like Notepad++). Whatever item appears on top will be used whenever you double-click an object. I would be wary of any editor that doesn’t understand UNIX EOLs:
    opensuse_add_winscp_editor

 

PuTTY

The biggest tool in your Linux-controlling arsenal will be PuTTY. This gem is an SSH client for Windows. SSH (secure shell) is how you remote control Linux systems. Use it instead of Hyper-V’s virtual machine connection. You can use it from just about anywhere and, even better, you can scroll the output window. At its core, SSH is really just a remote console. PuTTY, however, adds functionality on top of that. It can keep sessions and it gives you dead-simple copy/paste functionality. Highlight text, and it’s copied. Right-click the window, and it’s pasted at the cursor location.

  1. Download PuTTY. I use the installer package myself, but do as you like.
  2. Type in the host name or IP address in that field.PuTTY Profiles
  3. If you’ll be using YAST in SSH, change to the Data tab under the Connection section. In Terminal-type string, change the current setting to linux. Change back to the Session tab before proceeding.
    opensuse_putty_for_yast
  4. PuTTY doesn’t let you save credentials. But, you can save the session. Type a name for it in the Saved Sessions field and then click Save to add it to the list. Clicking Load on an item, or double-clicking it, will populate the connection field with the saved details.
  5. Click Open when ready. On the first connection, you’ll have to accept the host key:PuTTY Key
  6. You’ll then have to enter your login name and password. Then you’ll be brought to the same type of screen that you saw in the console.
  7. Right-click the title bar of PuTTY for a powerful menu. The menu items change based on the session status. I have restarted the operating system for the screenshot below so that you can see the Restart Session item. This allows you to quickly reconnect to a system that you dropped from… say, because you restarted it.PuTTY Menu
  8. PuTTY also has taskbar integration:PuTTY Taskbar
  9. When you’re all done, remember to use “exit” to end your session.

Your Journey Has Begun

From here, I leave you to explore your fresh new Linux environment. I’ll be back soon with an article on installing Nagios in openSUSE Leap so you can monitor your Hyper-V environment at no cost.

Altaro Hyper-V Backup
Share this post

Not a DOJO Member yet?

Join thousands of other IT pros and receive a weekly roundup email with the latest content & updates!

18 thoughts on "How to run openSUSE Leap Linux on Hyper-V"

  • John Leonard says:

    Thanks, plenty to learn. My machine is just running windows 10 pro 2004. Any issues with latest version summer 2020? Is hyper-v sufficient for that on up to date win 10 pro? I am not sure it is at the moment more like their instructions so far are more dual boot, or are they just assuming working with Hyper-V instructions is a known matter, not needing much comment. I have retired and I more involved with data, and then admin / customer policies for future service in the last 5 years of my service.

Leave a comment or ask a question

Your email address will not be published. Required fields are marked *

Your email address will not be published.

Notify me of follow-up replies via email

Yes, I would like to receive new blog posts by email

What is the color of grass?

Please note: If you’re not already a member on the Dojo Forums you will create a new account and receive an activation email.