This page covers a new TeamCity server installation.
For upgrade instructions, please refer to Upgrade.

To install a TeamCity server, perform the following:

This page covers:

Installing TeamCity Server

After you obtained the TeamCity installation package, proceed with corresponding installation instructions:

Compared to the .war distribution, the .exe and .tar.gz distributions:

After installation, the TeamCity web UI can be accessed via a web browser. The default addresses are http://localhost/ for Windows distribution and http://localhost:8111/ for tar.gz distribution.

If you cannot access the TeamCity web UI after successful installation, please refer to the #Troubleshooting TeamCity Installation Issues section.

(info) The build server and one build agent will be installed by default for Windows, Linux or MacOS X. If you need more build agents, refer to the Installing Additional Build Agents section.

(warning) During the server setup you can select either an internal database or an existing external database. By default, TeamCity uses an HSQLDB database that does not require configuring. This database suites the purposes of testing and evaluating the system.
For production purposes, using a standalone external database is recommended.

Installing TeamCity via Windows installation package

For the Windows platform, run the executable file and follow the installation instructions. You have options to install the TeamCity web server and one build agent that can be run as a Windows service.

If you opted to install the services, use the standard Windows Services applet to manage the service.
Otherwise, use standard scripts.

If you did not change the default port (80) during the installation, the TeamCity web UI can be accessed via "http://localhost/" address in a web browser running on the same machine where the server is installed. Please note that port 80 can be used by other programs (e.g. Skype, or other web servers like IIS). In this case you can specify another port during the installation and use "http://localhost:<port>/" address in the browser.

(info) If you want to edit the TeamCity server's service parameters, memory settings or system properties after the installation, refer to the Configuring TeamCity Server Startup Properties section.

Make sure the user account specified for the service has:

  • log on as service right (related Microsoft page)
  • write permissions for the TeamCity Data Directory,
  • write permissions for the TeamCity Home , i.e. directory where TeamCity was installed,
  • all the necessary permissions to work with the source controls used. This includes:
    • access to Microsoft Visual SourceSafe database (if Visual SourceSafe integration is used).
    • the user, under whose account the TeamCity server service runs, and ClearCase view owner are the same (if the ClearCase integration is used).

By default, the Windows service is installed under the SYSTEM account. To change it, use the Services applet (Control Panel | Administrative Tools | Services)

Installing TeamCity bundled with Tomcat servlet container (Linux, Mac OS X, Windows)

Review software requirements before the installation.

Unpack the TeamCity<version number>.tar.gz archive (for example, using the tar xfz TeamCity<version number>.tar.gz command under Linux, or the WinZip, WinRar or similar utility under Windows).
Please use GNU tar to unpack (for example, Solaris 10 tar is reported to truncate too long file names and may cause a ClassNotFoundException when using the server after such unpacking. Consider getting GNU tar at Solaris packages or using the gtar xfz command).

Ensure you have JRE or JDK installed and the JAVA_HOME environment variable is pointing to the Java installation directory. Oracle Java 1.8 JDK is required.

Installing TeamCity into Existing J2EE Container

It is not recommended to use .war distribution. Use the TeamCity .tar.gz distribution (bundled with Tomcat web server) instead. If you have important reasons to deploy TeamCity into existing web server and want to use .war distribution, please let us know the reasons.

  1. Make sure your web application server is stopped.
  2. Copy the downloaded TeamCity<version number>.war file into the web applications directory of your J2EE container under the TeamCity.war name (the name of the file is generally used as a part of the URL) or deploy the .war following the documentation of the web server. Please make sure there is no other version of TeamCity deployed (e.g. do not preserve the old TeamCity web application directory under the web server applications directory).
  3. Ensure the TeamCity web application gets sufficient amount of memory. Please increase the memory accordingly if you have other web applications running in the same JVM.
  4. If you are deploying TeamCity to the Tomcat container, please add useBodyEncodingForURI="true" attribute to the main Connector tag for the server in the Tomcat/conf/server.xml file.
  5. If you are deploying TeamCity to Jetty container version >7.5.5 (including 8.x.x), please make sure the system property org.apache.jasper.compiler.disablejsr199 is set to true
  6. Ensure that the servlet container is configured to unpack the deployed war files. Though for most servlet containers it is the default behavior, for some it is not (e.g. Jetty version >7.0.2) and should be explicitly configured. TeamCity is not able to work from a packed .war: if started this way, there will be a note on this the logs and UI .
  7. Configure the appropriate TeamCity Data Directory to be used by TeamCity. 

    Note that it is recommended to start with an empty TeamCity Data Directory. After completing the installation and performing the first TeamCity server start, the required data (e.g. database settings file) can be moved to the directory.

  8. Check/configure the TeamCity logging properties by specifying the log4j.configuration and teamcity_logs internal properties.
  9. Restart the server or deploy the application via the servlet container administration interface and access http://server:port/TeamCity/, where "TeamCity" is the name of the war file.

