How to install teamcity 10.x on Ubuntu 16.04

How to install teamcity on ubuntu 

In this tutorial we will learn how to install teamcity on ubuntu. Before starting here is little introduction about teamcity.

TeamCity is a Java-based build management and continuous integration server from JetBrains. It was first released on October 2, 2006. TeamCity is commercial software and licensed under a proprietary license. A Freemium license for up to 20 build configurations and 3 free Build Agent licenses is available. Open Source projects can request a free license.

Source: Wikipedia

Prerequisites

Read Next: Install teamcity build agent on Ubuntu 16.04

Download TeamCity

Firstly we will download the TeamCity tar archive from the official website.

wget https://download.jetbrains.com/teamcity/TeamCity-2017.1.3.tar.gz

tar xvf TeamCity-2017.1.3.tar.gz

Install TeamCity

Now we will install TeamCity.

sudo mkdir /opt/teamcity
sudo mv TeamCity /opt/teamcity

Download PostgreSQL JDBC driver

We need to download PostgreSQL JDBC driver in order to use PostgreSQL database for TeamCity. You can download it from this link also or use the following command to download via yum.

sudo mkdir -p /opt/teamcity/TeamCity/.BuildServer/lib/jdbc/

sudo wget https://jdbc.postgresql.org/download/postgresql-42.1.4.jar -P /opt/teamcity/TeamCity/.BuildServer/lib/jdbc/

Systemd Script for Teamcity Server

We will create a startup script to start teamcity. Create a new file in /etc/systemd/system/teamcity.service. Change the user with your user or create a new user for teamcity.

sudo vim /etc/systemd/system/teamcity.service

[Unit]
Description=TeamCity Server
After=network.target

[Service]
PIDFile=/opt/teamcity/TeamCity/logs/teamcity.pid
ExecStart=/opt/teamcity/TeamCity/bin/teamcity-server.sh start
Type=forking
RemainAfterExit=yes
User=chetan
SyslogIdentifier=teamcity
PrivateTmp=yes
Environment=TEAMCITY_SERVER_OPTS=-Djava.awt.headless=true
ExecStop=/opt/teamcity/TeamCity/bin/teamcity-server.sh stop
RestartSec=5
Restart=on-failure

[Install]
WantedBy=multi-user.target

Enable  TeamCity Services

Now we will enable and start TeamCity using systemctl. Before we need to reload the daemon because we have created new service file.

systemctl enable teamcity

Read Also: How to install postgresql 9.6 on centos 7

Configure postgresql

Open /var/lib/pgsql/9.6/data/pg_hba.conf in your favourite editor and replace ident by md5.

 

 

 

 

systemctl restart postgresql-9.6

Create user and database in PostgreSQL

Now we will create a user in PostgreSQL database for TeamCity.

Note: You must choose some super secure password for teamcity user. I used teamcity for tutorial purpose only.

[root@installvirtual ~]# psql -U postgres
Password for user postgres:
psql (9.6.3)
Type "help" for help.

postgres=# CREATE USER teamcity WITH PASSWORD 'teamcity';
CREATE ROLE
postgres=# CREATE DATABASE teamcity OWNER teamcity;
CREATE DATABASE
postgres=# \q

Now we have created a user in PostgreSQL let’s go to the TeamCity web interface and continue installation.

Start TeamCity Services

Now we will start teamcity services using systemctl

systemctl start teamcity

TeamCity web interface

Now we will go to the web interface to continue our TeamCity installation. Go to ip-address:8111

Step 1: Change the Data Directory

Here we will change the data directory to /opt/teamcity/TeamCity/.BuildServer

install teamcity on ubuntu

Step 2: Now we have to setup database connection. Select PostgreSQL from the drop down menu and then click refresh to detect the jdbc driver that we have downloaded. Then you need to provide user and password that we have created in PostgreSQL. In my case user is TeamCity and password is also TeamCity.

install teamcity on ubuntu

Step 3: Accept the License Agreement

Accept the License Agreement

Step 4: Create Administrator Account

install teamcity on ubuntu

Step 5: Put in your name and email address and you are ready to go.

If you got some issues installing TeamCity please feel free to comment below or use this link to ask it in discussions.
Any edit or suggestion is welcomed.

Read Also: How to install teamcity on centos 7

Leave a Reply

Your email address will not be published.


*