Linux Tactic

Unlocking the Power of WSL: Installing and Configuring Debian with VNC

Introduction to WSL and Debian on WSL

Do you need to use command-line tools on Windows but don’t want to switch to Linux? Windows Subsystem for Linux (WSL) offers a solution that allows users to run Linux command-line programs on Windows 10.

In this article, we’ll explore the world of WSL and how to install it for Debian on your Windows machine.

Overview of WSL and WSL 2

WSL is a compatibility layer that runs Linux binary applications on your Windows desktop. It allows Windows users to run Linux distributions like Ubuntu, Debian, and Fedora alongside the Windows operating system (OS) without the need to dual-boot or run a virtual machine.

The latest version of WSL is WSL 2, which operates a real Linux kernel using Hyper-V technology. This technology makes WSL 2 faster and more compatible with the Linux user-space.

Operating with WSL 2 has been made easier than its predecessor with hardware features included.

Availability of Debian on WSL

Debian is one of the most popular Linux distributions and is also available on WSL. You can download Debian from the Microsoft Store for free.

Note that you cannot download Debian on WSL if you have an older version of Windows 10 (before 2019) because WSL 2 is only compatible with newer versions of the Windows OS.

Enabling and Installing Debian on WSL

Enabling WSL on Windows 10 with PowerShell

Before installing Debian on WSL, you need to enable WSL. This can be done using the PowerShell command prompt.

First, search for “PowerShell” in the Start menu. Right-click on the result and select “Run as administrator.” Then, execute the following command:

`dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart`

After you run this command, you need to restart your computer to complete the installation.

Installing Debian on WSL without a Microsoft account

To install Debian on WSL, search for “Microsoft Store” in the Start menu, and open it. Then, search for “Debian” and select the option for “Debian GNU/Linux.” Click on the “Get” button, and the installation process will begin.

If you do not have a Microsoft account, you can still install Debian; select the “Install” option and accept the license agreement.

Verifying Debian installation and upgrading to Debian 11

After installing Debian on WSL, you can verify whether it’s working correctly. Open the Start menu and search for “Debian.” Launch the Debian terminal, and a shell will open.

You will be asked to create a new username and password, then press “Enter.” Once you have entered the correct information, you should see the Debian welcome message.

If you are already using Debian on WSL and want to upgrade to Debian 11 “Bullseye,” you can use the Automated Package Tool, also known as APT.

Start the Debian shell and run the following commands:

“`

sudo apt update

sudo apt upgrade

sudo apt dist-upgrade

“`

APT will automatically update all the installed packages and system files to the latest version.

Conclusion

In conclusion, WSL is a great way to install and run Debian on your Windows-based computer, allowing you to use Linux command-line tools without any additional configurations or hardware. By following the steps outlined in this article, you can quickly enable WSL on Windows 10 and install Debian on it.

With WSL, you have the best of both worlds; Windows 10 and Debian “Bullseye” running at the same time!

Configuring GUI on Debian with VNC server

Graphical User Interface (GUI) is essential when it comes to running applications that can only be used through a graphical interface. If you’re using Debian on WSL and need a GUI, you can achieve it by configuring a Virtual Network Computing (VNC) server.

In this section, we’ll explain how to configure a GUI on Debian through VNC so you can have a better interactive experience with your computer.to VNC

VNC is a remote desktop protocol that enables you to access the desktop of a remote computer over a network. It works by transmitting the screen content of the remote computer over the network to the client.

The client computer then displays the content of the remote computer on its monitor. VNC is ideal for accessing remote desktops and running GUI applications on remote servers.

Prerequisites for configuring GUI using VNC

Before configuring a GUI using VNC, you need to ensure that you have the prerequisites installed on your Debian installation. These include:

– Tasksel, which is used to install different desktop environments on Debian.

– TigerVNC, which is the VNC server software we’ll use. – .NET Runtime, which is essential for systemd-genie to work on Debian.

– Systemd-genie, which enables the creation of an instance of X display. Installing components such as tasksel, TigerVNC, .NET Runtime, and systemd-genie

You can install these components by running the following commands on your Debian instance:

“`

sudo apt-get update

sudo apt-get install tasksel

sudo tasksel install gnome-desktop

sudo apt-get install tigervnc-standalone-server libvncserver-config

wget https://dot.net/v1/dotnet-install.sh

chmod +x dotnet-install.sh && ./dotnet-install.sh -c Current

wget https://github.com/arkane-systems/genie/releases/download/v1.36.1/systemd-genie_1.36.1_amd64.deb

sudo dpkg -i systemd-genie_1.36.1_amd64.deb

“`

Configuring VNC server password for current user, root, and GDM

After installing the required packages, you need to set up the VNC server password for the current user, root, and GDM. To do this, run the following commands on your Debian instance:

“`

vncpasswd

sudo bash -c “echo -e ‘nnpasswordnpasswordn’ |

vncpasswd /etc/

vncpasswd”

sudo bash -c “echo ‘/usr/bin/genie -s’ > /etc/X11/Xsession.d/98genie”

“`

Replace ‘password’ with a strong password of your choice.

Replacing default X by Xvnc and tweaking Xorg script for VNC

By default, Debian uses Xorg as the default X display. We need to replace it with Xvnc to use VNC.

To do this, run the following commands on your Debian instance:

“`

sudo apt-get install xvnc4viewer

sudo systemctl stop gdm

sudo systemctl disable gdm

sudo systemctl mask gdm

sudo sed -i ‘s/AllowedUsers .*/AllowedUsers=anybody/g’ /etc/X11/Xwrapper.config

sudo systemctl enable x11vnc

sudo cp /etc/X11/Xwrapper.config /etc/X11/Xwrapper.config.bak

sudo sed -i -e ‘s/^needs_root_rights=yes/needs_root_rights=no/’ /etc/X11/Xwrapper.config

“`

Tweaking environment variables for Xorg to read from the user executing genie command

You need to tweak some environment variables for Xorg to read from the user executing the genie command. To do this, run the following command:

“`

echo ‘export DISPLAY=:0’ >> ~/.bashrc

“`

Launching systemd-genie to start automatically and create an instance of X display

Finally, you need to launch systemd-genie to start automatically and create an instance of X display. To do this, run the following commands:

“`

sudo systemctl enable systemd-genie.service

systemctl –user enable x11vnc

sudo su -c ‘systemd-genie start’ user

“`

Replace ‘user’ with your Debian username.

Conclusion and Final Thoughts

Windows Subsystem for Linux (WSL) is an excellent tool for Windows users who need to run Linux-based applications that require a graphical interface. Configuring a GUI on Debian with VNC is a useful way to create a better interactive experience when using your computer.

In this article, we’ve explained how to install and configure the VNC server on Debian, and how to tweak your environment variables to allow Xorg to read from the user executing the genie command. This is the recommended method for configuring GUI on Debian with WSL.

In summary, WSL enables Windows users to use Linux command-line tools on their machines. Additionally, you can configure a GUI on Debian using VNC to create a better interactive experience.

We outlined a step-by-step approach to guide you on how to install and configure the VNC server on your Debian installation. We also highlighted the prerequisites you need, as well as how to set VNC passwords, replace default X with Xvnc, tweak environment variables, and launch systemd-genie.

The recommended method for configuring GUI on Debian with WSL is to use VNC. By following the steps outlined in this article, you can create a more comfortable environment for using your computer.

Popular Posts