Friday, March 9, 2018

How to Install Teamcity on Ubuntu? How to set up TeamCity on Ubuntu 16.0.4 with Postgres?

Please find below steps for installing TeamCity on Ubuntu:

Make sure instance has at least 2 GB RAM memory(for EC2 at least small instance)
Open port 8111 in security firewall.

We need to set up some database for storing all the build information. For this exercise, lets us use Postgres:

Postgres Installation
sudo apt-get update
sudo sh -c 'echo "deb `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
sudo wget -q -O - | sudo apt-key add -
sudo apt-get -y install postgresql postgresql-contrib

sudo systemctl enable postgresql
sudo systemctl start postgresql

Change the password for postgres user by entering below command
sudo passwd postgres
Enter any password but do remember the password and confirm the same password
su - postgres
createuser teamcity

Switch to sql shell by entering
ALTER USER teamcity WITH ENCRYPTED password 'password';
CREATE DATABASE teamcity OWNER teamcity;

type exit to come out of postgres user.

TeamCity Installation

sudo apt-get update

sudo apt-get install default-jdk -y

Download TeamCity

tar -xvf TeamCity-2020.1.5.tar.gz
sudo mkdir /opt/JetBrains
sudo mv TeamCity /opt/JetBrains/TeamCity
cd /opt/JetBrains/TeamCity
sudo nano /etc/init.d/teamcity
(copy the whole text colored in green)
# Provides:          TeamCity autostart
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start teamcity daemon at boot time
# Description:       Enable service provided by daemon.
# /etc/init.d/teamcity -  startup script for teamcity

#  Ensure you enter the  right  user name that  TeamCity will run  under

export TEAMCITY_DATA_PATH="/opt/JetBrains/TeamCity/.BuildServer"

case $1 in

  start-stop-daemon --start  -c $USER --exec /opt/JetBrains/TeamCity/bin/ start
  start-stop-daemon --start -c $USER  --exec  /opt/JetBrains/TeamCity/bin/ stop

exit 0

Ctrl + O enter
Ctrl + X enter
sudo chmod +x /etc/init.d/teamcity
sudo update-rc.d teamcity defaults
sudo /etc/init.d/teamcity start

cat /opt/JetBrains/TeamCity/buildAgent/logs/teamcity-agent.log

Open browser and access team city url in the browser

Click on Proceed.
Select database type as jdbc driver as Postgres SQL from the dropdown and Click on Proceed.

now you need to download the jdbc driver at below location.
cd /opt/JetBrains/TeamCity/.BuildServer/lib/jdbc
sudo wget

Select database type as PostgreSQL
Refresh JDBC driver
You should see like this —> Loaded PostgreSQL JDBC driver version: 9.4

Now provide the below info
Enter database Host - localhost
Enter database name - teamcity
User name - teamcity
Password - password
Click on Proceed

please wait and watch..As It may take a few mins…

Scroll down the page, Accept license agreement
Uncheck Send anonymous usage statistics
Continue button

Register as a user and create an account


  1. We are pleased to declare that we have included a plugin for coordinating Performance Center with TeamCity, empowering execution and load tests to be kept running as a feature of your TeamCity CI process.

  2. I wanted to thank you for this excellent read!! I definitely loved every little bit of it. I have you bookmarked your site to check out the new stuff you post.

  3. I’m going to read this. I’ll be sure to come back. thanks for sharing. and also This article gives the light in which we can observe the reality. this is very nice one and gives indepth information. thanks for this nice article... etcher download