Running the Ubuntu VSTS Agent on Windows Subsystem for Linux (WSL)

I was playing with the new ASP.NET Core Template in Visual Studio 2017 and I thought it would be interesting to spin up a Linux Agent right on my Windows 10 Pro installation.

UPDATE:  September 5th, 2017 – Upgrade Git Client to 2.14.1 from 2.7.4

Turn Windows Features On or Off

You need to enable the following feature in Windows 10.  Perform the following steps:

  • Open Control Panel
  • Click on Programs (above Uninstall a program)
  • Click Turn Windows features on or off (under Programs and Features)
  • Scroll down the list of features and near the bottom of the dialog click on Windows Subsystem for LinuxWindows Subsystem for Linux



Turn Windows features on or off | Windows Subsystem for Linux

  • Click Ok
  • Wait for the feature to install and restart.
  • You then need to go to the Store and select a version of Linux to install

Ubuntu Installation

Open the Windows Store App, using the Search box type Linux and press enter, then select Get the apps



Linux on Windows? Totally?


Select Ubuntu


Windows Store | Run Linux on Windows



Ubuntu | Click Install


After the installation is complete you can start Ubuntu by selecting Launch which will be displayed in place of Install.  You can also start Ubuntu from a command prompt by typing ubuntu and pressing <enter>.  The first time you start Ubuntu you will have to wait a few minutes while it completes the installation.  You will have to create a default UNIX user account and password to complete the configuration.  If you need to run a command as administrator, use sudo <command>.


Ubuntu | Installation Successful

.NET Core 2.0.0

We need to have .NET Core installed in Ubuntu to configure the Visual Studio Team Services Agent.  This requires a few extra steps as documented here.  Here are the commands I executed:

curl | gpg --dearmor > microsoft.gpg
sudo mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg
sudo sh -c 'echo "deb [arch=amd64] xenial main" > /etc/apt/sources.list.d/dotnetdev.list'
sudo apt-get update
sudo apt-get install dotnet-sdk-2.0.0



Install .NET Core 2.0.0 for Ubuntu 16.04


Upgrade Git Client

You can update the client in Ubuntu to get rid of the following message during the Get Sources task



Upgrade your Git Version


Execute the following commands in the console to upgrade to 2.14.1

sudo add-apt-repository ppa:git-core/ppa
sudo apt-get update
sudo apt-get install git

Here is a screenshot of the result


Now if you trigger a build, you will no longer see the message


Ubuntu Version and Font

You can check the version of your Ubuntu install #CheckyourUbuntuVersion using the command lsb_release -a

The version installed with the Ubuntu Store App is Release 16.04 at the time of this post.  If you want the Ubuntu font for your terminal you can download from here.  Install the font using the file named UbuntuMono-R.ttf by right clicking and selecting Install.


Install the VSTS Agent on Ubuntu

We need to go to GitHub and download the release for our operating system (Ubuntu 16.04).  You can find the releases here.  I will be downloading a pre-release tagged v2.122.0 for Ubuntu 16.04.

I used my browser to download the pre-release which means I need to access my downloads folder from within the Ubuntu terminal.  I can access my downloads folder at the following path /mnt/c/Users/Wes/Downloads/ (Note:  Directories and Filenames are case-sensitive)

Using the steps posted on GitHub as a guide, I executed the following commands inside the Ubuntu terminal to extract the agent into a folder named myagent.

mkdir myagent && cd myagent
tar xzf /mnt/c/Users/Wes/Downloads/vsts-agent-ubuntu.16.04-x64-2.122.0.tar.gz
ls -l



Extract the VSTS Agent


Now we are ready to configure the agent and connect it to our VSTS account.  To do that we use the command and provide the values requested.  Note: You will be required to supply a PAT (Personal Access Token) to connect the agent to your account.

If your repository is using TFVC make sure you answer Y to the question whether to install Team Explorer Everywhere.  See screenshot below

The values you will require are:

Server URL: https://{account-name}
Personal Access Token: See instructions here.
Agent Pool: default
Agent Name: Any name you'd like
Work Folder: _work



You can start the agent by executing the command shown above.  If all is well you can create a .NET Core build and configure it to use your default queue where the agent is configured and running.  Here is a screenshot of sample build I executed on the agent configured above.



ASP.NET .NET Core Demo Build Result



Hopefully I didn’t miss anything, of course feel free to leave a comment.


About Wes MacDonald

Wes MacDonald is a DevOps Consultant for LIKE 10 INC., a DevOps consulting firm providing premium support, guidance and services for Azure, Microsoft 365 and Azure DevOps.

2 Responses to “Running the Ubuntu VSTS Agent on Windows Subsystem for Linux (WSL)”

  1. Great post, I always created dedicated virtual machines for linux build agent, but using the ubuntu in windows is really interesting approach. For everyone that is going to follow this path, always check if your ubuntu version is the latest, as wes suggested with the

    lsb_release -a

    command. If you, like me, still have version 14.04 I strongly suggest to upgrade to 16.04 with the command

    sudo do-release-upgrade



  1. Microsoft DevOps Blog - September 6, 2018

    […] Running the Ubuntu VSTS Agent on Windows Subsystem for Linux (WSL) – Wes MacdonaldI was playing with the new ASP.NET Core Template in Visual Studio 2017 and I thought it would be interesting to spin up a Linux Agent right on my Windows 10 Pro installation. […]


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: