linux windows wsl

openSUSE Linux on Windows 10 how to

Reading time of 1008 words
5 minutes
Reading time of 1008 words ~ 5 minutes


Did you find this article helpful?
Please consider tipping me a coffee as a thank you.
Ko-fi Buy Me a Coffee
Did you find this article helpful? Please consider tipping me a coffee or three as a thank you.
Tip using Ko-fi or Buy Me a Coffee

For the past year, Microsoft has been experimenting with the service known as WSL or Windows Subsystem for Linux. A setup that allowed you to run an Ubuntu terminal under Windows 10. These days since Windows 1709 (September 2017), WSL has come out of beta and is now available for general usage. This article will guide you through the steps to install, and setup openSUSE Leap 42 on your Windows install.

Requirements

  • Windows 10 64-bit.
  • Windows 10 version 1709 or newer.
  • A familiarity with the Linux Bash shell.

To see your Windows version type in about in the taskbar search box (Cortana) and select About your PC.

About your PC
Windows specificiations

Install

By using the Microsoft Windows Store, we will install openSUSE Leap 42. These instructions will automatically launch the Store app and take you to the openSUSE store page maintained by SUSE.

Copy and paste or open this link in the Microsoft Edge browser. https://www.microsoft.com/store/productId/9NJVJTS82TJX

Microsoft Store app

Click the blue Get button to download the 200 MB openSUSE package and install it without prompts.

Downloading

When finished click the Pin to Start to add openSUSE to your start menu.

When prompted give a new username and assign it a password. It will be your default openSUSE account name and is unrelated to your Windows account login.

Enter new UNIX username: ben
New password:
Retype new password:
Use same password for root user?
Type "y" to approve, any other key to reject: y

Default UNIX user set to: ben

Congratulations you now have a working copy of openSUSE Leap 42 on Windows 10.

Try the following terminal commands in your openSUSE prompt.

To see your openSUSE version:

$ cat /etc/os-release

NAME="openSUSE Leap"
VERSION="42.3"
ID=opensuse
ID_LIKE="suse"
VERSION_ID="42.3"

To see the Bash shell version:

$ bash --version

GNU bash, version 4.3.42(1)-release (x86_64-suse-linux-gnu)

To see the Python version:

$ python -V

Python 2.7.13

Update

The Windows Store handles all updates to the openSUSE app. But for programs within openSUSE, a separate Linux package management and updates service named zypper is used.

sudo zypper refresh
sudo zypper -n update

Interacting with Windows files

openSUSE can access both files stored in the Windows directory structure and even launch Windows programs. The subdirectories found within the /mnt directory represent your Windows drives.

$ ls /mnt

c

Directory c/ points to your Windows C: drive. This command will list the Windows program files directory.

ls '/mnt/c/Program Files/'

Don’t forget openSUSE supports autocompletion for both file and directory names with the tap of the Tab key.

In this instance, we create some text. But we’ll save it as a file to a Windows 10 directory and then use Windows Notepad to view it, all within openSUSE.

​​cd '/mnt/c/Users/Public/Downloads/'
echo 'Hello' > hi.txt
/mnt/c/Windows/System32/notepad.exe hi.txt
Notepad.exe

Close Notepad to regain use of openSUSE.

I recommend using symlinks to connect your Windows User directory to your openSUSE user account (called the home directory).

Go to your home directory and create a symlink.

cd ~
ln -sr /mnt/c/Users/Ben/Downloads ~/Downloads

Don’t forget to replace Ben in the path with your Windows user account directory name.

You can now list the content of your Downloads saved to your Windows account.

ls ~/Downloads

For documents.

ln -sr /mnt/c/Users/Ben/Documents ~/Documents
ls ~/Documents

Disable the terminal bell

One thing I find annoying is the Windows 10 terminal bell sound. As it’s often triggered after I tap the Tab key, but autocomplete has too many or no options. So I disable it.

sudo zypper -n install nano
​​​sudo nano ~/.inputrc

Find the this line.

#set bell-style none

And uncomment it.

set bell-style none

Save the text, exit Nano, then close the openSUSE app. Re-launch it, and it should remain silent.

Run a simple web server

In openSUSE, you can easily serve the current directory over the local web using Python. This command serves your home directory.

cd ~ && python -m SimpleHTTPServer

In a web browser you can visit http://localhost:8000 and browse the home directory. To quit the Python Simple HTTP Server tap Ctrl+C a couple of times while in openSUSE.

Serving HTTP on 0.0.0.0 port 8000 ...
^CTraceback (most recent call last):
...
KeyboardInterrupt

Create a Bash script

We will create a simple Bash script to run the zypper processes.

openSUSE has a few directories where you can create and store system-wide accessible scripts, but I keep them in /usr/local/bin.

cd /usr/local/bin
sudo nano upgrade.sh

Copy and paste the following script.

#!/usr/bin/env bash
# /usr/local/bin/upgrade.sh
# Refreshes the zypper repository applies any package upgrades.

sudo zypper refresh
sudo zypper -n update

Save then exit Nano and make the script executable.

sudo chmod +x upgrade.sh
sudo ln -s upgrade.sh upgrade

Now you can run the script from any location within the terminal, and those four apt commands should run in sequence.

$ cd ~
$ upgrade

Repository 'oss' is up to date.
Repository 'oss_update' is up to date.
All repositories have been refreshed.
Loading repository data...
Reading installed packages...

Nothing to do.

Install a simple web server

It’s straightforward to install and run a dedicated web server in openSUSE.

sudo zypper -n install lighttpd
sudo service lighttpd start

Type http://localhost/ into a web browser and you will receive a 403 – Forbidden HTTP error.

Lighttpd web content is stored in /srv/www/htdocs/ but it is empty so create a dummy index.html.

sudo nano /srv/www/htdocs/index.html

Paste in the following markup, save and exit.

<h1>Hello world!</h1>

Refresh the browser tab, and you should see a barebone Hello World! page.

localhost preview

Its configuration file can be viewed.

sudo nano /etc/lighttpd/lighttpd.conf

Its manual can be found at http://redmine.lighttpd.net/projects/lighttpd/wiki.

Note lighttpd will stop running when the openSUSE app is closed.

To remove lighttpd.

sudo zypper rm lighttpd

If you prefer, more popular web servers are available such as Apache HTTP and Nginx.

sudo zypper install apache2
sudo zypper install nginx

Complete

That is it for this guide. You can also install the Windows 10 Ubuntu app side-by-side with the openSUSE app. I wrote a similar guide to this under Ubuntu Linux on Windows 10 how to.

More resources

Written by Ben Garrett

Did you find this article helpful?
Please consider tipping me a coffee as a thank you.
Ko-fi Buy Me a Coffee
Did you find this article helpful? Please consider tipping me a coffee or three as a thank you.
Tip using Ko-fi or Buy Me a Coffee