Donovan Brown

Technology blog

Installing Visual Studio Team Services Build Agent on Ubuntu 15.10

I have tried and failed several times to install the VSTS build agent on Ubuntu so I thought I would write a post on how I got it to work. I will be using putty.exe to connect to the VM.

Install Java

Later we are going to install Maven that relies on Java, so we are going to install the latest version of Java now.

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update

Now we can actually install Java.

sudo apt-get install oracle-java8-installer

During the installation, you’ll be asked to agree to the license and then the installer starts downloading Java files from the Oracle website and installs it on your system.

Now we need to set the default version of Java to use.

sudo apt-get install oracle-java8-set-default

Verify Java

To verify that Java was installed successfully, run the following command:

java -version

Your output should be similar to the output below.

$ java -version
java version "1.8.0_72"
Java(TM) SE Runtime Environment (build 1.8.0_72-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.72-b15, mixed mode)

Install Node.js

To install the agent you first need to install Node.js on your Linux box. One thing to be aware of on Ubuntu servers is that because of a conflict with another package, the executable from the Ubuntu repositories is called nodejs instead of node. To fix this you can build node yourself with nvm and it will be node as you expect.  That is the route we are going to take. To begin we need to install the tools to build node.

sudo apt-get update
sudo apt-get install build-essential libssl-dev

Now we just need to get the installation script from GitHub. At the time of this writing, the latest tag was v0.30.1.

curl | sh
source ~/.profile

After, you will need to reboot your server.

sudo reboot

Now you can see what the latest version of node is by running this command.

nvm ls-remote

At the time of this writing, the latest version was v5.7.0. To install that version, run the following command.

nvm install 5.7.0

We want this to be the default version.

nvm alias default 5.7.0

Verify Node.js

To verify that node and npm were installed successfully, run the following command.

node -v && npm -v

Your output should be similar to the output below.

$ node -v && npm -v

The version of node (5.7.0) and the version of npm should be displayed.

Install Maven

We are doing to also install maven so we have a build engine on this agent.  Simply run the command below. Note that this command can take a long time to complete.

sudo apt-get install maven

Verify Maven

To verify that Maven was installed successfully, run the following command.

mvn -version

Your output should be similar to the output below.

$ mvn -version
Apache Maven 3.3.3
Maven home: /usr/share/maven
Java version: 1.8.0_72, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-8-oracle/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.2.0-30-generic", arch: "amd64", family: "unix"

Install Agent Installer

We are going to need a way to authenticate the agent, so we have to create a Personal Access Token.

  1. Log into VSTS
  2. Click your name in the upper right-hand corner
  3. Click My security
  4. Click Add under Personal access tokens
  5. Give the access token a name
  6. Select how long you want the token to be valid
  7. Select the accounts you want to be able to access this token
  8. Leave All scopes selected
  9. Click Create Token
  10. Copy the token value and store it somewhere safe

Installing Agent Installer

We are going to use NPM to install a Node Package that allows us to stamp out agents.

npm install -g vsoagent-installer

Stamping out Agent

Now that we have the Agent Installer, we can start stamping out agents.

  1. Create directory
    mkdir a1
  2. Change to the directory
    cd a1/
  3. Install Agent
    dbrown@LinuxBuild:~/a1$ vsoagent-installer
    Installing agent to /home/dbrown/a1
    Copying:  /home/dbrown/.nvm/versions/node/v5.7.0/lib/node_modules/vsoagent-installer/agent /home/dbrown/a1
    Copying:  /home/dbrown/.nvm/versions/node/v5.7.0/lib/node_modules/vsoagent-installer/node_modules /home/dbrown/a1
    writing: /home/dbrown/a1/package.json
    writing: /home/dbrown/a1/
    writing: /home/dbrown/a1/
    making scripts executable

Configure Agent

Now that we have an agent, we simply need to configure it.

node agent/vsoagent.js
Field Value
Enter alternate username {Email you log into VSTS with}
Enter alternate password {Personal Access Token}
Enter server url https://{instance}
Enter agent name {Any Name}
Enter agent pool name {Existing Pool}
Enter force basic false

Creating work folder ./_work ...
Creating env file /home/dbrown/a1/env.agent...
Saving configuration ...
2016-02-28T06:37:14.410Z: Agent Started.


At this point our agent is running. However, if we were to disconnect from our VM, the agent would stop.  We are going to fix that next.  For now, stop the agent by pressing Ctrl+C.

Shutting down host.


Running Agent with Screens

The agent can’t be installed as a service on Linux.  This limitation requires that you are connected to the VM for the agent to run.  If you disconnect from the VM, the agent would stop working.  We are going to use Screens to allow our agent to run even if we disconnect from the VM.  We are going to create a window where we can start the agent and leave it running.


