{"id":669,"date":"2021-09-01T14:30:54","date_gmt":"2021-09-01T11:30:54","guid":{"rendered":"https:\/\/plumrocket.com\/learn\/?p=669"},"modified":"2022-10-05T18:50:46","modified_gmt":"2022-10-05T15:50:46","slug":"how-to-install-magento-2-wordpress-on-wsl2-with-docker-and-devilbox","status":"publish","type":"post","link":"https:\/\/plumrocket.com\/learn\/devilbox-docker-wsl2","title":{"rendered":"How to Install Magento 2 &#038; WordPress on WSL2 with Docker and Devilbox"},"content":{"rendered":"\n<p>Hi! and welcome to Plumrocket tutorials! In 10 simple steps, you should learn how to launch any website on your local machine quickly. You will be able to enjoy the speed of Linux tools and the convenience of Windows.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" width=\"585\" height=\"440\" src=\"https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/Develop-for-Magento-2-WordPress-with-WSL2.png\" alt=\"How to Install Magento 2 &amp; WordPress on WSL2 with Docker and Devilbox\" class=\"wp-image-671\" srcset=\"https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/Develop-for-Magento-2-WordPress-with-WSL2.png 585w, https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/Develop-for-Magento-2-WordPress-with-WSL2-300x226.png 300w\" sizes=\"(max-width: 585px) 100vw, 585px\" \/><\/figure><\/div>\n\n\n\n<p>We believe that this setup is the easiest and the fastest way to start developing your first&nbsp;<a href=\"https:\/\/plumrocket.com\/magento-extensions\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">Magento Extension<\/a>&nbsp;or WordPress project on Windows.<\/p>\n\n\n\n<p>In this article, we will show you how to install Docker and Devilbox in Ubuntu for WSL2. Once our development environment is ready, we can begin installing Magento 2 and WordPress inside a docker container.<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"How to install WSL2 + Docker + Devilbox + WordPress and Magento 2 on Windows 10\" width=\"640\" height=\"360\" src=\"https:\/\/www.youtube.com\/embed\/9-vY5nLJC00?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n\n\n\n<h2><strong>Step 1. Check if your Windows 10 is updated to version 2004, Build 19041, or later<\/strong><\/h2>\n\n\n\n<p>We need to make sure that our Windows 10 is updated to Build 19041 or later to use WSL 2.<\/p>\n\n\n\n<ol><li>Open windows terminal by typing \u201c<strong>cmd<\/strong>\u201d in Windows Search Box and pressing Enter<\/li><li>Check your windows version.<\/li><\/ol>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">ver<\/code><\/pre><\/div>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" width=\"581\" height=\"247\" src=\"https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/pasted-image-0.png\" alt=\"check-windows-version-terminal\" class=\"wp-image-675\" srcset=\"https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/pasted-image-0.png 581w, https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/pasted-image-0-300x128.png 300w\" sizes=\"(max-width: 581px) 100vw, 581px\" \/><\/figure><\/div>\n\n\n\n<ol start=\"3\"><li> You can also check the Windows version by typing \u201c<strong>winver<\/strong>\u201d in the Windows search box:\n<br> <br>\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" width=\"460\" height=\"423\" src=\"https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/pasted-image-0-1.png\" alt=\"windows-version\" class=\"wp-image-676\" srcset=\"https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/pasted-image-0-1.png 460w, https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/pasted-image-0-1-300x276.png 300w\" sizes=\"(max-width: 460px) 100vw, 460px\" \/><\/figure><\/div><\/li><\/ol>\n\n\n\n<ol start=\"4\"><li>As you can see, our Windows 10 Build is \u201c18363\u201d. This means we have to update Windows to Build 19041 or higher. To do so, type \u201c<em>check for updates<\/em>\u201d in Windows Search Box. Then click on the \u201c<strong>Check for updates<\/strong>\u201d button to download and install the latest updates. You may need to do this process a couple of times until you reach the desired version.\n<br><br>\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" width=\"998\" height=\"785\" src=\"https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/pasted-image-0-2.png\" alt=\"check-for-updates-windows\" class=\"wp-image-677\" srcset=\"https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/pasted-image-0-2.png 998w, https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/pasted-image-0-2-300x236.png 300w, https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/pasted-image-0-2-768x604.png 768w\" sizes=\"(max-width: 998px) 100vw, 998px\" \/><\/figure><\/div>\n<p>Please note: Sometimes windows updates will get stuck and won\u2019t update automatically. It may be easier to go to Microsoft website and download the latest update from the website directly in such cases.<\/p>\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" width=\"1255\" height=\"857\" src=\"https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/windows-update.png\" alt=\"windows-update\" class=\"wp-image-678\" srcset=\"https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/windows-update.png 1255w, https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/windows-update-300x205.png 300w, https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/windows-update-1024x699.png 1024w, https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/windows-update-768x524.png 768w\" sizes=\"(max-width: 1255px) 100vw, 1255px\" \/><\/figure><\/div>\n<p>After downloading the Windows Update tool, launch it and proceed with the update.<\/p>\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" width=\"962\" height=\"672\" src=\"https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/pasted-image-0-3.png\" alt=\"windows-10-update-assistant\" class=\"wp-image-679\" srcset=\"https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/pasted-image-0-3.png 962w, https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/pasted-image-0-3-300x210.png 300w, https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/pasted-image-0-3-768x536.png 768w\" sizes=\"(max-width: 962px) 100vw, 962px\" \/><\/figure><\/div>\n<\/li><\/ol>\n\n\n\n<ol start=\"5\"><li>After you are done with the update, recheck your Windows version. Just type the \u201c<strong>winver<\/strong>\u201d in the Windows search box to see your build number:\n<br><br>\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" width=\"460\" height=\"423\" src=\"https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/Windows-10-c.png\" alt=\"Windows 10-c\" class=\"wp-image-680\" srcset=\"https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/Windows-10-c.png 460w, https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/Windows-10-c-300x276.png 300w\" sizes=\"(max-width: 460px) 100vw, 460px\" \/><\/figure><\/div>\n<\/li><\/ol>\n\n\n\n<h2><strong>Step 2. Enable Windows Subsystem for Linux (WSL2)<\/strong><\/h2>\n\n\n\n<p>Now we need to enable the WSL. We can do this via GUI or PowerShell.<\/p>\n\n\n\n<p><strong>To enable WSL using Windows Interface:<\/strong><\/p>\n\n\n\n<ol><li>Enter \u201cTurn Windows features on or off\u201d in the Search Box: <br><br> <div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" width=\"784\" height=\"680\" src=\"https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/pasted-image-0-4.png\" alt=\"windows-searchbox\" class=\"wp-image-682\" srcset=\"https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/pasted-image-0-4.png 784w, https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/pasted-image-0-4-300x260.png 300w, https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/pasted-image-0-4-768x666.png 768w\" sizes=\"(max-width: 784px) 100vw, 784px\" \/><\/figure><\/div><\/li><\/ol>\n\n\n\n<ol start=\"2\" id=\"two-checkboxes\"><li>In the new window, check two checkboxes:<ul><li>Virtual Machine Platform<\/li><li>Windows Subsystem for Linux\n<br><br>\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" width=\"415\" height=\"368\" src=\"https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/pasted-image-0-5.png\" alt=\"turn-windows-features-on-or-off\" class=\"wp-image-683\" srcset=\"https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/pasted-image-0-5.png 415w, https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/pasted-image-0-5-300x266.png 300w\" sizes=\"(max-width: 415px) 100vw, 415px\" \/><\/figure><\/div>\n<\/li><\/ul><\/li><\/ol>\n\n\n\n<p><strong>Alternatively, you can enable the WSL from the Windows shell. Open PowerShell as an administrator, and type the following command:<\/strong><\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">dism.exe \/online \/enable-feature \/featurename:Microsoft-Windows-Subsystem-Linux \/all \/norestart<\/code><\/pre><\/div>\n\n\n\n<p>Enable Window\u2019s Virtual Machine Platform:<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">dism.exe \/online \/enable-feature \/featurename:VirtualMachinePlatform \/all \/norestart<\/code><\/pre><\/div>\n\n\n\n<p>Now you need to restart your computer. After it restarted, you can use Windows GUI to check if the new features were added. Just type the \u201cTurn Windows features on or off\u201d in the Search Box and see if the&nbsp;<a href=\"#two-checkboxes\">two checkboxes listed above<\/a>&nbsp;are checked.<\/p>\n\n\n\n<h2><strong>Step 3. Install Ubuntu for WSL 2<\/strong><\/h2>\n\n\n\n<ol><li><strong>Open Microsoft Store on your computer and search for \u201cUbuntu.\u201d<\/strong>\n<br><br>\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" width=\"1202\" height=\"934\" src=\"https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/microsoft-store.png\" alt=\"microsoft store\" class=\"wp-image-686\" srcset=\"https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/microsoft-store.png 1202w, https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/microsoft-store-300x233.png 300w, https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/microsoft-store-1024x796.png 1024w, https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/microsoft-store-768x597.png 768w\" sizes=\"(max-width: 1202px) 100vw, 1202px\" \/><\/figure><\/div><\/li><\/ol>\n\n\n\n<ol start=\"2\"><li><strong>Install Ubuntu and launch Ubuntu shell<\/strong><br><br> <div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" width=\"1202\" height=\"934\" src=\"https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/ubuntu-20a.png\" alt=\"ubuntu-20a\" class=\"wp-image-687\" srcset=\"https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/ubuntu-20a.png 1202w, https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/ubuntu-20a-300x233.png 300w, https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/ubuntu-20a-1024x796.png 1024w, https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/ubuntu-20a-768x597.png 768w\" sizes=\"(max-width: 1202px) 100vw, 1202px\" \/><\/figure><\/div><\/li><\/ol>\n\n\n\n<ol start=\"3\"><li><strong>Provide your new root user and password<\/strong><br><br> <div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" width=\"979\" height=\"626\" src=\"https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/ubuntu-installing.png\" alt=\"ubuntu-installing\" class=\"wp-image-688\" srcset=\"https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/ubuntu-installing.png 979w, https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/ubuntu-installing-300x192.png 300w, https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/ubuntu-installing-768x491.png 768w\" sizes=\"(max-width: 979px) 100vw, 979px\" \/><\/figure><\/div> <\/li><\/ol>\n\n\n\n<h2><strong>Step 4. Install the New Windows Terminal (optional)<\/strong><\/h2>\n\n\n\n<p>Microsoft recently released a new Windows Terminal. It\u2019s a new central location where you can access the traditional cmd line, PowerShell, and the Windows Subsystem for Linux (WSL).<\/p>\n\n\n\n<p>You can install it directly from Microsoft Store.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" width=\"1202\" height=\"934\" src=\"https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/terminal-install.png\" alt=\"terminal-install\" class=\"wp-image-689\" srcset=\"https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/terminal-install.png 1202w, https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/terminal-install-300x233.png 300w, https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/terminal-install-1024x796.png 1024w, https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/terminal-install-768x597.png 768w\" sizes=\"(max-width: 1202px) 100vw, 1202px\" \/><\/figure><\/div>\n\n\n\n<p>Here is how it looks after installing:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" width=\"1115\" height=\"624\" src=\"https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/terminal-install2a.png\" alt=\"terminal-install2a\" class=\"wp-image-690\" srcset=\"https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/terminal-install2a.png 1115w, https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/terminal-install2a-300x168.png 300w, https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/terminal-install2a-1024x573.png 1024w, https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/terminal-install2a-768x430.png 768w\" sizes=\"(max-width: 1115px) 100vw, 1115px\" \/><\/figure><\/div>\n\n\n\n<p>You can switch to Ubuntu shell by clicking on the top menu dropdown and selecting your Linux distribution.<\/p>\n\n\n\n<h2><strong>Step 5. Enable WSL 2 for Ubuntu<\/strong><\/h2>\n\n\n\n<p>Now, let\u2019s check which WSL version is used for Ubuntu. Open windows terminal and type the following command:<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">wsl -l -v<\/code><\/pre><\/div>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" width=\"763\" height=\"263\" src=\"https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/wsl1-ubuntu.png\" alt=\"wsl1-ubuntu\" class=\"wp-image-691\" srcset=\"https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/wsl1-ubuntu.png 763w, https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/wsl1-ubuntu-300x103.png 300w\" sizes=\"(max-width: 763px) 100vw, 763px\" \/><\/figure><\/div>\n\n\n\n<p>If you don\u2019t see \u201c2\u201d next to Ubuntu, run the following command:<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">wsl --set-version  Ubuntu-20.04 2<\/code><\/pre><\/div>\n\n\n\n<p>If you receive a message that WSL 2 requires you to update its kernel, just follow&nbsp;<a href=\"https:\/\/aka.ms\/wsl2kernel\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">this link<\/a>&nbsp;to download and update the kernel.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" width=\"997\" height=\"339\" src=\"https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/wsl1-ubuntu2.png\" alt=\"wsl1-ubuntu2\" class=\"wp-image-692\" srcset=\"https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/wsl1-ubuntu2.png 997w, https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/wsl1-ubuntu2-300x102.png 300w, https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/wsl1-ubuntu2-768x261.png 768w\" sizes=\"(max-width: 997px) 100vw, 997px\" \/><\/figure><\/div>\n\n\n\n<p>After you finish updating the kernel, re-run the same command again:<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">wsl --set-version  Ubuntu-20.04 2<\/code><\/pre><\/div>\n\n\n\n<p>Also, let\u2019s set WSL 2 as your default version:<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">wsl --set-default-version 2<\/code><\/pre><\/div>\n\n\n\n<p>Finally, let\u2019s see if everything went well:<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">wsl -l -v<\/code><\/pre><\/div>\n\n\n\n<p>Now you should have WSL enabled for your Ubuntu.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" width=\"997\" height=\"358\" src=\"https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/wsl1-ubuntu31.png\" alt=\"wsl1-ubuntu3\" class=\"wp-image-694\" srcset=\"https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/wsl1-ubuntu31.png 997w, https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/wsl1-ubuntu31-300x108.png 300w, https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/wsl1-ubuntu31-768x276.png 768w\" sizes=\"(max-width: 997px) 100vw, 997px\" \/><\/figure><\/div>\n\n\n\n<h2><strong>Step 6. Install Docker and Docker-Compose in Ubuntu<\/strong><\/h2>\n\n\n\n<ol><li><strong>Open the Linux (Ubuntu) terminal and type the following commands<\/strong>&nbsp;to update the list of packages and install available upgrades:<\/li><\/ol>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">sudo apt update\nsudo apt upgrade\nsudo apt install build-essential<\/code><\/pre><\/div>\n\n\n\n<p>2. <strong>Install GIT<\/strong><\/p>\n\n\n\n<p>Most likely, GIT will be already installed in your Ubuntu, but just to make sure, type the following command:<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">sudo apt install git<\/code><\/pre><\/div>\n\n\n\n<p>The next global setting helps you avoid issues with checkouts. As files that you have not edited may appear modified due to line ending differences (Ubuntu vs Windows).<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">git config --global core.autocrlf input<\/code><\/pre><\/div>\n\n\n\n<p>3. <strong>Install Docker<\/strong><\/p>\n\n\n\n<p>Note: you can learn more info about the Docker installation in the&nbsp;<a href=\"https:\/\/docs.docker.com\/engine\/install\/ubuntu\/\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">official Docket documentation<\/a>.<\/p>\n\n\n\n<p>Begin Installation:<\/p>\n\n\n\n<p>Update local database<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">sudo apt update<\/code><\/pre><\/div>\n\n\n\n<p>Allow accessing the Docker repositories over HTTPS<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">sudo apt install apt-transport-https ca-certificates curl software-properties-common<\/code><\/pre><\/div>\n\n\n\n<p>For security purposes add Docker\u2019s GPG Key<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">curl -fsSL https:\/\/download.docker.com\/linux\/ubuntu\/gpg | sudo apt-key add -<\/code><\/pre><\/div>\n\n\n\n<p>Verify that you now have the key with the fingerprint <strong>9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88<\/strong>, by searching for the last 8 characters of the fingerprint.<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">sudo apt-key fingerprint 0EBFCD88<\/code><\/pre><\/div>\n\n\n\n<p>You should see similar output: <\/p>\n\n\n\n<p><strong>pub &nbsp; rsa4096 2017-02-22 [SCEA]<br>9DC8 5822 9FC7 DD38 854A&nbsp; E2D8 8D81 803C 0EBF CD88<br>uid &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [ unknown] Docker Release (CE deb) &lt;docker@docker.com&gt;<br>sub &nbsp; rsa4096 2017-02-22 [S]<\/strong><\/p>\n\n\n\n<p>Use the following command to set up the stable Docker repository:<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">sudo add-apt-repository \"deb [arch=amd64] https:\/\/download.docker.com\/linux\/ubuntu $(lsb_release -cs) stable\"<\/code><\/pre><\/div>\n\n\n\n<p>Update the list of packages again and install Docker CE<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">sudo apt update\nsudo apt install docker-ce docker-ce-cli containerd.io<\/code><\/pre><\/div>\n\n\n\n<p>4. <strong>The next step is to add your Ubuntu user to the docker group.<\/strong><\/p>\n\n\n\n<p>Devilbox does not recommend running the following command under root user (see more info in the&nbsp;<a href=\"https:\/\/devilbox.readthedocs.io\/en\/latest\/getting-started\/important.html#do-not-run-via-sudo-or-root\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">official Devilbox documentation<\/a>)<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">docker-compose<\/code><\/pre><\/div>\n\n\n\n<p>Create the docker group.<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-\">sudo groupadd docker<\/code><\/pre><\/div>\n\n\n\n<p>Add your user to the docker group.<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">sudo usermod -aG docker $USER<\/code><\/pre><\/div>\n\n\n\n<p>Run the following command to activate the changes to groups:<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">newgrp docker<\/code><\/pre><\/div>\n\n\n\n<p>Now, let\u2019s start our docker service for the first time<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">sudo service docker start<\/code><\/pre><\/div>\n\n\n\n<p>Run the&nbsp;<a href=\"https:\/\/hub.docker.com\/_\/hello-world\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">hello-world image<\/a>.<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">docker run hello-world<\/code><\/pre><\/div>\n\n\n\n<p>Please note: If you experience any issues during this process, check the article from&nbsp;<a href=\"https:\/\/docs.docker.com\/engine\/install\/linux-postinstall\/\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">docker documentation<\/a>.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" width=\"1051\" height=\"662\" src=\"https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/docker-hello-world-success.png\" alt=\"docker-hello-world-success\" class=\"wp-image-702\" srcset=\"https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/docker-hello-world-success.png 1051w, https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/docker-hello-world-success-300x189.png 300w, https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/docker-hello-world-success-1024x645.png 1024w, https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/docker-hello-world-success-768x484.png 768w\" sizes=\"(max-width: 1051px) 100vw, 1051px\" \/><\/figure><\/div>\n\n\n\n<p>Now log out and log back in so that your group membership is re-evaluated.<\/p>\n\n\n\n<p>5. <strong>Install Docker-compose:<\/strong><\/p>\n\n\n\n<p>For more instructions about Docker compose installation, go to the&nbsp;<a href=\"https:\/\/docs.docker.com\/compose\/install\/\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">Install Docker Compose documentation<\/a>.<\/p>\n\n\n\n<p>First, find the latest stable version of the docker-compose binary from the&nbsp;<a href=\"https:\/\/github.com\/docker\/compose\/releases\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">Compose repository release page on GitHub<\/a>.<\/p>\n\n\n\n<p>In our case, the latest version is <strong>1.28.5<\/strong>:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" width=\"1143\" height=\"839\" src=\"https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/docker-compose-release.png\" alt=\"docker-compose-release\" class=\"wp-image-703\" srcset=\"https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/docker-compose-release.png 1143w, https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/docker-compose-release-300x220.png 300w, https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/docker-compose-release-1024x752.png 1024w, https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/docker-compose-release-768x564.png 768w\" sizes=\"(max-width: 1143px) 100vw, 1143px\" \/><\/figure><\/div>\n\n\n\n<p>Download the docker-compose tool. Make sure to replace your latest release version with the number&nbsp;<strong>1.28.5<\/strong> below:<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">sudo curl -L \n\"https:\/\/github.com\/docker\/compose\/releases\/download\/1.28.5\/docker-compose-$(uname -s)-$(uname -m)\" -o \/usr\/local\/bin\/docker-compose<\/code><\/pre><\/div>\n\n\n\n<p>Make it executable<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">sudo chmod +x \/usr\/local\/bin\/docker-compose<\/code><\/pre><\/div>\n\n\n\n<p>Check if it\u2019s installed correctly<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">docker-compose --version<\/code><\/pre><\/div>\n\n\n\n<h2><strong>Step 7. Install &amp; Configure DevilBox in Ubuntu<\/strong><\/h2>\n\n\n\n<ol><li><strong>Install Devilbox<\/strong>&nbsp;(you may also check the installation article of the&nbsp;<a href=\"https:\/\/devilbox.readthedocs.io\/en\/latest\/getting-started\/install-the-devilbox.html\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">official Devilbox documentation<\/a>)<\/li><\/ol>\n\n\n\n<p>Open the Ubuntu shell and type the following commands:<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">cd ~\ngit clone https:\/\/github.com\/cytopia\/devilbox<\/code><\/pre><\/div>\n\n\n\n<p>2. <strong>Create the main configuration file (.env)<\/strong><\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">cd devilbox\ncp env-example .env<\/code><\/pre><\/div>\n\n\n\n<p>3. <strong>Set config values in the Devilbox environment file<\/strong><\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">id -u\nid -g<\/code><\/pre><\/div>\n\n\n\n<p>This should return you two values. In our case, we\u2019ve got \u201c1000\u201d for user id and user group.<\/p>\n\n\n\n<p>Edit main configuration file<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">vi .env<\/code><\/pre><\/div>\n\n\n\n<p>Set your user id and group id values in the env file:<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">NEW_UID=1000\nNEW_GID=1000<\/code><\/pre><\/div>\n\n\n\n<p>Save changes.<\/p>\n\n\n\n<p>4. <strong>Start Devilbox containers<\/strong><\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">docker-compose up<\/code><\/pre><\/div>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" width=\"1115\" height=\"624\" src=\"https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/27.png\" alt=\"start-devilbox-containers-terminal\" class=\"wp-image-711\" srcset=\"https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/27.png 1115w, https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/27-300x168.png 300w, https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/27-1024x573.png 1024w, https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/27-768x430.png 768w\" sizes=\"(max-width: 1115px) 100vw, 1115px\" \/><\/figure><\/div>\n\n\n\n<p>Please note, do not expect to see any type of \u201csuccess message\u201d on the terminal screen. Once you see no movement, you are good to go to the next step&nbsp;<\/p>\n\n\n\n<p>5. <strong>Open&nbsp;<a href=\"http:\/\/localhost\/\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">http:\/\/localhost\/<\/a>&nbsp;in your browser and you should be able to see the Devilbox Intranet<\/strong><\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" width=\"1280\" height=\"891\" src=\"https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/28.png\" alt=\"devilbox-intranet\" class=\"wp-image-712\" srcset=\"https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/28.png 1280w, https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/28-300x209.png 300w, https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/28-1024x713.png 1024w, https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/28-768x535.png 768w\" sizes=\"(max-width: 1280px) 100vw, 1280px\" \/><\/figure><\/div>\n\n\n\n<h2><strong>Step 8. Launch Our First Website on Devilbox<\/strong><\/h2>\n\n\n\n<p>Launching your first website is also described in the&nbsp;<a href=\"https:\/\/devilbox.readthedocs.io\/en\/latest\/getting-started\/create-your-first-project.html\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">official Devilbox manual<\/a>, however, there are a couple of important details concerning WSL that you will not find there.<\/p>\n\n\n\n<ol><li><strong>Create a project directory:<\/strong><\/li><\/ol>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">cd ~\/devilbox\/\nmkdir -p ~\/devilbox\/data\/www\/mytest\/htdocs<\/code><\/pre><\/div>\n\n\n\n<p>2. <strong>Open&nbsp;<\/strong><a href=\"http:\/\/localhost\/vhosts.php\" target=\"_blank\" rel=\"noreferrer noopener nofollow\"><strong>http:\/\/localhost\/vhosts.php<\/strong><\/a><strong>&nbsp;in your browser<\/strong>, and you should be able to see the list of Devilbox virtual hosts.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" width=\"994\" height=\"694\" src=\"https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/devilbox-project-1.png\" alt=\"devilbox-project-1\" class=\"wp-image-714\" srcset=\"https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/devilbox-project-1.png 994w, https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/devilbox-project-1-300x209.png 300w, https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/devilbox-project-1-768x536.png 768w\" sizes=\"(max-width: 994px) 100vw, 994px\" \/><\/figure><\/div>\n\n\n\n<p>3. <strong>Stop Devilbox containers<\/strong><\/p>\n\n\n\n<p>Press CTRL+C in Ubuntu Terminal or run the following command:<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">docker-compose stop<\/code><\/pre><\/div>\n\n\n\n<p>Then remove containers:<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">docker-compose rm -f<\/code><\/pre><\/div>\n\n\n\n<p><strong>4. Create a new DNS entry by editing the Hosts file<\/strong><\/p>\n\n\n\n<p>Typically, you would create a DNS entry on Ubuntu since Docker and Devilbox are installed there. However, with WSL, this process is slightly different. During the Ubuntu startup process, the Ubuntu hosts file is automatically synchronized with the Windows hosts file. Therefore, make sure to add your new DNS entries in the Windows file first and then restart Ubuntu to synchronize files. Or simply add the same entries in both OS.<\/p>\n\n\n\n<p><strong>Let\u2019s add a new DNS entry in Windows:<\/strong><\/p>\n\n\n\n<ol type=\"a\"><li>Press the Windows key.<\/li><li>Type Notepad in the search field.<\/li><li>In the search results, right-click on Notepad and select \u201cRun as Administrator\u201d.<\/li><li>From Notepad, open the following file:<\/li><\/ol>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">c:\\Windows\\System32\\Drivers\\etc\\hosts<\/code><\/pre><\/div>\n\n\n\n<p>5. Add the following line on the bottom of the file:<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">127.0.0.1 mytest.loc<\/code><\/pre><\/div>\n\n\n\n<p>Where the \u201cmytest.loc\u201d is our website URL<\/p>\n\n\n\n<p>6. Select <strong>File<\/strong> &gt; <strong>Save<\/strong> to save your changes.<\/p>\n\n\n\n<p>Here is how your Windows hosts file may look like after the new DNS entry was added:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" width=\"947\" height=\"568\" src=\"https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/pasted-image-0-6.png\" alt=\"windows-hosts-file\" class=\"wp-image-715\" srcset=\"https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/pasted-image-0-6.png 947w, https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/pasted-image-0-6-300x180.png 300w, https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/pasted-image-0-6-768x461.png 768w\" sizes=\"(max-width: 947px) 100vw, 947px\" \/><\/figure><\/div>\n\n\n\n<p>5. <strong>Synchronize Ubuntu hosts file with Windows<\/strong><\/p>\n\n\n\n<p>There will be many cases when we need to restart Ubuntu. Unfortunately, Ubuntu won\u2019t reboot once we close all bash windows. You can restart Windows to reboot Ubuntu or restart the following&nbsp;<a href=\"https:\/\/github.com\/microsoft\/WSL\/issues\/634\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">Windows service \u2013&nbsp;<strong>\u201cLxssManager\u201d<\/strong><\/a>.<\/p>\n\n\n\n<ol><li>Close all existing WSL console sessions<\/li><li>Reboot the \u201cLxssManager\u201d service:<ul><li>Type the \u201cservices\u201d in the Windows search box and hit enter:<\/li><li>Find \u201cLxssManager\u201d in the list, right-click and select \u201cRestart\u201d from the context menu.<\/li><\/ul><\/li><\/ol>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" width=\"806\" height=\"593\" src=\"https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/restart-ubuntu.png\" alt=\"restart-ubuntu\" class=\"wp-image-716\" srcset=\"https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/restart-ubuntu.png 806w, https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/restart-ubuntu-300x221.png 300w, https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/restart-ubuntu-768x565.png 768w\" sizes=\"(max-width: 806px) 100vw, 806px\" \/><\/figure><\/div>\n\n\n\n<p>6. <strong>Open a new Ubuntu session and check your&nbsp;\/etc\/hosts&nbsp;file<\/strong>&nbsp;to see if the DNS entries were synchronized successfully:<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">cat \/etc\/hosts<\/code><\/pre><\/div>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" width=\"880\" height=\"453\" src=\"https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/ubuntu-hosts-file.png\" alt=\"ubuntu-hosts-file\" class=\"wp-image-717\" srcset=\"https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/ubuntu-hosts-file.png 880w, https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/ubuntu-hosts-file-300x154.png 300w, https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/ubuntu-hosts-file-768x395.png 768w\" sizes=\"(max-width: 880px) 100vw, 880px\" \/><\/figure><\/div>\n\n\n\n<p>7. <strong>Edit the main configuration file<\/strong><\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">cd ~\/devilbox\/\nvi .env<\/code><\/pre><\/div>\n\n\n\n<p>Then set the IP address of docker services on Windows machine (big thanks to user&nbsp;<a href=\"https:\/\/devilbox.discourse.group\/u\/amida\/summary\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">Amida<\/a>&nbsp;for your help on this). Find \u201cLOCAL_LISTEN_ADDR\u201d setting, and replace it with the following:<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">LOCAL_LISTEN_ADDR=127.0.0.1:<\/code><\/pre><\/div>\n\n\n\n<p>Save changes.<\/p>\n\n\n\n<p><strong>8. Create an index file<\/strong><\/p>\n\n\n\n<p>Open Ubuntu terminal and type the following command:<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">echo \"&lt;?php echo 'hello world';\" > ~\/devilbox\/data\/www\/mytest\/htdocs\/index.php<\/code><\/pre><\/div>\n\n\n\n<p>9. <strong>Start Devilbox containers<\/strong><\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">sudo service docker start\ndocker-compose up<\/code><\/pre><\/div>\n\n\n\n<p>10. <strong>Now head back to&nbsp;<\/strong><a href=\"http:\/\/localhost\/vhosts.php\" target=\"_blank\" rel=\"noreferrer noopener nofollow\"><strong>http:\/\/localhost\/vhosts.php<\/strong><\/a><strong>&nbsp;in your browser&nbsp;<\/strong>and you should be able to see \u201cOK\u201d message next to \u201cmytest.loc\u201d host.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" width=\"1035\" height=\"685\" src=\"https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/virtual-hosts-ok.png\" alt=\"virtual-hosts-ok\" class=\"wp-image-723\" srcset=\"https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/virtual-hosts-ok.png 1035w, https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/virtual-hosts-ok-300x199.png 300w, https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/virtual-hosts-ok-1024x678.png 1024w, https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/virtual-hosts-ok-768x508.png 768w\" sizes=\"(max-width: 1035px) 100vw, 1035px\" \/><\/figure><\/div>\n\n\n\n<p>Open&nbsp;<a href=\"http:\/\/mytest.loc\/\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">http:\/\/mytest.loc\/<\/a>&nbsp;to see a \u201cHello World\u201d message<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" width=\"698\" height=\"529\" src=\"https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/hello-world-ok.png\" alt=\"hello-world-ok\" class=\"wp-image-724\" srcset=\"https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/hello-world-ok.png 698w, https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/hello-world-ok-300x227.png 300w\" sizes=\"(max-width: 698px) 100vw, 698px\" \/><\/figure><\/div>\n\n\n\n<p>Congratulations! Your first website on Devilbox is running successfully.<\/p>\n\n\n\n<p>11. <strong>Automatically start the Docker daemon on Login&nbsp;(Optional step)<\/strong><\/p>\n\n\n\n<p>The WSL doesn\u2019t launch at Windows boot, but only when the user establishes a login session. So without any real \u201csystem start\u201d, the init.d or systemd startup doesn\u2019t happen. The following commands help to start the docker service on each login.<\/p>\n\n\n\n<p>Edit sudoers on Ubuntu<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">sudo visudo<\/code><\/pre><\/div>\n\n\n\n<p>Add the following line by changing the \u201cUserName\u201d to your Ubuntu username.<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">UserName ALL = (root) NOPASSWD: \/usr\/sbin\/service docker *<\/code><\/pre><\/div>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" width=\"979\" height=\"472\" src=\"https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/privileges.png\" alt=\"start-the-docker-service-on-each-login\" class=\"wp-image-727\" srcset=\"https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/privileges.png 979w, https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/privileges-300x145.png 300w, https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/privileges-768x370.png 768w\" sizes=\"(max-width: 979px) 100vw, 979px\" \/><\/figure><\/div>\n\n\n\n<p>Edit your user startup scripts<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">vi ~\/.profile<\/code><\/pre><\/div>\n\n\n\n<p>Add the following lines:<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\"># start docker service\nsudo service docker start<\/code><\/pre><\/div>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" width=\"979\" height=\"529\" src=\"https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/start-docker-on-boot.png\" alt=\"start-docker-on-boot\" class=\"wp-image-729\" srcset=\"https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/start-docker-on-boot.png 979w, https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/start-docker-on-boot-300x162.png 300w, https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/start-docker-on-boot-768x415.png 768w\" sizes=\"(max-width: 979px) 100vw, 979px\" \/><\/figure><\/div>\n\n\n\n<p>Now, each time you log in to Ubuntu, you will be prompted for your password, and the Docker service will start.<\/p>\n\n\n\n<h2><strong>Step 9. Install Magento 2 on Devilbox<\/strong><\/h2>\n\n\n\n<p>The official Devilbox documentation is located&nbsp;<a href=\"https:\/\/devilbox.readthedocs.io\/en\/latest\/examples\/setup-magento2.html\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">here<\/a>. Feel free to use it as your main guide. We will add only a slight change to the installation process.<\/p>\n\n\n\n<div class=\"wp-block-group pr-notice pr-notice-info\"><div class=\"wp-block-group__inner-container\">\n<p class=\"pr-notice-title\"><strong>Note:<\/strong><\/p>\n\n\n\n<p>This tutorial provides instructions on how to install Magento 2.3.6 with Docker.  If you need a newer version of Magento, please follow the updated guide &#8211; to <a href=\"https:\/\/plumrocket.com\/learn\/install-magento-24-docker\">Install Magento 2.4.x with Docker and Devilbox<\/a>.<\/p>\n<\/div><\/div>\n\n\n\n<p>First, it\u2019s important to make sure that our configuration file meets all&nbsp;<a href=\"https:\/\/devdocs.magento.com\/guides\/v2.3\/install-gde\/system-requirements.html\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">Magento 2.3 system requirements<\/a>. The following configuration will be set in the environment file:<\/p>\n\n\n\n<ul><li>Apache v2.4<\/li><li>PHP v7.3<\/li><li>MariaDB v10.4<\/li><\/ul>\n\n\n\n<ol><li><strong>Stop Devilbox containers if they are running<\/strong><\/li><\/ol>\n\n\n\n<p>Press \u201cCTRL+C\u201d in Ubuntu Terminal or<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">docker-compose stop<\/code><\/pre><\/div>\n\n\n\n<p>Then remove all containers:<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">docker-compose rm -f<\/code><\/pre><\/div>\n\n\n\n<p>2. <strong>Edit the main configuration file<\/strong><\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">cd ~\/devilbox\/\nvi .env<\/code><\/pre><\/div>\n\n\n\n<p>Comment out the Nginx web server line and uncomment Apache<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">HTTPD_SERVER=apache-2.4\n#HTTPD_SERVER=nginx-stable<\/code><\/pre><\/div>\n\n\n\n<p>Comment out the PHP7.4 and uncomment PHP7.3<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">PHP_SERVER=7.3\n#PHP_SERVER=7.4<\/code><\/pre><\/div>\n\n\n\n<p>Optionally, you can disable xdebug to speed up your webserver<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">PHP_MODULES_DISABLE=oci8,PDO_OCI,pdo_sqlsrv,sqlsrv,rdkafka,swoole,xdebug<\/code><\/pre><\/div>\n\n\n\n<p>Save changes.<\/p>\n\n\n\n<p>3. <strong>Create DNS records in Windows &amp; Ubuntu<\/strong><\/p>\n\n\n\n<p>In the terminal, edit the Ubuntu hosts file:<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">sudo vi \/etc\/hosts<\/code><\/pre><\/div>\n\n\n\n<p>Add this line and save changes:<br><strong>127.0.0.1 my-magento.loc<\/code><\/strong><\/p>\n\n\n\n<p>In Windows, open Notepad as administrator and edit the following file:<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">c:\\Windows\\System32\\Drivers\\etc\\hosts<\/code><\/pre><\/div>\n\n\n\n<p>Add the same line as in Ubuntu and save changes:<br><strong><code>127.0.0.1 my-magento.loc<\/code><\/strong><\/p>\n\n\n\n<p><strong>4. Enter the PHP Docker container<\/strong><\/p>\n\n\n\n<p>Start Devilbox containers<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">sudo service docker start\ndocker-compose up<\/code><\/pre><\/div>\n\n\n\n<p>Open a new tab in the Windows terminal and enter the following<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">cd ~\/devilbox\/\n.\/shell.sh<\/code><\/pre><\/div>\n\n\n\n<p>5. <strong>Create new Virtual Host directory<\/strong><\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">cd \/shared\/httpd\nmkdir my-magento<\/code><\/pre><\/div>\n\n\n\n<p>6. <strong>Install Magento 2<\/strong><\/p>\n\n\n\n<p>We will be installing the latest stable 2.3.x version of Magento using composer v1.x.<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">cd my-magento\ngit clone https:\/\/github.com\/magento\/magento2\ncd magento2\ngit checkout 2.3.6\ncomposer-1 install\ncomposer-1 update<\/code><\/pre><\/div>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" width=\"1115\" height=\"624\" src=\"https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/29.png\" alt=\"install-magento-2-via-composer-terminal\" class=\"wp-image-739\" srcset=\"https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/29.png 1115w, https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/29-300x168.png 300w, https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/29-1024x573.png 1024w, https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/29-768x430.png 768w\" sizes=\"(max-width: 1115px) 100vw, 1115px\" \/><\/figure><\/div>\n\n\n\n<p>Symlink webroot<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">cd \/shared\/httpd\/my-magento\/\nln -s magento2\/ htdocs<\/code><\/pre><\/div>\n\n\n\n<p>Create MySQL Database<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">mysql -u root -h 127.0.0.1 -p -e 'CREATE DATABASE my_magento;'<\/code><\/pre><\/div>\n\n\n\n<p><em>* Please note: in default Devilbox configuration, the Mysql root password is not set. Just hit \u201center\u201d when asked for a password.<\/em><\/p>\n\n\n\n<p>7. <strong>Set file permissions<\/strong>.<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">cd \/shared\/httpd\/my-magento\/htdocs\nfind var generated vendor pub\/static pub\/media app\/etc -type f -exec chmod g+w {} +\nfind var generated vendor pub\/static pub\/media app\/etc -type d -exec chmod g+ws {} +\nchmod u+x bin\/magento<\/code><\/pre><\/div>\n\n\n\n<p>8. <strong>Run Web Installer<\/strong><\/p>\n\n\n\n<p>Go to http:\/\/my-magento.loc in your browser and follow the installation steps.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" width=\"935\" height=\"664\" src=\"https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/magento-installation.png\" alt=\"magento-installation\" class=\"wp-image-743\" srcset=\"https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/magento-installation.png 935w, https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/magento-installation-300x213.png 300w, https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/magento-installation-768x545.png 768w\" sizes=\"(max-width: 935px) 100vw, 935px\" \/><\/figure><\/div>\n\n\n\n<p>Make sure to enter the following information during installation:<\/p>\n\n\n\n<p><strong>Database Server Host<\/strong>: 127.0.0.1<br><strong>Database Server Username<\/strong>: root<br><strong>Database Server Password<\/strong>: (leave it empty)<br><strong>Database Name<\/strong>: my_magento<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" width=\"1119\" height=\"922\" src=\"https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/magento-installation3.png\" alt=\"magento-installation3\" class=\"wp-image-745\" srcset=\"https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/magento-installation3.png 1119w, https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/magento-installation3-300x247.png 300w, https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/magento-installation3-1024x844.png 1024w, https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/magento-installation3-768x633.png 768w\" sizes=\"(max-width: 1119px) 100vw, 1119px\" \/><\/figure><\/div>\n\n\n\n<p>After completing a few simple steps, the Magento will be installed successfully.<\/p>\n\n\n\n<h2><strong>Step 10. Install WordPress<\/strong><\/h2>\n\n\n\n<p>This is going to be the last step in our tutorial. Installation of WordPress is also described in the&nbsp;<a href=\"https:\/\/devilbox.readthedocs.io\/en\/latest\/examples\/setup-wordpress.html\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">Devilbox documentation<\/a>.<\/p>\n\n\n\n<ol><li><strong>Create DNS records in Windows &amp; Ubuntu<\/strong><\/li><\/ol>\n\n\n\n<p>In the terminal, edit the Ubuntu hosts file:<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">sudo vi \/etc\/hosts<\/code><\/pre><\/div>\n\n\n\n<p>Add this line and save changes:<br><strong><code>127.0.0.1 my-wp.loc<\/code><\/strong><\/p>\n\n\n\n<p>In Windows, open Notepad as administrator and edit the following file:<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">c:\\Windows\\System32\\Drivers\\etc\\hosts<\/code><\/pre><\/div>\n\n\n\n<p>Add the same line as in Ubuntu and save changes:<br><strong><code>127.0.0.1 my-wp.loc<\/code><\/strong><\/p>\n\n\n\n<p>2. <strong>Enter the PHP Docker container<\/strong><\/p>\n\n\n\n<p>Start Devilbox containers<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-\">sudo service docker start\ndocker-compose up<\/code><\/pre><\/div>\n\n\n\n<p>Open a new tab in the Windows terminal and enter the following<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">cd ~\/devilbox\/\n.\/shell.sh<\/code><\/pre><\/div>\n\n\n\n<p>3. <strong>Create a new Virtual Host directory<\/strong><\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">cd \/shared\/httpd\nmkdir my-wp<\/code><\/pre><\/div>\n\n\n\n<p>4. <strong>Install WordPress in Devilbox<\/strong><\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">cd my-wp\ngit clone https:\/\/github.com\/WordPress\/WordPress wordpress.git<\/code><\/pre><\/div>\n\n\n\n<p>Symlink webroot<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">cd \/shared\/httpd\/my-wp\/\nln -s wordpress.git\/ htdocs<\/code><\/pre><\/div>\n\n\n\n<p>Create MySQL Database<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">mysql -u root -h 127.0.0.1 -p -e 'CREATE DATABASE my_wp;'<\/code><\/pre><\/div>\n\n\n\n<p><em>* Please note: in the default Devilbox configuration, the Mysql root password is not set. Just hit \u201center\u201d when asked for a password.<\/em><\/p>\n\n\n\n<p>5. <strong>Run Web Installer<\/strong><\/p>\n\n\n\n<p>Go to http:\/\/my-wp.loc in your browser and follow the installation steps. Just make sure to enter 127.0.0.1 as the database host during installation.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" width=\"1297\" height=\"750\" src=\"https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/wordpress-installation.png\" alt=\"wordpress-installation\" class=\"wp-image-755\" srcset=\"https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/wordpress-installation.png 1297w, https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/wordpress-installation-300x173.png 300w, https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/wordpress-installation-1024x592.png 1024w, https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/wordpress-installation-768x444.png 768w\" sizes=\"(max-width: 1297px) 100vw, 1297px\" \/><\/figure><\/div>\n\n\n\n<p>After completing a few simple steps, the WordPress will be installed successfully.<\/p>\n\n\n\n<p>We hope you found this article useful. Please comment and share. Thanks for reading!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In 10 simple steps, you should learn how to launch any website on your local machine quickly. You will be able to enjoy the speed of Linux tools and the convenience of Windows.<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0},"categories":[143],"tags":[149,148,142,147],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v16.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to Install Magento 2 &amp; WordPress on WSL2 with Docker and Devilbox - Magento Tutorials for Beginners &amp; Professionals<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/plumrocket.com\/learn\/devilbox-docker-wsl2\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Install Magento 2 &amp; WordPress on WSL2 with Docker and Devilbox - Magento Tutorials for Beginners &amp; Professionals\" \/>\n<meta property=\"og:description\" content=\"In 10 simple steps, you should learn how to launch any website on your local machine quickly. You will be able to enjoy the speed of Linux tools and the convenience of Windows.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/plumrocket.com\/learn\/devilbox-docker-wsl2\" \/>\n<meta property=\"og:site_name\" content=\"Magento Tutorials for Beginners &amp; Professionals\" \/>\n<meta property=\"article:published_time\" content=\"2021-09-01T11:30:54+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-10-05T15:50:46+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2021\/08\/Develop-for-Magento-2-WordPress-with-WSL2.png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"18 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","_links":{"self":[{"href":"https:\/\/plumrocket.com\/learn\/wp-json\/wp\/v2\/posts\/669"}],"collection":[{"href":"https:\/\/plumrocket.com\/learn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/plumrocket.com\/learn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/plumrocket.com\/learn\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/plumrocket.com\/learn\/wp-json\/wp\/v2\/comments?post=669"}],"version-history":[{"count":91,"href":"https:\/\/plumrocket.com\/learn\/wp-json\/wp\/v2\/posts\/669\/revisions"}],"predecessor-version":[{"id":1157,"href":"https:\/\/plumrocket.com\/learn\/wp-json\/wp\/v2\/posts\/669\/revisions\/1157"}],"wp:attachment":[{"href":"https:\/\/plumrocket.com\/learn\/wp-json\/wp\/v2\/media?parent=669"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/plumrocket.com\/learn\/wp-json\/wp\/v2\/categories?post=669"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/plumrocket.com\/learn\/wp-json\/wp\/v2\/tags?post=669"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}