{"id":2348,"date":"2024-05-23T11:15:25","date_gmt":"2024-05-23T02:15:25","guid":{"rendered":"https:\/\/gotocloud.co.kr\/?p=2348"},"modified":"2024-05-23T11:15:32","modified_gmt":"2024-05-23T02:15:32","slug":"install-ubuntu-linux-on-windows-using-wsl","status":"publish","type":"post","link":"https:\/\/gotocloud.co.kr\/?p=2348","title":{"rendered":"Install Ubuntu linux on Windows using WSL"},"content":{"rendered":"<div id=\"SE-d5b95dac-727d-458d-bc36-aa95cdb9470f\" class=\"se-component se-sectionTitle se-l-default\">\n<div class=\"se-component-content\">\n<div class=\"se-section se-section-sectionTitle se-l-default\">\n<div class=\"se-module se-module-text\">\n<h2 id=\"SE-261e2f8a-73c0-4617-b121-3b23fda20930\" class=\"se-text-paragraph se-text-paragraph-align- \"><span id=\"SE-8aaaff59-1c63-49c4-8fa5-f92001cdab17\" class=\"se-fs- se-ff- \">WSL(Windows Subsystem for Linux)<\/span><\/h2>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div id=\"SE-03d74e07-d121-476a-9865-2e7a7fd6dc7c\" class=\"se-component se-text se-l-default\">\n<div class=\"se-component-content\">\n<div class=\"se-section se-section-text se-l-default\">\n<div class=\"se-module se-module-text\">\n<div class=\"autosourcing-stub-extra\">\n<p>When you want to run Linux-specific programs or develop in a Linux environment, there are times when you need Linux hardware. However, if you only have a computer with Windows installed, in the past, you would have to install Linux through #Dual booting or even set up a dedicated Linux machine. To avoid this hassle and use Linux on Windows, Microsoft provides WSL (<a href=\"https:\/\/learn.microsoft.com\/en-us\/windows\/wsl\/about\">What is Windows Subsystem for Linux | Microsoft Learn<\/a>).<\/p>\n<p>This article summarizes how to install Ubuntu Linux using #WSL and configure a basic WSL distribution that can be used for various purposes.<\/p>\n<div id=\"SE-e05b9712-b8ab-4b8a-bbfe-8b820ceb1bb4\" class=\"se-component se-sectionTitle se-l-default\">\n<div class=\"se-component-content\">\n<div class=\"se-section se-section-sectionTitle se-l-default\">\n<div class=\"se-module se-module-text\">\n<h2 id=\"SE-7ce3007d-5f2b-43d4-a71e-a7ce1fbf780b\" class=\"se-text-paragraph se-text-paragraph-align- \"><span id=\"SE-2b3848fd-39a2-4490-b967-bf387c9265e7\" class=\"se-fs- se-ff- \">Install Ubuntu 22.04 base image<\/span><\/h2>\n<p>In Windows, you run the command prompt and check if there are any WSL distributions installed with the command wsl &#8211;list. If there are no previously installed WSL distributions, a message will be displayed indicating that nothing is installed.<\/p>\n<\/div>\n<pre>C:\\Users\\gotocloud&gt;wsl --list\r\nLinux\uc6a9 Windows \ud558\uc704 \uc2dc\uc2a4\ud15c\uc5d0\ub294 \uc124\uce58\ub41c \ubc30\ud3ec\ud310\uc774 \uc5c6\uc2b5\ub2c8\ub2e4.\r\n\r\n'wsl.exe --list --online'\uc744 \uc0ac\uc6a9\ud558\uc5ec \uc0ac\uc6a9 \uac00\ub2a5\ud55c \ubc30\ud3ec\ud310\uc744 \ub098\uc5f4\ud558\uace0\r\n'wsl.exe --install &lt;Distro&gt;'\ub97c \uc0ac\uc6a9\ud558\uc5ec \uc124\uce58\ud558\uc138\uc694.\r\n\r\n\ubc30\ud3ec\ud310\uc740 Microsoft Store\r\n(https:\/\/aka.ms\/wslstore)\ub97c \ubc29\ubb38\ud558\uc5ec \uc124\uce58\ud560 \uc218\ub3c4 \uc788\uc2b5\ub2c8\ub2e4.\r\nError code: Wsl\/WSL_E_DEFAULT_DISTRO_NOT_FOUND<\/pre>\n<\/div>\n<\/div>\n<\/div>\n<div id=\"SE-8a7f1156-234a-48a5-b77a-9956180739cd\" class=\"se-component se-text se-l-default\">\n<div class=\"se-component-content\">\n<div class=\"se-section se-section-text se-l-default\">\n<div class=\"se-module se-module-text\">\n<div class=\"autosourcing-stub-extra\">\n<p>You can check the available Linux distributions for installation with the command wsl &#8211;list &#8211;online.<\/p>\n<pre>C:\\Users\\gotocloud&gt;wsl --list --online\r\n\ub2e4\uc74c\uc740 \uc124\uce58\ud560 \uc218 \uc788\ub294 \uc720\ud6a8\ud55c \ubc30\ud3ec\ud310 \ubaa9\ub85d\uc785\ub2c8\ub2e4.\r\n'wsl.exe --install &lt;Distro&gt;'\ub97c \uc0ac\uc6a9\ud558\uc5ec \uc124\uce58\ud569\ub2c8\ub2e4.\r\n\r\nNAME FRIENDLY NAME\r\nUbuntu Ubuntu\r\nDebian Debian GNU\/Linux\r\nkali-linux Kali Linux Rolling\r\nUbuntu-18.04 Ubuntu 18.04 LTS\r\nUbuntu-20.04 Ubuntu 20.04 LTS\r\nUbuntu-22.04 Ubuntu 22.04 LTS\r\nUbuntu-24.04 Ubuntu 24.04 LTS\r\nOracleLinux_7_9 Oracle Linux 7.9\r\nOracleLinux_8_7 Oracle Linux 8.7\r\nOracleLinux_9_1 Oracle Linux 9.1\r\nopenSUSE-Leap-15.5 openSUSE Leap 15.5\r\nSUSE-Linux-Enterprise-Server-15-SP4 SUSE Linux Enterprise Server 15 SP4\r\nSUSE-Linux-Enterprise-15-SP5 SUSE Linux Enterprise 15 SP5\r\nopenSUSE-Tumbleweed openSUSE Tumbleweed<\/pre>\n<\/div>\n<p>Begin by installing and starting Ubuntu 22.04. During the installation, set up the default user account and password. In this article, the default user account is set to &#8216;gotocloud&#8217;. Enter the desired username.<\/p>\n<pre>C:\\Users\\gotocloud&gt;wsl --install Ubuntu-22.04\r\nUbuntu 22.04 LTS\uc744(\ub97c) \uc2dc\uc791\ud558\ub294 \uc911...\r\nInstalling, this may take a few minutes...\r\nPlease create a default UNIX user account. The username does not need to match your Windows username.\r\nFor more information visit: https:\/\/aka.ms\/wslusers\r\nEnter new UNIX username: gotocloud\r\nNew password:\r\nRetype new password:\r\npasswd: password updated successfully\r\n\uc791\uc5c5\uc744 \uc644\ub8cc\ud588\uc2b5\ub2c8\ub2e4.\r\nInstallation successful!\r\nTo run a command as administrator (user \"root\"), use \"sudo &lt;command&gt;\".\r\nSee \"man sudo_root\" for details.\r\n\r\nWelcome to Ubuntu 22.04.3 LTS (GNU\/Linux 5.15.146.1-microsoft-standard-WSL2 x86_64)\r\n\r\n* Documentation: https:\/\/help.ubuntu.com\r\n* Management: https:\/\/landscape.canonical.com\r\n* Support: https:\/\/ubuntu.com\/advantage\r\n\r\n\r\nThis message is shown once a day. To disable it please create the\r\n\/home\/gotocloud\/.hushlogin file.\r\ngotocloud@DESKTOP-SNMQ2D4:~$<\/pre>\n<p>Update Linux OS and install basic packages<\/p>\n<pre>$ sudo apt<span class=\"token se-code-operator\">-<\/span>get <span class=\"token se-code-operator\">-<\/span>y update\r\n$ sudo apt<span class=\"token se-code-operator\">-<\/span>get <span class=\"token se-code-operator\">-<\/span>y install vim nano net<span class=\"token se-code-operator\">-<\/span>tools iputils<span class=\"token se-code-operator\">-<\/span>ping csh gnome<span class=\"token se-code-operator\">-<\/span>terminal<\/pre>\n<p>Install development packages<\/p>\n<div id=\"SE-1bdb780e-6824-4147-909e-636dcd8f2bb8\" class=\"se-component se-code se-l-code_black __se-component\">\n<div class=\"se-component-content\">\n<div class=\"se-section se-section-code se-l-code_black\">\n<div class=\"se-module se-module-code se-fs-fs13\">\n<div class=\"se-code-source\">\n<pre class=\"__se_code_view language-javascript\">$ sudo apt<span class=\"token se-code-operator\">-<\/span><span class=\"token se-code-keyword\">get<\/span> install <span class=\"token se-code-operator\">-<\/span>y build<span class=\"token se-code-operator\">-<\/span>essential flex zlib1g<span class=\"token se-code-operator\">-<\/span>dev libgmp<span class=\"token se-code-operator\">-<\/span>dev libmpfr<span class=\"token se-code-operator\">-<\/span>dev texinfo cmake<\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div id=\"SE-a3046ffb-7ef4-49fe-8c39-f84e2ab908b9\" class=\"se-component se-sectionTitle se-l-default\">\n<div class=\"se-component-content\">\n<h2 class=\"autosourcing-stub-extra\">Export WSL distribution image for reuse<\/h2>\n<div>\n<p>To avoid installing the necessary WSL image every time, and to reuse a distribution that has been configured with the basic packages and development environment, you perform an export. This exported distribution can be used to configure the desired WSL image, and it can be moved to another computer or shared.<\/p>\n<p>Before exporting, you stop the running WSL image and then execute the export. You export the Ubuntu-22.04 WSL distribution with the filename<strong> Ubuntu22.04-base.vhdx<\/strong>.<\/p>\n<\/div>\n<pre>C:\\Users\\gotocloud&gt;wsl --shutdown Ubuntu-22.04\r\nC:\\Users\\gotocloud&gt;wsl --terminate Ubuntu-22.04\r\nC:\\Users\\gotocloud&gt;wsl --export Ubuntu-22.04 Ubuntu22.04-base.vhdx --vhd\r\n\ub0b4\ubcf4\ub0b4\uae30\uac00 \uc9c4\ud589 \uc911\uc785\ub2c8\ub2e4. \uc774 \uc791\uc5c5\uc740 \uba87 \ubd84 \uc815\ub3c4 \uac78\ub9b4 \uc218 \uc788\uc2b5\ub2c8\ub2e4.\r\n\uc791\uc5c5\uc744 \uc644\ub8cc\ud588\uc2b5\ub2c8\ub2e4.<\/pre>\n<\/div>\n<div>The <strong>Ubuntu22.04-base.vhdx<\/strong> file has been created as follows. You can import this file to create a new WSL distribution.<\/div>\n<div>\n<pre>C:\\Users\\Bosung Lee&gt;dir Ubuntu22.04-base.vhdx\r\nC \ub4dc\ub77c\uc774\ube0c\uc758 \ubcfc\ub968\uc5d0\ub294 \uc774\ub984\uc774 \uc5c6\uc2b5\ub2c8\ub2e4.\r\n\ubcfc\ub968 \uc77c\ub828 \ubc88\ud638: 3C96-7739\r\n\r\nC:\\Users\\Bosung Lee \ub514\ub809\ud130\ub9ac\r\n\r\n05-22 \uc624\ud6c4 12:15 2,797,600,768 Ubuntu22.04-base.vhdx\r\n1\uac1c \ud30c\uc77c 2,797,600,768 \ubc14\uc774\ud2b8\r\n0\uac1c \ub514\ub809\ud130\ub9ac 183,857,647,616 \ubc14\uc774\ud2b8 \ub0a8\uc74c\r\n\r\n<\/pre>\n<p>When you want to remove an installed distribution, you use the wsl &#8211;unregister command.<\/p>\n<pre>C:\\Users\\gotocloud&gt;wsl --unregister Ubuntu-22.04\r\n\ub4f1\ub85d \ucde8\uc18c \uc911\uc785\ub2c8\ub2e4.\r\n\uc791\uc5c5\uc744 \uc644\ub8cc\ud588\uc2b5\ub2c8\ub2e4.<\/pre>\n<h2>Install new WSL distribution using import<\/h2>\n<p>The exported vhdx file is imported to create a new WSL distribution as follows. &#8220;MyUbuntu-22.04&#8221; is the name of the newly created WSL distribution, and the period (.) denotes the current directory, which is where the base disk for the WSL image, ext4.vhdx, will be stored. If you specify a desired directory name here, the base disk will be created in that directory. When creating multiple WSL distributions, the ext4.vhdx should be stored in different directories.<\/p>\n<p>The imported distribution is run with the user account &#8220;gotocloud&#8221; that was set up during image creation. The -d option specifies the name of the distribution to run.<\/p>\n<pre>C:\\Users\\gotocloud&gt;wsl --import MyUbuntu-22.04 . Ubuntu22.04-base.vhdx --vhd\r\nC:\\Users\\gotocloud&gt;wsl ~ -u gotocloud -d MyUbuntu-22.04\r\ngotocloud@DESKTOP-SNMQ2D4:~$<\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>WSL(Windows Subsystem for Linux) When you want to run Linux-specific programs or develop in a Linux environment, there are times when you need Linux hardware. [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":2355,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[407],"tags":[432,383,431],"_links":{"self":[{"href":"https:\/\/gotocloud.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/2348"}],"collection":[{"href":"https:\/\/gotocloud.co.kr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gotocloud.co.kr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gotocloud.co.kr\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/gotocloud.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2348"}],"version-history":[{"count":7,"href":"https:\/\/gotocloud.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/2348\/revisions"}],"predecessor-version":[{"id":2356,"href":"https:\/\/gotocloud.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/2348\/revisions\/2356"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/gotocloud.co.kr\/index.php?rest_route=\/wp\/v2\/media\/2355"}],"wp:attachment":[{"href":"https:\/\/gotocloud.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2348"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gotocloud.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2348"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gotocloud.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2348"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}