Install TeamCity 2017.2.2 on Windows or Linux, complete the setup wizard, configure a production database, install the first build agent, and lock down the server with HTTPS
| Component | Minimum | Recommended (production) |
|---|---|---|
| Java (Server) | JDK 8 (64-bit) | JDK 8 u152+ (64-bit) |
| Java (Agent) | JRE 6+ | JDK 8 (same as build tool) |
| RAM (Server) | 4 GB | 8–16 GB |
| RAM (Agent) | 2 GB | 4–8 GB (depends on build) |
| CPU (Server) | 2 cores | 4+ cores |
| Disk (Server) | 5 GB | 50–500 GB (for artifacts) |
| OS (Server) | Windows 2008+, Linux | Linux (CentOS/Ubuntu) |
| Database | Internal HSQL (dev only) | MySQL 5.6+ / PostgreSQL 9.4+ |
| Browser | Chrome 40+, Firefox 40+ | Chrome latest |
The built-in HSQL database is single-file and not designed for concurrent access or large datasets. It will corrupt under load and cannot be migrated easily. Use MySQL or PostgreSQL from day one — even for small teams.
Get TeamCity-2017.2.2.exe from the JetBrains website. This is the all-in-one installer containing the server, one bundled agent, and a launcher.
Choose installation directory (default: C:\TeamCity). Select components: Server + Default Build Agent. Choose service account (recommended: create a dedicated service account, not SYSTEM).
Default HTTP port is 8111. Change in the installer or later in conf/server.xml. Ensure the port is open in Windows Firewall.
After install, two services are registered: TeamCity Server and TeamCity Build Agent. Start both from Services or run:
# Start server
net start TCBuildAgent
net start TeamCityServer
# Or use the launcher scripts
C:\TeamCity\bin\teamcity-server.bat start
C:\TeamCity\bin\teamcity-agent.bat start
Navigate to http://localhost:8111. The first-run setup wizard appears.
Create a dedicated Windows service account (e.g., svc-teamcity) with minimal permissions. Give it read/write access to the TeamCity installation directory and data directory. Running as SYSTEM or an admin account is a security risk.
# 1. Ensure Java 8 is installed
java -version # must show 1.8.x
# 2. Download TeamCity tar.gz
wget https://download.jetbrains.com/teamcity/TeamCity-2017.2.2.tar.gz
# 3. Extract to /opt
sudo tar -xzf TeamCity-2017.2.2.tar.gz -C /opt
sudo mv /opt/TeamCity /opt/teamcity
# 4. Create dedicated user (never run as root)
sudo useradd -m -d /home/teamcity -s /bin/bash teamcity
sudo chown -R teamcity:teamcity /opt/teamcity
# 5. Set data directory (optional — default is ~/.BuildServer)
echo "TEAMCITY_DATA_PATH=/var/lib/teamcity" | sudo tee /opt/teamcity/conf/teamcity-startup.properties
# 6. Start the server
sudo -u teamcity /opt/teamcity/bin/teamcity-server.sh start
# 7. Start the bundled agent
sudo -u teamcity /opt/teamcity/buildAgent/bin/agent.sh start
# /etc/systemd/system/teamcity.service
[Unit]
Description=TeamCity Build Server
After=network.target
[Service]
Type=forking
User=teamcity
ExecStart=/opt/teamcity/bin/teamcity-server.sh start
ExecStop=/opt/teamcity/bin/teamcity-server.sh stop
PIDFile=/opt/teamcity/logs/teamcity.pid
Restart=on-failure
RestartSec=10
[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl enable teamcity
sudo systemctl start teamcity
sudo systemctl status teamcity
TeamCity opens many files simultaneously. On Linux, set ulimit -n 65536 for the teamcity user. Add to /etc/security/limits.conf:
teamcity soft nofile 65536
teamcity hard nofile 65536
Without this, you'll see "Too many open files" errors under load.
The first time you open TeamCity in a browser (http://server:8111), the setup wizard runs. It has three steps:
Confirm or change where TeamCity stores its files. Default is ~/.BuildServer. For production, choose a dedicated volume with plenty of space for artifacts. Click Proceed.
Select your database. See section 2.5 for database-specific setup. After entering credentials, TeamCity initialises the schema (creates ~100 tables). This takes 1–3 minutes on first run.
Create the first super admin account. Choose a strong password — this account has full system access. You can add more admins later. Accept the license agreement and click Create Account.
After the wizard you land on the Projects page. The server is running. The bundled build agent should auto-connect within 1–2 minutes and appear under Agents → All Agents as "Unauthorized" — you must manually authorize it (see Phase 6).
-- Create database and user (MySQL 5.6+)
CREATE DATABASE teamcity CHARACTER SET utf8 COLLATE utf8_bin;
CREATE USER 'teamcity'@'localhost' IDENTIFIED BY 'StrongPass123!';
GRANT ALL PRIVILEGES ON teamcity.* TO 'teamcity'@'localhost';
FLUSH PRIVILEGES;
Download the MySQL JDBC driver (mysql-connector-java-5.1.xx.jar) and place it in:
<TeamCity Data Dir>/lib/jdbc/mysql-connector-java-5.1.xx.jar
In the setup wizard, select MySQL and enter:
localhost (or remote host)teamcityteamcityStrongPass123!-- PostgreSQL 9.4+
CREATE DATABASE teamcity ENCODING 'UTF8';
CREATE USER teamcity WITH ENCRYPTED PASSWORD 'StrongPass123!';
GRANT ALL PRIVILEGES ON DATABASE teamcity TO teamcity;
Download the PostgreSQL JDBC driver (postgresql-42.x.x.jar) and place it in <Data Dir>/lib/jdbc/.
| Database | Pros | Cons |
|---|---|---|
| Internal HSQL | Zero setup, good for evaluation | Not for production, no migration path |
| MySQL 5.6+ | Widely available, familiar | Requires utf8_bin collation, driver download |
| PostgreSQL 9.4+ | Better performance at scale, recommended | Slightly more setup |
If you started with HSQL and want to switch: go to Administration → Server Administration → Backup, create a full backup, install the new DB driver, run the setup wizard again pointing to the new DB. Then restore using the maintainDB tool provided in bin/. This process is documented in TeamCity's official "Migrating to an External Database" guide.
.BuildServer/ <-- TeamCity Data Directory root
├── config/ <-- Project + build config XML files
│ ├── projects/
│ │ └── _Root/ <-- Root project settings
│ └── database.properties
├── system/
│ ├── artifacts/ <-- Published build artifacts
│ │ └── ProjectName/
│ │ └── BuildConfigName/
│ ├── caches/ <-- VCS fetch caches, checkout caches
│ └── buildserver.db <-- HSQL data file (if using HSQL)
├── plugins/ <-- Installed .zip plugins
├── lib/
│ └── jdbc/ <-- Database driver JAR goes here
└── logs/ <-- teamcity-server.log, catalina.out
system/artifacts/ grows without bound unless you configure clean-up policies (Phase 15). For a moderately active team, this directory can consume 50–500 GB within months. Mount it on a separate volume and monitor disk usage from day one.
The bundled agent is installed alongside the server but must be authorized before it can run builds. For a remote agent (separate machine):
# On the agent machine — download agent installer from server
wget http://YOUR_TC_SERVER:8111/update/buildAgent.zip
unzip buildAgent.zip -d /opt/buildagent
# Configure the agent to connect to the server
cat > /opt/buildagent/conf/buildAgent.properties << 'EOF'
serverUrl=http://YOUR_TC_SERVER:8111
name=Agent-Linux-01
workDir=../work
tempDir=../temp
EOF
# Start the agent
/opt/buildagent/bin/agent.sh start
After the agent starts, it appears in Agents → Unauthorized Agents in the TeamCity UI. Click Authorize. The agent is now ready to accept builds.
TeamCity serves the agent installer directly from the server at http://SERVER:8111/update/buildAgent.zip. This ensures the agent version always matches the server version. Never download the agent from a different source.
Navigate to Administration → Server Administration → Diagnostics. Check for any red warnings about memory, database, or disk space.
Agents → All Agents — at least one agent should show Connected, Authorized, Idle.
Create a project → add a Command Line build step with echo "Hello TeamCity" → run it. A green build confirms everything works end-to-end.
<Data Dir>/logs/teamcity-server.log — no ERROR or FATAL lines. Agent log: <Agent Dir>/logs/teamcity-agent.log.
# /etc/nginx/sites-available/teamcity
server {
listen 443 ssl;
server_name ci.yourcompany.com;
ssl_certificate /etc/ssl/certs/yourcompany.crt;
ssl_certificate_key /etc/ssl/private/yourcompany.key;
location / {
proxy_pass http://localhost:8111;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 600;
proxy_connect_timeout 600;
proxy_send_timeout 600;
}
}
# Redirect HTTP to HTTPS
server {
listen 80;
server_name ci.yourcompany.com;
return 301 https://$host$request_uri;
}
Tell TeamCity about the public HTTPS URL: Administration → Server Administration → Server URL → set to https://ci.yourcompany.com. This ensures links in emails and commit statuses use the correct URL.
Go to Administration → Email Notifier. Enter your SMTP server details. Click Test connection before saving. Without this, build failure emails won't work.
# <TeamCity>/bin/teamcity-server.sh — set JVM heap
export TEAMCITY_SERVER_MEM_OPTS="-Xms1g -Xmx4g -XX:MaxPermSize=270m"
# For Java 8, also add:
# -XX:+UseG1GC -XX:MaxGCPauseMillis=200
The default TeamCity heap is only 750 MB. For any team with more than a handful of builds per day, you'll hit OutOfMemoryError. Set -Xmx4g minimum for production. Restart the server after changing this.