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.

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.

^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.

screen

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.

Press Ctrl+a

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:

Press Ctrl+a

Press n

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

Press Ctrl+a

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.