Skip to content

Backgrounds

How-to Guides

Technical References

Local development /

Set up a VIP Go local development environment for Windows

Pro Tip

A new, easy to use VIP local development solution is in beta. It allows developers to set up and tear down local environments quickly. We encourage you to test it out; feedback is welcome!

For non-Windows-specific development, please see our local development documentation.

Prerequisites

Everything in this task list assumes you have administrative access to the host machine. For Windows 10 hosts, any command prompt, PowerShell, VS Code instance which is run must be Run as Administrator.

Directions

Step 1

On Windows 10, install Git for Windows and the OpenSSH client.

Step 2

Enable the OpenSSH Authentication Agent service for automatic starting, which is disabled by default. Then add the SSH key associated with your Github account to the agent via PowerShell or command prompt. Create a key first if necessary, then run:
ssh-add {path_to_public_key}

Step 3

Configure Git to use OpenSSH, and increase the size of Git packages and buffers to allow large file and pack transfers. Add the following settings to your user profiles .gitconfig, the sections are listed, do not create duplicate sections, append if needed.

[core]
    autocrlf = true
    sshCommand = C:\\\\Windows\\\\System32\\\\OpenSSH\\\\ssh.exe
    packedGitLimit = 128m
    packedGitWindowSize = 128m
[pack]
    deltaCacheSize = 128m
    packSizeLimit = 128m
    windowMemory = 128m
[http]
    postBuffer = 1024m

Step 4

Run the VVV installation. If you run into issues installing, try a previous, known good VirtualBox version. Follow through running vagrant up for the first time; additional sites can be added later. Later instructions will refer to the base installation folder for VVV, where you checked it out, as {vvv_path}.

Step 5

Create a new VVV site by following the VIP Go Local instructions.

Once done, enable helpful utilities by modifying the config files utilities section:

utilities:
  core:
    - memcached-admin
    - opcache-status
    - phpmyadmin
    - webgrind
    - trusted-hosts
    - tls-ca

Finally, increase the resources, and optionally add a static IP to your instance. In this example, the VirtualBox network uses 192.168.56.0/24, and I am assigning the instance the IP 192.168.56.75. Remove the private_network_ip and network_ip lines if not needed.

vm_config:
  memory: 4096
  cores: 2
  private_network_ip: 192.168.56.75
  network_ip: 192.168.56.75

Step 6

Copy the database dump SQL file you have to database/sql/backups directory, and change the name to match the site definition name, in this example vipgo. If you do this before you reprovision, it will load this dump file when provisioning as the sites database. You can do a find/replace on the file before loading (may be slow with a large file), or use WP CLI inside the instance to change the domain names.

Step 7

Reprovision the instance to create the new site:

vagrant reload --provision

Step 8

Perform a WP CLI search-replace to update domain names and links. In this example, assume the initial domain name is prod-vip.go, which will be replaced with vipgo.test. From a command prompt, in a directory inside the {vvv_path}, SSH into the Vagrant instance:

vagrant ssh

Then switch to the site path, in this example, /srv/www/vipgo/public_html/, and run the following search-replace:

wp search-replace 'prod-vip.go' 'vipgo.test' --recurse-objects --all-tables --skip-tables=wp_*users

Step 9

In order to use VVV certificates and avoid security warnings, you need to add the certificate authority as a Trusted Root CA. You can find instructions to update your host system here. On Windows 10, this is done from a command prompt on the host using the following command:

certutil -enterprise -f -v -AddStore "Root" "certificates/ca/ca.crt"

Step 10

For Windows 10 users hosting on VirtualBox and needing to cross-browser test in Microsoft Edge, there is currently an issue with connecting to the VirtualBox Host Adapter. You can disable this by modifying the *NdisDeviceType registry key of the adapter, and setting the value to 0 from 1. You need to identify the correct adapter, referenced in the following path by {adpater_id}:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4d36e972-e325-11ce-bfc1-08002be10318}\{adapter_id}\*NdisDeviceType
	

Caution

Reboot after changing this setting, make sure you vagrant up, then test. Do this at your own risk.

Git for Windows

OpenSSH Installation

VVV CA Certificate

VVV Custom Site Template

VVV Installation

VVV Instance HTTPS

VVV System Requirements

Thanks to Ryan Leeson of Trellist for the work in putting this guide together.

Last updated: June 28, 2021