{"id":1883,"date":"2023-11-19T23:37:14","date_gmt":"2023-11-19T14:37:14","guid":{"rendered":"https:\/\/oboki.net\/workspace\/?p=1883"},"modified":"2023-12-12T23:52:21","modified_gmt":"2023-12-12T14:52:21","slug":"vagrant-on-wsl-2","status":"publish","type":"post","link":"https:\/\/oboki.net\/workspace\/system\/windows\/vagrant-on-wsl-2\/","title":{"rendered":"Vagrant \u2715 WSL 2"},"content":{"rendered":"<p><code>Kubernetes<\/code> \ub97c \ubcf8\uaca9 \uacf5\ubd80\ud558\ub824\uace0 \ud558\ub294\ub370 \uac1c\ubc1c \uc7a5\ube44\uc5d0 <code>Docker Desktop<\/code> \uae30\ubc18\uc73c\ub85c \ud574\ubcf4\uc790\ub2c8 \uc774\uac00 \ud558\ub098 \ube60\uc9c4 \ub290\ub08c\uc774\ub2e4. \ud55c\ub540\ud55c\ub540 \uc7a5\uc778\uc815\uc2e0\uc73c\ub85c \uad6c\uc131\ud574\ubcf4\uba74\uc11c \ud074\ub7ec\uc2a4\ud130 \uad00\ub9ac\uae4c\uc9c0 \uc81c\ub300\ub85c \uacf5\ubd80\ud574\ubcf4\uace0\uc2f6\uc740\ub370 \ud074\ub7ec\uc2a4\ud130\ub97c \uac1c\ubc1c \uc7a5\ube44\uc5d0 \ubc14\ub85c \uad6c\uc131\ud558\ub824\ub2c8 \uc2dc\uc2a4\ud15c\uc774 \uae08\ubc29 \uc624\uc5fc\ub420 \uac83 \uac19\uc544 \uc624\ub79c\ub9cc\uc5d0 VM \uc744 \ub9cc\uc9c0\uc791\uac70\ub824\ubd24\ub2e4.<\/p>\n<p><code>Windows WSL 2<\/code> \uc5d0\uc11c\ub3c4 Vagrant \ub85c VirtualBox VM \uc81c\uc5b4\uac00 \uac00\ub2a5\ud55c\ub370 \uc77c\ubc18\uc801\uc774\uc9c4 \uc54a\uc740 \uac83 \uac19\uc544\uc11c \uae30\ub85d\ud574\ub450\ub824\uace0 \ud55c\ub2e4.<\/p>\n<p>WSL2 \uc5d0\uc11c \ub3c4\ucee4 \ub370\uc2a4\ud06c\ud0d1\uc744 \ud65c\uc6a9\ud558\ub294 \uac83\uacfc \ub9c8\ucc2c\uac00\uc9c0\ub85c, VirtualBox backend \ub294 \uc708\ub3c4\uc6b0\uc988 \uc2dc\uc2a4\ud15c\uc5d0 \uad6c\uc131\ud558\uace0 Vagrant \ub294 WSL \ub0b4\uc5d0\uc11c \ub9ac\ub205\uc2a4 \ubc30\ud3ec \ubc84\uc804\uc744 \uc774\uc6a9\ud55c\ub2e4.<\/p>\n<p>\uc544\uc8fc \uc57d\uac04 \ub354 \uc790\uc138\ud55c \ub0b4\uc6a9\uc740 \uacf5\uc2dd \ubb38\uc11c\uc5d0 \uc788\ub2e4.<\/p>\n<p><a href=\"https:\/\/developer.hashicorp.com\/vagrant\/docs\/other\/wsl\">https:\/\/developer.hashicorp.com\/vagrant\/docs\/other\/wsl<\/a><\/p>\n<p>VirtualBox \ub294 \ub2e4\uc74c \uacbd\ub85c\uc5d0\uc11c Windows Hosts \uc6a9\uc744 \ubc1b\uc544 WSL 2 \ud638\uc2a4\ud2b8 (Windows) \uc5d0 \uc124\uce58\ud558\uace0<\/p>\n<p><a href=\"https:\/\/www.virtualbox.org\/wiki\/Downloads\">https:\/\/www.virtualbox.org\/wiki\/Downloads<\/a><\/p>\n<p>Vagrant \ub294 WSL2 \uc258\uc5d0\uc11c \ub2e4\uc74c\uacfc \uac19\uc740 \uba85\ub839\uc73c\ub85c \uc124\uce58\ud55c\ub2e4.<\/p>\n<pre><code class=\"language-bash\">wget -O- https:\/\/apt.releases.hashicorp.com\/gpg | sudo gpg --dearmor -o \/usr\/share\/keyrings\/hashicorp-archive-keyring.gpg\necho &quot;deb [signed-by=\/usr\/share\/keyrings\/hashicorp-archive-keyring.gpg] https:\/\/apt.releases.hashicorp.com $(lsb_release -cs) main&quot; | sudo tee \/etc\/apt\/sources.list.d\/hashicorp.list\nsudo apt update &amp;&amp; sudo apt install vagrant<\/code><\/pre>\n<p>\uc124\uce58 \uc9c1\ud6c4\uc5d0 <code>vagrant<\/code> \uba85\ub839\uc744 \ub0a0\ub824\ubcf4\uba74 \ub2e4\uc74c\uacfc \uac19\uc774 \uc815\uc0c1\ub3d9\uc791\ud558\uc9c0 \uc54a\ub294\ub370<\/p>\n<pre><code class=\"language-bash\"># vagrant\nVagrant failed to initialize at a very early stage:\n\nVagrant is unable to use the VirtualBox provider from the Windows Subsystem for\nLinux without access to the Windows environment. Enabling this access must be\ndone with caution and an understanding of the implications. For more information\non enabling Windows access and using VirtualBox from the Windows Subsystem for\nLinux, please refer to the Vagrant documentation:\n\n  https:\/\/www.vagrantup.com\/docs\/other\/wsl.html<\/code><\/pre>\n<p>\uc544\ub798\uc640 \uac19\uc774 \ud658\uacbd\ubcc0\uc218\ub97c \uc124\uc815\ud574\uc8fc\uba74 \uc124\uce58 \ub05d.<\/p>\n<pre><code class=\"language-bash\">export VAGRANT_WSL_ENABLE_WINDOWS_ACCESS=&quot;1&quot;\nexport PATH=&quot;$PATH:\/mnt\/c\/Program Files\/Oracle\/VirtualBox&quot;\n# vagrant --version\nVagrant 2.4.0<\/code><\/pre>\n<p>\ud658\uacbd\ubcc0\uc218 \uc124\uc815 \uc678\uc5d0 \ucd94\uac00\uc801\uc778 \uc8fc\uc758\uc0ac\ud56d\uc740 \ud638\uc2a4\ud2b8 \uc2dc\uc2a4\ud15c\uacfc \uac19\uc740 \ud30c\uc77c\uc2dc\uc2a4\ud15c\uc5d0\uc11c\ub9cc \ub3d9\uc791\ud558\uae30\ub54c\ubb38\uc5d0 <code>\/mnt\/{c,d,...}<\/code> \ud558\uc704\uc5d0\uc11c Vagrant \ud504\ub85c\uc81d\ud2b8\ub97c \uc0dd\uc131\ud574\uc57c\ud558\ub294\ub370 wsl \uc548\uc73c\ub85c symlink \ub97c \uac78\uc5b4\uc11c \uc0ac\uc6a9\ud558\ub294\uac83\ub3c4 \uac00\ub2a5\ud558\ub2e4.<\/p>\n<pre><code class=\"language-bash\">mkdir -p ~\/projects\/vagrant &amp;&amp; cd $_\nmkdir -p \/mnt\/c\/Users\/user\/vagrant\/example &amp;&amp; ln -s $_ .<\/code><\/pre>\n<p>\uc6b0\ubd84\ud22c \ubc15\uc2a4\ub97c \ud558\ub098 \uad6c\uc131\ud574\ubcf4\uba74 VM \uc790\uccb4\ub294 \uc798 \uad6c\uc131\ub418\uc9c0\ub9cc ssh \uc811\uadfc\uc774 \uc81c\ub300\ub85c \ub418\uc9c0 \uc54a\ub294\ub370<\/p>\n<pre><code class=\"language-bash\"># vagrant init generic\/ubuntu2204\nA `Vagrantfile` has been placed in this directory. You are now\nready to `vagrant up` your first virtual environment! Please read\nthe comments in the Vagrantfile as well as documentation on\n`vagrantup.com` for more information on using Vagrant.\n# vagrant up\nBringing machine &#039;default&#039; up with &#039;virtualbox&#039; provider...\n==&gt; default: Box &#039;generic\/ubuntu2204&#039; could not be found. Attempting to find and install...\n    ...\n==&gt; default: Fixed port collision for 22 =&gt; 2222. Now on port 2200.\n==&gt; default: Clearing any previously set network interfaces...\n==&gt; default: Preparing network interfaces based on configuration...\n    default: Adapter 1: nat\n==&gt; default: Forwarding ports...\n    default: 22 (guest) =&gt; 2200 (host) (adapter 1)\n==&gt; default: Running &#039;pre-boot&#039; VM customizations...\n==&gt; default: Booting VM...\n==&gt; default: Waiting for machine to boot. This may take a few minutes...\n    default: SSH address: 127.0.0.1:2200\n    default: SSH username: vagrant\n    default: SSH auth method: private key\n    default: Warning: Connection refused. Retrying...\n    default: Warning: Connection refused. Retrying...\n    ...<\/code><\/pre>\n<p><code>virtualbox_WSL2<\/code> \ud50c\ub7ec\uadf8\uc778\uc744 \uc124\uce58\ud574\uc8fc\uace0 \ub2e4\uc2dc \uc2dc\ub3c4\ud574\ubcf4\uba74 SSH \uc8fc\uc18c\uac00 \uc815\uc0c1\uc801\uc73c\ub85c \ub9f5\ud551\ub418\ub294 \uac83\uc744 \ud655\uc778\ud560 \uc218 \uc788\uace0 <code>vagrant ssh<\/code> \uba85\ub839\ub3c4 \uc815\uc0c1\uc801\uc73c\ub85c \ub3d9\uc791\ud55c\ub2e4.<\/p>\n<pre><code class=\"language-bash\"># vagrant destroy\n    default: Are you sure you want to destroy the &#039;default&#039; VM? [y\/N] y\n==&gt; default: Forcing shutdown of VM...\n==&gt; default: Destroying VM and associated drives...\n# vagrant plugin install virtualbox_WSL2\nInstalling the &#039;virtualbox_WSL2&#039; plugin. This can take a few minutes...\nFetching rake-13.1.0.gem\nFetching virtualbox_WSL2-0.1.3.gem\nInstalled the plugin &#039;virtualbox_WSL2 (0.1.3)&#039;!\n# vagrant up\nBringing machine &#039;default&#039; up with &#039;virtualbox&#039; provider...\n==&gt; default: Importing base box &#039;generic\/ubuntu2204&#039;...\n             ...\n==&gt; default: Preparing network interfaces based on configuration...\n    default: Adapter 1: nat\n==&gt; default: Forwarding ports...\n    default: 22 (guest) =&gt; 2200 (host) (adapter 1)\n    default: 22 (guest) =&gt; 2200 (host) (adapter 1)\n             ...\n==&gt; default: Waiting for machine to boot. This may take a few minutes...\n    default: SSH address: 172.17.160.1:2200\n    default: SSH username: vagrant\n    default: SSH auth method: private key\n    default: Warning: Connection reset. Retrying...\n    default:\n    default: Vagrant insecure key detected. Vagrant will automatically replace\n    default: this with a newly generated keypair for better security.\n    default:\n    default: Inserting generated public key within guest...\n    default: Removing insecure key from the guest if it&#039;s present...\n    default: Key inserted! Disconnecting and reconnecting using new SSH key...\n==&gt; default: Machine booted and ready!\n             ...\n# vagrant ssh\nvagrant@ubuntu2204:~$<\/code><\/pre>\n<p>\ub124\ud2b8\uc6cc\ud06c \uc124\uc815\uc5d0 \ub098\ub984 \uc790\uc2e0\uc788\ub294 (?, \uc775\uc219\ud55c) vmware \ub85c \uc4f8 \uc218 \uc788\uc73c\uba74 \ub354 \uc88b\uaca0\uc9c0\ub9cc <code>vagrant-vmware-utility<\/code> \uc124\uce58\uae4c\uc9c0 \ud558\ub824\uba74 \uc880 \ub354 \ubc88\uac70\ub86d\ub2e4.<\/p>\n<p><a href=\"https:\/\/developer.hashicorp.com\/vagrant\/docs\/providers\/vmware\">https:\/\/developer.hashicorp.com\/vagrant\/docs\/providers\/vmware<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Kubernetes \ub97c \ubcf8\uaca9 \uacf5\ubd80\ud558\ub824\uace0 \ud558\ub294\ub370 \uac1c\ubc1c \uc7a5\ube44\uc5d0 Docker Desktop \uae30\ubc18\uc73c\ub85c \ud574\ubcf4\uc790\ub2c8 \uc774\uac00 \ud558\ub098 \ube60\uc9c4 \ub290\ub08c\uc774\ub2e4. \ud55c\ub540\ud55c\ub540 \uc7a5\uc778\uc815\uc2e0\uc73c\ub85c \uad6c\uc131\ud574\ubcf4\uba74\uc11c \ud074\ub7ec\uc2a4\ud130 \uad00\ub9ac\uae4c\uc9c0 \uc81c\ub300\ub85c \uacf5\ubd80\ud574\ubcf4\uace0\uc2f6\uc740\ub370 \ud074\ub7ec\uc2a4\ud130\ub97c \uac1c\ubc1c \uc7a5\ube44\uc5d0 \ubc14\ub85c \uad6c\uc131\ud558\ub824\ub2c8 \uc2dc\uc2a4\ud15c\uc774 \uae08\ubc29 \uc624\uc5fc\ub420 \uac83 \uac19\uc544 \uc624\ub79c\ub9cc\uc5d0 VM \uc744 \ub9cc\uc9c0\uc791\uac70\ub824\ubd24\ub2e4. Windows WSL 2 \uc5d0\uc11c\ub3c4 Vagrant \ub85c VirtualBox VM \uc81c\uc5b4\uac00 \uac00\ub2a5\ud55c\ub370 \uc77c\ubc18\uc801\uc774\uc9c4 \uc54a\uc740 \uac83 \uac19\uc544\uc11c \uae30\ub85d\ud574\ub450\ub824\uace0 \ud55c\ub2e4. WSL2 \uc5d0\uc11c \ub3c4\ucee4 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[44,215,7],"tags":[],"class_list":["post-1883","post","type-post","status-publish","format-standard","hentry","category-system","category-vagrant","category-windows"],"_links":{"self":[{"href":"https:\/\/oboki.net\/workspace\/wp-json\/wp\/v2\/posts\/1883","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/oboki.net\/workspace\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/oboki.net\/workspace\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/oboki.net\/workspace\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/oboki.net\/workspace\/wp-json\/wp\/v2\/comments?post=1883"}],"version-history":[{"count":0,"href":"https:\/\/oboki.net\/workspace\/wp-json\/wp\/v2\/posts\/1883\/revisions"}],"wp:attachment":[{"href":"https:\/\/oboki.net\/workspace\/wp-json\/wp\/v2\/media?parent=1883"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/oboki.net\/workspace\/wp-json\/wp\/v2\/categories?post=1883"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/oboki.net\/workspace\/wp-json\/wp\/v2\/tags?post=1883"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}