Installing a VSTS build agent on a Ubuntu machine


The documentation on the Microsoft website is usually quite comprehensive and… at the same time sometimes not that easy to follow. When all you care about is installing a build agent on your Linux machine, so that you can run private builds controlled from VSTS, you may find that the docs tell you to jump between a few pages, mentioning other options and other possibilities on the way leaving you confused.

Once you get through all that you can find out that, in fact, all you had to do was the following:
1. Create a PAT and keep a copy of it
1. On Ubuntu, login as the user with which you want to run your build agent
2. Find a place where you want to create a folder that will hold the build agent’s binaries, for example: /home/{username}
2a. Invoke:
wget https://vstsagentpackage.azureedge.net/agent/2.134.2/vsts-agent-linux-x64-2.134.2.tar.gz
tar zxvf ./vsts-agent-linux-x64-2.134.2.tar.gz
3. Invoke (pick whatever directory name you want):
mkdir vsts-build-agent ; cd vsts-build-agent
4. Invoke:
sudo .\config.cmd
5. Provide the custom value or press Enter for the default one
6. As we want our agent to run as a service, here are the steps to get it set up this way:
6a. (Optional*) Invoke:
sudo nano svc.sh
6b. (Optional*) Update SVC_NAME as you need
6c. (Optional*) Update SVC_DESCRIPTION as you need
6d. Invoke:
sudo .\svc.sh install
sudo .\svc.sh start
7. Go to https://{accountname}.visualstudio.com/_admin/_AgentPool and verify if the new agent is indeed online

*) useful when you want to have multiple agents on the same machine

From now on while queuing a new build you will be able to select your new build agent.

Note that, as mentioned above, you can have as many build agents as you need on your machine, however, on the free tier, you will be allowed to run only one build at a time on whatever build agent. Fair enough! Once your project grows over time, your needs may grow, too. To increase throughput, you will need to purchase additional concurrent builds. For smaller projects, a single build should be just fine, though.

Have I already mentioned that I like VSTS? 😀

Now we can just hope that further updates to VSTS will not break it in any way for us and will only make it even more awesome!

Leave a Reply

Your email address will not be published.