TeamCity J2EE container distribution is tested to work with Tomcat 7 servlet container. (See also Supported Platforms and Environments#The TeamCity Server)

If you're using Tomcat J2EE container, make sure the Apache Portable Runtime feature of this container is disabled (actually it is disabled by default). Otherwise due to issues in the Apache Portable Runtime, TeamCity may not work properly.

Unattended TeamCity server installation

For automated server installation, use .tar.gz distribution.

Typically, you will need to unpack it and make the script perform the steps noted in Configuring Server for Production Use section.

If you want to get a pre-configured server right away, put files from a previously configured server into the Data Directory. For each new server you will need to ensure it points to a new database (configured in <Data Directory>\config\database.properties) and change <Data Directory>\config\main-config.xml file not to have "uuid" attribute in the root XML element (so new one can be generated) and setting appropriate value for "rootURL" attribute.

 

Using another Version of Tomcat

If you want to use another version of Tomcat web server instead of the one bundled in .tar.gz and .exe distributions), you have the choices of whether to use the .war TeamCity distribution (not recommended) or perform the Tomcat upgrade/patch for TeamCity installed from the .exe or .tar.gz distributions.
For the latter, you might want to:

Starting TeamCity server

If TeamCity server is installed as a Windows service, follow the usual procedure of starting and stopping services.

If TeamCity is installed using the .exe or .tar.gz distributions, the TeamCity server can be started and stopped by the teamcity-server scripts provided in the <TeamCity home>/bin directory.

The TeamCity server will restart automatically if the Java process of  the server crashes since TeamCity 2017.2.

By default, TeamCity runs on http://localhost:8111/ and has one registered build agent that runs on the same computer.

See the information below for changing the server port.

If you need to pass special properties to the server, refer to Configuring TeamCity Server Startup Properties.

If TeamCity is installed into an existing web server (.war distribution), start the server according to its documentation. Make sure you configure TeamCity-specific logging-related properties and pass suitable memory options.

Autostart TeamCity server on Mac OS X

Starting up TeamCity server on Mac is quite similar to starting Tomcat on Mac.

  1. Install TeamCity and make sure it works if started from the command line with bin/teamcity-server.sh start. We'll assume that TeamCity is installed in the /Library/TeamCity folder
  2. Create the /Library/LaunchDaemons/jetbrains.teamcity.server.plist file with the following content:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
    	<key>WorkingDirectory</key>
    	<string>/Library/TeamCity</string>
    	<key>Debug</key>
    	<false/>
    	<key>Label</key>
    	<string>jetbrains.teamcity.server</string>
    	<key>OnDemand</key>
    	<false/>
    	<key>KeepAlive</key>
    	<true/>
    	<key>ProgramArguments</key>
    	<array>
            <string>/bin/bash</string>
            <string>--login</string>
            <string>-c</string>
            <string>bin/teamcity-server.sh run</string>
        </array>
    	<key>RunAtLoad</key>
    	<true/>
    	<key>StandardErrorPath</key>
    	<string>logs/launchd.err.log</string>
    	<key>StandardOutPath</key>
    	<string>logs/launchd.out.log</string>
    </dict>
    </plist>
    
  3. Test your file by running launchctl load /Library/LaunchDaemons/jetbrains.teamcity.server.plist . This command should start the TeamCity server (you can see this from logs/teamcity-server.log and in your browser). 

  4. If you don't want TeamCity to start under the root permissions, specify the UserName key in the plist file, e.g.:

        <key>UserName</key>
    	<string>teamcity_user</string>
    

 

The TeamCity server will now start automatically when the machine starts.  To configure automatic start of a TeamCity Build Agent, see the dedicated section.

 

Installation Configuration

Troubleshooting TeamCity Installation

Upon successful installation, the TeamCity server web UI can be accessed via a web browser.
The default address that can be used to access TeamCity from the same machine depends on the installation package and installation options. (Port 80 is used for Windows installation, unless another port is specified, port 8111 for .tar.gz installation unless not changed in the server configuration).

If the TeamCity web UI cannot be accessed, please check:

One of the most common issues with the server installation is using a port that is already used by another program. See below on changing the default port.

Changing Server Port

If you use the TeamCity server Windows installer, you can set the port to be used during installation.
If you use the .war distribution, refer to the manual of the application server used.

Use the following instructions to change the port if you use the .tar.gz distribution.
If another application uses the same port as the TeamCity server, the TeamCity server (Tomcat server) won't start and this will be identified by "Address already in use" errors in the server logs or server console.

To change the server port, in the <TeamCity Home>/conf/server.xml file, change the port number in the not commented "<Connector>" XML node (here the port number is 8111):

<Connector port="8111" ...

To apply the changes, restart the server. If the server was working with the old port previously, you would need to change the port in all the stored URLs of the server (browser bookmarks, agents' serverUrl property, URL in user's IDEs, "Server URL" setting on the "Administration | Global" Settings page).

