{"id":1712,"date":"2022-03-09T23:59:15","date_gmt":"2022-03-09T22:59:15","guid":{"rendered":"https:\/\/nguenkam.com\/blog\/?p=1712"},"modified":"2022-03-27T00:19:14","modified_gmt":"2022-03-26T23:19:14","slug":"how-to-install-debian-on-windows-wsl","status":"publish","type":"post","link":"https:\/\/nguenkam.com\/blog\/index.php\/2022\/03\/09\/how-to-install-debian-on-windows-wsl\/","title":{"rendered":"How to Install Debian on Windows WSL"},"content":{"rendered":"\n<p>Back in 2017, Windows released Windows Subsystem for Linux that lets developers run a GNU\/Linux environment, including most command-line tools, utilities, and applications directly in Windows without setting up a virtual machine or dual-boot.<\/p>\n\n\n\n<p>WSL2 has since been released, and it\u2019s an improvement over version 1. The new and improved version comes with performance boost, full system call compatibility, and built with a new architecture and that delivers features that make WSL an amazing way to run a Linux environment in Windows.<\/p>\n\n\n\n<p>To install WSL 2 on Windows 10, these two requirements must be met:<\/p>\n\n\n\n<ul><li>Windows 10 May 2020 (2004), Windows 10 May 2019 (1903), or Windows 10 November 2019 (1909) or later<\/li><li>A computer with Hyper-V Virtualization support<\/li><\/ul>\n\n\n\n<p>Since you can now install Linux systems, including Debian directly in Windows, let\u2019s go ahead and install Debian. Before you can do that, you must first enable WSL or WSL2 in Windows.<\/p>\n\n\n\n<div style=\"height:100px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h4>Enable WSL in Windows<\/h4>\n\n\n\n<p>To enable WSL in Windows, you will want to open&nbsp;<strong>PowerShell<\/strong>&nbsp;terminal as administrator. Click on Start then begin typing&nbsp;<strong>PowerShell<\/strong>.<\/p>\n\n\n\n<p>Next, right-click&nbsp;<strong>Windows PowerShell<\/strong>&nbsp;app and choose to run as administrator.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" src=\"https:\/\/nguenkam.com\/blog\/wp-content\/uploads\/2022\/03\/image.png\" alt=\"\" class=\"wp-image-1713\" width=\"447\" height=\"225\" srcset=\"https:\/\/nguenkam.com\/blog\/wp-content\/uploads\/2022\/03\/image.png 791w, https:\/\/nguenkam.com\/blog\/wp-content\/uploads\/2022\/03\/image-300x151.png 300w, https:\/\/nguenkam.com\/blog\/wp-content\/uploads\/2022\/03\/image-768x386.png 768w\" sizes=\"(max-width: 447px) 100vw, 447px\" \/><\/figure>\n\n\n\n<p>When the console opens, run the commands below:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>dism.exe \/online \/enable-feature \/featurename:Microsoft-Windows-Subsystem-Linux \/all \/norestart\n<\/code><\/pre>\n\n\n\n<p>After installing, you should get a success message similar to the lines below:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Deployment Image Servicing and Management tool\nVersion: 10.0.19041.844\n\nImage Version: 10.0.19042.844\n\nEnabling feature(s)\n&#91;==========================100.0%==========================]\nThe operation completed successfully.<\/code><\/pre>\n\n\n\n<div style=\"height:100px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h4>Enable Virtual Machine Platform<\/h4>\n\n\n\n<p>WSL 2 requires Windows 10 Virtual Machine Platform to be enabled. This is not Hyper-V. To enable the VM platform feature in Windows, run the commands below from the same PowerShell administrator\u2019s console.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>dism.exe \/online \/enable-feature \/featurename:VirtualMachinePlatform \/all \/norestart\n<\/code><\/pre>\n\n\n\n<p>If you\u2019re using Windows 10 version lower than&nbsp;<strong>2004<\/strong>, then use the commands below:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform -NoRestart\n<\/code><\/pre>\n\n\n\n<p>When you\u2019re done running the commands above,&nbsp;<strong>restart your computer for all the configuration changes to apply<\/strong>. If you don\u2019t restart, the below command might not be recognized.<\/p>\n\n\n\n<p>After restarting your computer, login back in and launch&nbsp;<strong>PowerShell<\/strong>&nbsp;as administrator. Then run the commands below to configure WSL 2 as the default version of WSL.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>wsl --set-default-version 2<\/code><\/pre>\n\n\n\n<p><em><strong>PS: <\/strong>If you get an error about not having Linux kernel installed, get it from the link below and run it in Windows, then try the command above again.<\/em><\/p>\n\n\n\n<p><a href=\"https:\/\/wslstorestorage.blob.core.windows.net\/wslblob\/wsl_update_x64.msi\">https:\/\/wslstorestorage.blob.core.windows.net\/wslblob\/wsl_update_x64.msi<\/a><\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" src=\"https:\/\/nguenkam.com\/blog\/wp-content\/uploads\/2022\/03\/image-1.png\" alt=\"\" class=\"wp-image-1714\" width=\"391\" height=\"304\" srcset=\"https:\/\/nguenkam.com\/blog\/wp-content\/uploads\/2022\/03\/image-1.png 583w, https:\/\/nguenkam.com\/blog\/wp-content\/uploads\/2022\/03\/image-1-300x233.png 300w\" sizes=\"(max-width: 391px) 100vw, 391px\" \/><\/figure>\n\n\n\n<div style=\"height:100px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h4>Install Debian in Windows 10<\/h4>\n\n\n\n<p>Now that WSL 2 is installed and ready to be used, open the link below to download and install a copy of Debian from Windows store.<\/p>\n\n\n\n<ul><li><a rel=\"noreferrer noopener\" href=\"https:\/\/www.microsoft.com\/en-us\/p\/debian\/9msvkqc78pk6?activetab=pivot:overviewtab\" target=\"_blank\">Get Debian \u2013 Microsoft Store<\/a><\/li><\/ul>\n\n\n\n<p>Debian on Windows allows you to use Debian Terminal and run Debian command line utilities including bash, ssh, git, apt and many more.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" src=\"https:\/\/nguenkam.com\/blog\/wp-content\/uploads\/2022\/03\/image-2.png\" alt=\"\" class=\"wp-image-1715\" width=\"660\" height=\"423\" srcset=\"https:\/\/nguenkam.com\/blog\/wp-content\/uploads\/2022\/03\/image-2.png 818w, https:\/\/nguenkam.com\/blog\/wp-content\/uploads\/2022\/03\/image-2-300x192.png 300w, https:\/\/nguenkam.com\/blog\/wp-content\/uploads\/2022\/03\/image-2-768x492.png 768w\" sizes=\"(max-width: 660px) 100vw, 660px\" \/><\/figure>\n\n\n\n<p>Click the<strong>&nbsp;Get button<\/strong>&nbsp;and install. After installing Debian, you\u2019ll want the option to launch Debian from Windows WSL environment.<\/p>\n\n\n\n<p>After downloading and installing, you will get a&nbsp;<strong>Launch<\/strong>&nbsp;button.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" src=\"https:\/\/nguenkam.com\/blog\/wp-content\/uploads\/2022\/03\/image-3.png\" alt=\"\" class=\"wp-image-1716\" width=\"539\" height=\"203\" srcset=\"https:\/\/nguenkam.com\/blog\/wp-content\/uploads\/2022\/03\/image-3.png 826w, https:\/\/nguenkam.com\/blog\/wp-content\/uploads\/2022\/03\/image-3-300x113.png 300w, https:\/\/nguenkam.com\/blog\/wp-content\/uploads\/2022\/03\/image-3-768x289.png 768w\" sizes=\"(max-width: 539px) 100vw, 539px\" \/><\/figure>\n\n\n\n<p>After launching Debian, it should install and prompt to create your account.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Installing, this may take a few minutes\u2026\nPlease create a default UNIX user account. The username does not need to match your Windows username.\nFor more information visit: https:\/\/aka.ms\/wslusers\nEnter new UNIX username: <span class=\"has-inline-color has-vivid-red-color\"><strong>ngubri<\/strong><\/span>\nNew password:\nRetype new password:\npasswd: password updated successfully\nInstallation successful!\n<span class=\"has-inline-color has-vivid-green-cyan-color\"><strong>ngubri@DESKTOP-M1235UB:~$<\/strong><\/span><\/code><\/pre>\n\n\n\n<p>That should do it!<\/p>\n\n\n\n<div style=\"height:100px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>Some troubleshooting commands to run when you run into issues.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>wsl --set-default-version 1\nbcdedit \/set hypervisorlaunchtype auto start<\/code><\/pre>\n\n\n\n<p>Now simply launch Debian from Windows start by searching for it. You can also pin it to the taskbar and always have it launch from there.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" src=\"https:\/\/nguenkam.com\/blog\/wp-content\/uploads\/2022\/03\/image-4.png\" alt=\"\" class=\"wp-image-1718\" width=\"616\" height=\"505\" srcset=\"https:\/\/nguenkam.com\/blog\/wp-content\/uploads\/2022\/03\/image-4.png 838w, https:\/\/nguenkam.com\/blog\/wp-content\/uploads\/2022\/03\/image-4-300x246.png 300w, https:\/\/nguenkam.com\/blog\/wp-content\/uploads\/2022\/03\/image-4-768x630.png 768w\" sizes=\"(max-width: 616px) 100vw, 616px\" \/><\/figure>\n\n\n\n<p>That should do it!<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" src=\"https:\/\/nguenkam.com\/blog\/wp-content\/uploads\/2022\/03\/image-5.png\" alt=\"\" class=\"wp-image-1720\" width=\"522\" height=\"305\" srcset=\"https:\/\/nguenkam.com\/blog\/wp-content\/uploads\/2022\/03\/image-5.png 795w, https:\/\/nguenkam.com\/blog\/wp-content\/uploads\/2022\/03\/image-5-300x175.png 300w, https:\/\/nguenkam.com\/blog\/wp-content\/uploads\/2022\/03\/image-5-768x449.png 768w\" sizes=\"(max-width: 522px) 100vw, 522px\" \/><\/figure>\n\n\n\n<p>To ensure that WSL 2 is enabled in your system, open the Windows command prompt and run the below-mentioned command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code> wsl -l -v\n \/\/OR\n wsl --list --verbose<\/code><\/pre>\n\n\n\n<p>Note that the above command only works on Windows build version\u00a0<strong>\u201c18362\u201d<\/strong>\u00a0and higher. If the output indicates the WSL version properly, that means WSL 2 is enabled in your system:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" src=\"https:\/\/nguenkam.com\/blog\/wp-content\/uploads\/2022\/03\/image-9.png\" alt=\"\" class=\"wp-image-1770\" width=\"375\" height=\"73\" srcset=\"https:\/\/nguenkam.com\/blog\/wp-content\/uploads\/2022\/03\/image-9.png 596w, https:\/\/nguenkam.com\/blog\/wp-content\/uploads\/2022\/03\/image-9-300x58.png 300w\" sizes=\"(max-width: 375px) 100vw, 375px\" \/><\/figure>\n\n\n\n<p>If you are still running the WSL version 1, then use the following command to enable WSL 2:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code> wsl --set-default-version 2<\/code><\/pre>\n\n\n\n<p>Though WSL 2 is the latest version, there are still some features that are only supported by WSL 1, such as quick access to files stored on Windows, serial port support, etc. So to set a specific version of WSL to a specific distribution, use the command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>wsl --set-version &#91;distro_name] &#91;wsl_version_number]<\/code><\/pre>\n\n\n\n<p>Replace the\u00a0<strong>\u201c[distro_name]\u201d<\/strong>\u00a0with the Linux distribution name and mentioned the WSL version in the place of\u00a0<strong>\u201c[wsl_version_number].\u201d<\/strong>  (example:  <em><span class=\"has-inline-color has-vivid-cyan-blue-color\"><strong>wsl &#8211;set-version Debian 2<\/strong><\/span><\/em>)<\/p>\n\n\n\n<div style=\"height:100px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h4>Conclusion:<\/h4>\n\n\n\n<p>WSL is a Windows feature that allows Windows 10 users to run Linux on Windows 10 natively. There are two main versions of WSL; <em><strong>WSL 2 <\/strong><\/em>is the updated version of <em><strong>WSL 1<\/strong><\/em> and supports all system calls, and 20% faster than its predecessor.WSL converts the Linux calls into windows calls and executes them, though WSL 2 has its own specifically designed kernel that no longer needed call system translation. After enabling WSL in Windows and installing Linux distribution, you can use bash shell for all compatible utilities. It is quite helpful for developers who are interested to learn Linux on Windows.<\/p>\n\n\n\n<p>WSL 2 uses an actual Linux kernel that allows Linux containers. WSL 1 was genius with running Linux on the Windows kernel, but of course lacked some of the features, such as containers.\u00a0<\/p>\n\n\n\n<p> Although the WSL 2 is the current and overhauled version, some exceptions might make you use WSL 1. Which version you should use is a personal choice, but I would recommend going with WSL 2 because it is efficient and allows you to install Linux updates easily.<\/p>\n\n\n\n<div style=\"height:100px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h5>Reference:<\/h5>\n\n\n\n<p><a href=\"https:\/\/websiteforstudents.com\/\">https:\/\/websiteforstudents.com\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Back in 2017, Windows released Windows Subsystem for Linux that lets developers run a GNU\/Linux environment, including most command-line tools, utilities, and applications directly in Windows without setting up a virtual machine or dual-boot. WSL2 has since been released, and it\u2019s an improvement over version 1. The new and improved version comes with performance boost, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1721,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1,316,169],"tags":[171,502,96,501],"_links":{"self":[{"href":"https:\/\/nguenkam.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/1712"}],"collection":[{"href":"https:\/\/nguenkam.com\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nguenkam.com\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nguenkam.com\/blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nguenkam.com\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=1712"}],"version-history":[{"count":8,"href":"https:\/\/nguenkam.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/1712\/revisions"}],"predecessor-version":[{"id":1771,"href":"https:\/\/nguenkam.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/1712\/revisions\/1771"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/nguenkam.com\/blog\/index.php\/wp-json\/wp\/v2\/media\/1721"}],"wp:attachment":[{"href":"https:\/\/nguenkam.com\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=1712"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nguenkam.com\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=1712"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nguenkam.com\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=1712"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}