Installation and Configuration
In this section:
Downloading TeamCity
TeamCity installation package is available at http://www.jetbrains.com/teamcity/download/index.html
Download one of the three available installation packages:
| Target |
Download |
Note |
| Windows |
TeamCity<version number>.exe |
Executable Windows installer with bundled Tomcat and Java 1.5 JRE |
| Linux, MacOS X |
TeamCity<version number>.tar.gz |
Package bundled with Tomcat servlet container for Linux, MacOS X or manual installation |
| J2EE container |
TeamCity<version number>.war |
Package for installation into an existing J2EE container |
Installing TeamCity server
Having obtained the TeamCity installation package, proceed with installing the build server for:
- Windows
- Linux or MacOS X
- J2EE container
 | By default, TeamCity uses HSQLDB database that does not require special configuring. This database works fine for testing and evaluating the system.
For production purposes it is recommended to use MySQL database.
|
Installing TeamCity via executable file (Windows only)
For the Windows platform, run the executable file and follow the installation instructions. You have options to install TeamCity web server and one build agent that can be run as Windows services.
 | If you want to edit TeamCity server service parameters, memory settings or system properties after the installation, run the command TeamCity/bin/tomcat5w.exe //ES//TeamCity. more information |
 | Service account
Please check the service account to have
- write rights for TeamCity Data Directory,
- access to Microsoft Visual SourceSafe database (if Visual Source Safe integration is used).
- Make sure that the user, under which TeamCity server service runs, and ClearCase view owner are the same(if ClearCase integration is used).
By default, Windows service in installed under SYSTEM ACCOUNT. To change it, use the Services applet (Control Panel|Administrative Tools|Services) |
Installing TeamCity bundled with Tomcat servlet container
Unpack TeamCity<version number>.tar.gz archive (for example, using tar xfz TeamCity<version number>.tar.gz command).
Start TeamCity server:
- Go to TeamCity/bin directory
- Launch the following command:
- sh runAll.sh start command for Linux and MacOS X
- runAll.bat for Windows.
As a result, TeamCity runs on http://localhost:8111/ and has one registered build agent that runs on the same computer.
Stop TeamCity server and agent:
- Launch sh runAll.sh stop command on Linux and MacOS X
- Press Ctrl+C in the runAll.bat console for Windows.
Installing TeamCity into existing J2EE container
- Copy the downloaded TeamCity<version number>.war file into the web applications directory of your J2EE container under teamCity.war name.
- Restart the server or deploy the application via servlet container administration interface and access http://server/teamCity/.
Installing and running additional Build Agents
Before you can start customizing projects and creating build configurations, you need to configure build agents .
 | Note If you install TeamCity bundled with a Tomcat servlet container, or opt to install an agent for Windows, both a server and one build agent are installed. If you need more build agents, perform the procedure described below. |
To install a build agent, follow these general steps:
- Open Agents tab
- Click Install Build Agents link
- In the Install Build Agents dialog, choose one of the available installation options:
- Enable the agent, if it connects to the server for the first time. To do that, open Agents page, select the desired agent in the list, and click Enable agent link.
 | Until enabled, agents will not run builds. Agents running on the same computer as the server are enabled by default. |
Installing Build Agents via Java Web Start
- Make sure JDK 1.5+ is installed on the computer.
- On the agent computer, set up JAVA_HOME environment variable to point to JDK 1.5+ installation directory.
- Navigate to the Agents page in TeamCity web UI.
- Click the "Install Build Agents" link and then click "Via Java Web Start".
- Follow the instructions.
 | Note You can install build agent Windows service as part of installation process or manually. |
Installing Build Agents via MS Windows installer
Just follow the installation instructions to install additional build agents.
Installing Build Agents via zip file
- Unzip the downloaded file into the desired directory.
- Make sure that you have a JDK or JRE installed (You will need JDK (not JRE) for some build runners like IPR runner, Inspections, Duplicates). Please ensure there are JRE_HOME or JAVA_HOME environment variables set (pointing to the installed JRE or JDK directory respectively) for the shell in which agent will be started.
- Navigate to the <installation path>\conf directory, locate the file called buildAgent.dist.properties and rename it to buildAgent.properties.
- Edit the buildAgent.properties file and change the desired properties of the installed build agent:
- serverUrl - URL of the TeamCity server.
- name - name of the build agent that will be visible in the web UI.
- ownPort - port number that agent use to accept connections from server. Please make sure there is no firewall blocking incoming connections to the port.
- ownAddress - the IP address of the computer running build agent. Required only if automatic detection fails.
- Under Linux, you may need to set execute permission for bin/agent.sh shell script.
Starting the Build Agent
To start the agent manually, run the following script:
- for Windows: <installation path>\bin\agent.bat
- for Linux and MacOS X: <installation path>\bin\agent.sh
 | When running build agent on MacOS X, and you're going to run Inspection builds, you may need to use StartupItemContext utility:
sudo /usr/libexec/StartupItemContext agent.sh start
|
Installing and running Build Agent as a Windows service
On Windows, you may want to use build agent Windows service to allow the build agent to run without any user logged on.
 | Note
Since version 1.2, for Build Agent we are using new Windows Service Library: Java Service Wrapper. Old service name agentd is no longer used in fresh installations. Already installed agents continue to use old service until explicit installation. (more information) |
To install the service:
- Make sure there is no TeamCity Build Agent Service <build number> or agentd service already installed.
- Run the <agent>/bin/service.install.bat file.
To start the service:
- Run <agent>/bin/service.start.bat
To stop the service:
- Run <agent>/bin/service.stop.bat
The new service wrapper allows to change agent JVM parameters via standard way of Java Service Wrapper library. The configuration is located at <agent>\launcher\conf\wrapper.conf
 | Agent process name is TeamCityAgentService-windows-x86-32.exe.
To work with net.exe utility, use TCBuildAgent name. For example:
|
 | Service system account
To run builds, the build agent should be started under the user with enough rights for performing a build. By default,
Windows service in started under SYSTEM ACCOUNT. To change it, use the Services applet
(Control Panel|Administrative Tools|Services) |
Configuring TeamCity server
 | Tips
- If you have many projects or many build configurations, we recommend to avoid using the Default agent and thus free up TeamCity server resources. TeamCity Administrator can disable the default agent on the Agents page of the web UI.
- When changing TeamCity data directory or database make sure they do not get out of sync.
|
Configuring TeamCity data directory
By default, TeamCity data directory, is $HOME/.BuildServer. Alternatively, you can define this directory in one of the following ways:
- as a Tomcat system property teamcity.data.path
- in the TEAMCITY_DATA_PATH environment variable
Setting up MySQL database
- Run TeamCity with the default settings to create TeamCity data directory.
- Shutdown TeamCity server.
- Download MySQL JDBC driver from: http://dev.mysql.com/downloads/connector/j/
- Put MySQL connector jar to the WEB-INF/lib of TeamCity web application
- Create empty database for TeamCity in MySQL and grant permissions to modify this database to a user from which TeamCity will work with this database. Consult this document for more details on how to create database with unicode support.
- In the TeamCity data directory rename database.mysql.properties file to database.properties and specify the required settings in this file:
connectionUrl=jdbc:mysql://<host>/<database name>
connectionProperties.user=<user>
connectionProperties.password=<password>
- Start server.
Edit server configuration