If you run another Tomcat server on the same machine, you might need to also change other Tomcat server service ports (search for "port=" in the server.xml file).

If you want to use the https:// protocol, it should be enabled separately and the process is not specific to TeamCity, but rather for the web server used (Tomcat by default). See also Using HTTPS to access TeamCity server

Changing Server Context

By default, the TeamCity server is accessible under the root context of the server address (e.g. http://localhost:8111/ ). To make it available under a nested path instead (e.g. http://localhost:8111/teamcity/ ), you need to:

Note that after this change automatic update will be disabled for your installation and you will have to upgrade TeamCity manually.

 

Java Installation

The TeamCity server is a web application that runs in an J2EE application server (a JVM application). TeamCity server requires a Java SE JRE installation to run.

The TeamCity server requires JRE 1.8 to operate (download page), the agent can run with Java 1.6-1.8, but Java 1.8 is recommended. Recommended Oracle download is Java SE JDK.
It is recommended to use the 32-bit installation unless you need to dedicate more memory to TeamCity server. Please check the 64-bit Java notes before upgrade.
If you configured any native libraries for use with TeamCity (like a .dll for using Microsoft SQL database Integrated Security option), you need to update the libraries to match the JVM x86/x64 platform.

For TeamCity agent Java requirements, check Setting up and Running Additional Build Agents.

The necessary steps to update the Java installation depend on the distribution used.

Using 64 bit Java to Run TeamCity Server

TeamCity server can run under both the 32- and 64-bit JVM.
It is recommended to use the 32-bit JVM unless you need to dedicate more than 1.2Gb of memory (via -Xmx JVM option) to the TeamCity process (see details) or your database requirements are different.

If you choose to use the 64-bit JVM, note that the memory usage is almost doubled when switching from the 32- to 64-bit JVM, so please make sure you specify at least twice as much memory as for 32-bit JVM, see #Setting Up Memory settings for TeamCity Server.

To update to the 64-bit Java:

Setting Up Memory settings for TeamCity Server

As a JVM application, TeamCity only utilizes memory devoted to the JVM. The memory used by JVM usually consists of: heap (configured via -Xmx) and metaspace (limited by the amount of available native memory), internal JVM (usually tens of Mb), and OS-dependent memory features like memory-mapped files. TeamCity mostly depends on the heap memory and this settings can be configured for the TeamCity application manually by passing -Xmx (heap space) option to the JVM running the TeamCity server.

Once you start using TeamCity for production purposes or you want to load the server during evaluation, you should manually set the appropriate memory settings for the TeamCity server.

To change the memory settings, refer to Configuring TeamCity Server Startup Properties, or to the documentation of your application server, if you run TeamCity using the .war distribution.
Generally this means setting TEAMCITY_SERVER_MEM_OPTS environment variable to the value like -Xmx750m

The Permanent Generation (PermGen) space has been replaced with metaspace memory allocation. It is recommended to remove the  -XX:MaxPermSize JVM option from TEAMCITY_SERVER_MEM_OPTS environment variable, if previously configured.

If slowness, OutOfMemory errors occur, or you consistently see a memory-related warning in the TeamCity UI, increase the setting to the next level.

Tips:

The recommended approach is to start with initial settings and monitor for the percentage of used memory using the Administration | Diagnostics page. If the server uses more than 80% of memory consistently without drops for tens of minutes, that is probably a sign to increase the -Xmx memory value by another 20%.

{show-if:action=edit}


If you run TeamCity via {{runAll}} or {{teamcity-server}} scripts or via Windows service installed during TeamCity installation, the default setting of 512 Mb for the heap and 150 Mb for the PermGen are used. If you need to change the settings, please refer to [Configuring TeamCity Server Startup Properties|Configuring TeamCity Server Startup Properties#JVMProperties]. If you run TeamCity using .war distribution please refer to the manual of the application server to change the memory settings. The actual memory consumption will be (e.g. 100Mb) higher since JVM itself uses memory too.

{show-if}

Configuring TeamCity Server

  • If you have a lot of projects or build configurations, we recommend you avoid using the Default agent in order to free up the TeamCity server resources. The TeamCity Administrator can disable the default agent on the Agents page of the web UI.
  • When changing the TeamCity data directory or database, make sure they do not get out of sync.

Configuring TeamCity Data Directory

The default placement of the TeamCity data directory can be changed. See corresponding section: TeamCity Data Directory for details.

Editing Server Configuration

After successful server start, any TeamCity page request will redirect to prompt for the server administrator username and password. Please make sure that no one can access the server pages until the administrator account is setup.

After administration account setup you may begin to create Project and Build Configurations in the TeamCity server. You may also want to configure the following settings in the Server Administration section:

Configuring Server for Production Use

Out-of-the-box TeamCity server installation is suitable for evaluation purposes. For production use you will need to perform additional configuration which typically includes:

Please also review the notes on configuring the server for performance and security notes.


See also:

Installation and Upgrade: Setting up and Running Additional Build Agents