Menu

React, etc. Tech Stack

React, Flux, GraphQL, Hack, HHVM...? All of this and more!

Installing WordPress on Windows Subsystem for Linux (WSL/Ubuntu)

Developers in Windows environments have traditionally used XAMP or other similar installations for WordPress development. In more recent setups Vagrant, Virtual Box and Docker have become popular. But with the release of Windows 10 Anniversary Update developers can run WordPress in a Linux shell right in Windows.

With Windows 10 Anniversary Update launched on August 2nd 2016 WordPress developers now have the capability to run a Linux shell within Windows. This feature is known as the Windows Subsystem for Linux and it allows running all command line Linux applications. The Linux version installed is the Ubuntu Linux from Canonical and is great for custom PHP development or Drupal.

When using the WSL environment you don't need a separate Virtual Machine running, instead you open a command line that runs Linux via a transparent translation layer. When in this console you can use all the tools that you have access to in a regular Ubuntu machine, but without the overhead of a VM. You also have native access to you files, so it is fast.

Installing WordPress to Windows Subsystem for Linux

First of all you will need to get Windows Subsystem for Linux running on your computer:

  1. Make sure you are running the Windows 10 Anniversary Update
  2. Enable Developer Mode from the Control Panel
  3. Go to Windows features to find and enable "Windows Subsystem for Linux"
  4. Reboot your computer
  5. After login run the "Bash" command
  6. Accept and install installation of Ubuntu Linux from Canonical
  7. Set Linux username and password

After this you have got access to a Ubuntu Linux shell right on your Windows Machine! The next step is to update it with the latest upgrades. Issue the commands:

The upgrade will take a few moments, but after that you have got all the latest updates from Canonical to your Ubuntu installation. Next you will need to install all the LAMP environment components to get WordPress up and running on Windows (thinking it's on Linux).

Issue this command to install the Apache Web Server, the MySQL database server and the PHP language and some additional utilities to get you started:

Next up we will need to start Apache2 and MySQL servers:

Once you have these steps you've got all it takes to run WordPress up and running:

Before downloading WordPress, now is a great time to setup a MySQL database for WordPress:

In our case we will use the mysql root user to access the database. This is ok as this environment is for local development only.

Now that we have a database we can continue with WordPress installation. You can use your Windows desktop browser to head over to WordPress.org to download the latest version. We will assume it is downloaded to the standard download environment.

Once the download is complete return to the Ubuntu Bash shell and execute:

Now you have the WordPress files in your document root. Because the Apache process is running on your local machine and you can return to your browser and open up http://localhost/wordpress/ and start WordPress installation.

After the installation you've got WordPress thinking running on Linux, right in Windows:

WordPress running on Windows Subsystem for LinuxWindows Subsystem for Linux can be used to run WordPress and other PHP applications

Written by Jorgé on Sunday August 7, 2016

Permalink -

« Don't use Drupal or WordPress for IoT, Internet of Things - REST vs GraphQL »