Now that we are in a window, restart the agent.

node agent/vsoagent.js

Now that the agent is running, we are going to create another window so we can continue to use the VM.

  1. Press Ctrl+a
  2. Press c

You are now in a second window that allows you to continue to use your VM.  If you want to, return to the agent:

  1. Press Ctrl+a
  2. Press n

You can repeat the lines above to return to the other window.  While on the agent window, detach from the window:

  1. Press Ctrl+a
  2. Press d

Now you can safely close your VM connection and your agent will continue to run.  When you reconnect to your VM, simply enter the following command to load the agent window.

screen -r

Donovan Brown | Neptune (personal SMTP testing server)

Donovan Brown

Technology blog

Neptune (personal SMTP testing server)

Updated! There is a new version.

While working on a current project I found myself faced with testing code that sends email.  In the past I would end up with an inbox full of test messages or unhappy customers that wonder why they just received a flood of emails from my site.  I was also frustrated that there was no way to easily automate this testing.

Enter Neptune. Neptune is a SMTP Development Server targeted for use in automated testing. I simply asked the question, “what if I had a SMTP server that did not relay the message and allowed me to query for messages and their content”. I would be able to use a server of this type to act as my SMTP server during testing and write custom plug-ins, validation and extraction rules to communicate with the server.

The goals of Neptune were to facilitate automated testing and be easy to use. I did not want to have to install a service or understand everything there is to know about running a SMTP server. I simply want to start Neptune and run my test.

Full documentation on how to use Neptune is provided in the msi you can download here. NeptuneSetup.msi (1.27 mb) Original version

Neptune with POP3 NeptuneSetup.msi (1.40 mb) Newer version

If you find Neptune usefull feel free to Donate for future development.


Comments (12) -

  • Karim Kameka

    10/20/2008 1:24:06 PM |

    This tool is awesome and has allowed me to test my code with all the email portions on.  In the past I'd have to comment this code out and then remember to uncomment when we went live.  Also allows me to narrow down the problem to my code, some setting or the email server quickly and easily as this was just taking shots in the dark in the past.  Thanks!

  • Abel

    10/20/2008 2:10:58 PM |

    Awesome tool.  I just downloaded it and it does everything you said.  I was dreading setting up an smtp server and I really didn't want to stuff my mailbox full of test messages.

    Cool stuff.


  • Colin

    10/21/2008 9:35:53 AM |

    thanks, D.  This will solve some my problems and allow me to clean up my code a little.

  • Scott Allender

    10/21/2008 11:08:13 AM |

    slick idea.  i'll definitely be playing with it tonight.

  • David Kemp

    10/22/2008 7:12:40 AM |

    How do I get this to work in a Continuous Integration environment?

  • brady gaster

    10/22/2008 7:38:35 AM |

    DKemp - I would say use Process.Start to fire the app up. Then send your emails.
    DBrown - GREAT idea, sir. I'll be using this stat. Mui Bueno!

  • matthew

    10/22/2008 5:16:48 PM |

    Any chance of this showing up on codeplex (or the like) soon?

  • Simone

    10/27/2008 9:43:45 AM |

    That's awesome tool...
    till now I had a debugging configuration that automatically changed the email of the recipient to the test one so that users are not flooded by testing emails.. but this is completely transparent: just change the SMTP and everything works.

  • biggie9385

    1/13/2009 1:56:02 AM |

    If I put Neptune in the same machine with our test web server and have it point to, can I access Neptune from my desktop (this is a different machine from the web server) and run webtests?

  • smehaffie

    3/17/2009 11:06:39 AM |

    Are you considering posting this to codeplex?  Are you planning on releasing an upgrade?  If the answer is no to any of the questions above, would there be any way to get the source code for this?  The reason I am asking is that I would like to add some features to this.  This is great for automated/unit testing, but it would also be nice to have some additional features so it could be used for general testing.

    1) Ability to persist the messages to disk.  That way you can send the message to other who might want to see them (project managers, BU, etc).  This would also include deleting persisted messages.

    2) Ability to view the email messages.  When I am writing new functionality I want to be able to open the emails I just created to see the content.

    3) Ability to configure the application to load on startup.

    4) UI to make editing the config files easier.


  • EDI Services

    3/29/2009 1:10:30 AM |

    I just make a dummy email that way neither my customers or I are affected by the influx of a thousands emails. But Neptune sounds like a very good idea.

  • Paul Kohler

    5/21/2009 7:32:55 PM |

    Very nice.
    I like the idea of unit testing via the admin port, clever.
    PK  Wink

Pingbacks and trackbacks (6)+

Comments are closed