This is a step-by-step guide on how to install Magento 2 on a Windows 10 machine. We’ve noticed a lot of developers have trouble finding detailed instructions on how to install Magento on different configurations. This guide can be used as a manual to deploy Magento 2 on a Windows 10 PC using Vagrant and Oracle Virtual Machine.
Please note that the official Magento 2 development environment guide is available here.
Step 1. Turn on Virtualization Options in UEFI BIOS
Some chip manufacturers (cough..Intel) like to turn off additional CPU options by default. Virtualization is one of them. And since we are going to use Oracle VM to run Magento 2 on our setup, we need to go to UEFI BIOS first.
Enter UEFI by whatever key combination does it for you. Depending on the motherboard manufacturer, it could be Delete, Enter, F2, F10, F12, Escape. If you have trouble finding the right key and can’t look it up online for whatever reason, go to your Windows 10 settings. Hit the WINDOWS key and type Change Advanced Startup Options.
Please note that the Restart Now button will actually restart your PC. You still have to use it. It’s tough, I know.
Once you restart, new Advanced Restart Options will become available. On the screen that has appeared, choose Troubleshoot > Advanced Options > UEFI Firmware Settings and click Restart again. Now you are in the Advanced Restart menu.
Choose Troubleshoot > UEFI Firmware Settings.
This option will enable you to go right to the UEFI BIOS. Once you are there, find VTx and check the box. You don’t need VTd but you can turn it on as well if you want.
Please note that in this guide, we assume that you have Windows 10 64-bit Pro, Education, or Enterprise editions. Turns out, Windows Home does not support virtualization options. Or at least it doesn’t support them consistently. We’ve had some success launching a virtual machine on Windows Home but sometimes it would work and sometimes it would not.
Just spare yourself the headache and upgrade your Windows to something other than the Barebones Edition.
Step 2. Install Vagrant
Go to Vagrant Downloads section and choose the right version for you. Download and install Vagrant.
Step 3. Install Oracle VM VirtualBox and Its Extensions
We need to complement Vagrant with virtual machine software. Download and install Oracle VM VirtualBox and its Extension Pack.
Step 4. Find a Suitable Devbox Package
Instead of downloading Magento 2 from the official website on your own, you can use Magento devbox to speed up the setup process. For example, let’s use Magento Fast VM. It’s a good candidate for our Magento 2 install guide.
Go to the project location and clone this project into your future Magento 2 folder:
git clone //github.com/zepgram/magento2-fast-vm.git
Copy and paste ssh.example folder, rename it to ssh, and put your id_rsa and id_rsa.pub keys inside.
To create your RSA keys, use PuttyGen in the configuration as shown below:
What we do here is we generate RSA SSH-2 keys for our developer environment, then put them into id_rsa and id_rsa.pub files respectively.
Step 5. Put Magento Credentials into the YAML Config File
Rename config.yaml.example into config.yaml. Open the file and find the composer section. You need to change user variables to your Magento 2 account keys. Replace magentoUsernameKey and magentoPasswordKey with your actual M2 credentials.
This is where you can find them:
Step 6. Setup Vmconf in the YAML Config File
Vmconf is the uppermost section of the YAML config file. It’s important that you configure it correctly. The default values that you find there need to be changed according to your actual needs.
In this example, we install M2 to magento2-test.local (change URL and host_name to this) with Network IP 10.0.0.210 (look up in host file).
Step 7. Uncomment v.gui=true in Vagrantfile
Uncomment the option # v.gui=true in Vagrantfile, you can comment it back after the first installation.
We should mention that this step is kind of optional. We ran Vagrant without uncommenting v.gui and nothing bad happened. But if you experience any issues, keep in mind that this step might save you some pain in the future.
Step 8. Vagrant Up!
Time to test what we’ve achieved. Run vagrant up and see what happens. After 15 or 20 minutes of downloading Magento, you will hopefully get a fully functioning local Magento 2 install.
Use vagrant ssh to access your local Magento server.
In this example, we’ve installed Magento 2 at //magento2-test.local. So this is the address you’ll use to interact with the site.
If you still have trouble running Vagrant successfully, visit your hosts file and make sure that the VM correctly adds its name to the hosts file. Go to C:\Windows\System32\drivers\etc\hosts and check that it has the following line:
What we need here is we want to resolve 127.0.0.1 localhost to the VM. You can also see I already have auto-generated Vagrant lines for my other Magento installs and also this new one.
Everything looks good? Fire up! Checking… And it’s up!
And don’t forget to turn to our Magento development services to hit all the bases.