Before you can start customizing projects and creating build configurations, you need to configure build agents. Please review the agent-server communication and Prerequisites section before proceeding with agent installation.
|For the fallback bidirectional communication, in addition for the agent to server connections, the server must be able to open HTTP connections to the agent. The agent port is determined using the |
If the agent is behind NAT and cannot be accessed by any of addresses of the agent machine network interfaces, please specify the
Please ensure that any firewalls installed on the agent, server machine, or in the network and network configuration comply with these requirements.
- Log on as a service (to run as Windows service)
- Start/Stop service (to run as Windows service, necessary for the agent upgrade to work, see also Microsoft KB articleMicrosoft KB article)
- Debug programs (required for take process dump functionality to work)
Reboot the machine (for required for agent reboot functionality to work)
By default (since TeamCity 10), a TeamCity agent connects to the TeamCity server via the URL configured as the "serverUrl" agent property. This is called unidirectional agent-to-server connection. In rare cases, TeamCity may switch to old, bidirectional communication which also requires establishing a connection from the server to the agents.
Unless security in transfer between the agent and the server is important, it is recommended to deploy agents and the server into a secure environment and configure agents to use plain HTTP URL for the server as this reduces transfer overhead.
If for some reason the polling protocol cannot be used, TeamCity switches to the fallback bidirectional communication via xml-rpc (the default prior to TeamCity 10).
- Install a build agent using any of the following options:
- After installation, configure the agent specifying its name and the address of the TeamCity server in the
- Start the agent. If the agent does not seem to run correctly, please check the agent logs.
- In the TeamCity Web UI, navigate to the Agents tab.
- Click the Install Build Agents link and select MS Windows Installer to download the installer.
agentInstaller.exeWindows Installer and follow the installation instructions.
Please ensure that the user account used to run the agent service has appropriate permissions
- Make sure a JDK (JRE) 1.8 (versions 1.6-1.8 are supported, but 1.8 is recommended)is properly installed on the agent computer.
- On the agent computer, make sure the
JAVA_HOMEenvironment variables are set (pointing to the installed JRE or JDK directory respectively).
- In the TeamCity Web UI, navigate to the Agents tab.
- Click the Install Build Agents link and select Zip file distribution to download the archive.
- Unzip the downloaded file into the desired directory.
- Navigate to the
<installation path>\confdirectory, locate the file called
buildAgent.dist.propertiesand rename it to
- Edit the
buildAgent.propertiesfile to specify the TeamCity server URL and the name of the agent. Please refer to Build Agent Configuration section for details on agent configuration.
Under Linux, you may need to give execution permissions to the
On Windows you may also want to install the build agent windows service instead of the manual agent startup.
To configure the agent to be started automatically, see the corresponding sections:
Linux : configure daemon process with
agent.sh start command to start it and
agent.sh stop command to stop it.
Mac OS X
To run agent automatically on the machine boot under Windows, you can either set up the agent to be run as a Windows service or use another way of the automatic process start.
Using the Windows service approach is the easiest way, but Windows applies some constraints to the processes run this way.
A TeamCity agent works reliably under Windows service provided all the requirements are met, but is often not the case for the build processes configured to be run on the agent.
To run builds, the build agent must be started under a user with sufficient permissions for performing a build and managing the service. By default, a Windows service is started under the SYSTEM account which is not recommended for production use due to extended permisisons the account uses. To change it, use the standard Windows Services applet (Control Panel|Administrative Tools|Services) and change the user for the
The following instructions can be used to install the Windows service manually (e.g. after .zip agent installation). This procedure should also be performed to create Windows services for the second and following agents on the same machine.
To install the service:
The user account used to run the build agent service must have enough rights to start/stop the agent service, as described above.
Automatic Agent Start under Linux
Upgrade the Java automatically: if the appropriate Java version of the same bitness as the current one is detected on the agent, the agent page provides an action to upgrade the Java automatically. Upon the action invocation, the agent process is restarted (once the agent becomes idle, i.e. finishes the current build if there is one) using the new java.
Upon the action invocation, the path to the detected Java is saved into the conf/teamcity-agent.jvm file, the agent process is restarted (once the agent becomes idle, i.e. finishes the current build if there is one) and uses the new java from the file.
- (Windows) Since the build agent
.exeinstallation comes bundled with the required Java, you can just reinstall the agent using the
.exeinstaller obtained from the TeamCity server | Agents page.
- Install a required Java on the agent into one of the standard locations, and restart the agent - the agent should then detect it and provide an action to use a newer Java in the web UI (see above).
- Install a required Java on the agent and configure the agent to use it.
In a rare case of updating the Java for the process that launches the TeamCity agent, use one of the options for the agent Java upgrade.
If you use Windows installer to install additional agents and want to run the agent as a service, you will need to perform manual steps as installing second agent as a service on the same machine is not supported by the installer: the existing service is overwritten (see also a feature request).
In order to install the second agent, it is recommended to install the second agent manually (using .zip agent distribution). You can use Windows agent installer and do not opt for service installation, but you will lose uninstall option for the initially installed agent this way.
After the second agent is installed, register a new service for it as mentioned in the section above.
For step-by-step instructions on installing a second Windows agent as a service, see a related external blog post .