Sunday, 2 August 2020

TeamCity Server and BulidAgent installations on Centos 7

TeamCity is a Java-based build management and continuous integration server from JetBrains.  
A Freemium license for up to 20 build configurations and 3 free Build Agent licenses is available.


- Centos 7 to be installed.
- Java to be installed 
- postgresql to be installed. 

Java Installations
# sudo yum install java-1.8.0-openjdk

Postgresql Installations

Install postgresql
# sudo yum install postgresql-server postgresql-contrib

Initialize the database
# sudo postgresql-setup initdb

Start the database
# sudo systemctl start postgresql

Enable postgresql during boot
# sudo systemctl enable postgresql

TeamCity Installations
Download Teamcity tar archive from official website

mkdir /opt/teamcity
cd /opt/teamcity
tar -xzvf TeamCity-2020.1.2.tar.gz

Download PostgreSQL JDBC driver
We need to download PostgreSQL JDBC driver in order to use PostgreSQL database for TeamCity.

mkdir -p /opt/teamcity/TeamCity/.BuildServer/lib/jdbc/
wget -P /opt/teamcity/TeamCity/.BuildServer/lib/jdbc/

Start service
# cd /opt/teamcity/TeamCity/bin
# ./

Stop Service
# ./

Restart Service
# ./ && ./

Configure postgresql
sudo su - postgres
vim data/pg_hba.conf

Modify to md5 at the end for these below lines
# "local" is for Unix domain socket connections only
local   all             all                                     md5
# IPv4 local connections:
host    all             all               md5
# IPv6 local connections:
host    all             all             ::1/128                 md5
# exit
# systemctl restart postgresql

# psql -U postgres
postgres=# CREATE USER teamcity WITH PASSWORD 'teamcity';
postgres=# CREATE DATABASE teamcity OWNER teamcity;
postgres=# \q

TeamCity Web
point your browser to teamcity Server IP address and follow these below steps

Step 1: Change the Data DirectoryHere
we will change the data directory to /opt/teamcity/TeamCity/.BuildServer

Step 2: Now we have to setup database connection

Database host[:port] - localhost
Database name: xxxxxx
User name: xxxxxx
Password: xxxxx

Step 3: Accept licence

Step 4: Create Admin account

TeamCity installations has been completed. 

TeamCity BuildAgent Installations
Download Zipfile
We need to download a zip file from the teamcity server to install it on the agent. Replace the server-url with your server ip or server hostname.

mkdir /opt/teamcity
sudo unzip
sudo chmod +x bin/
cp conf/ conf/

Start Service
# cd /opt/teamcity/buildAgent/bin
# ./

You would need to authorize the agent in the buildserver once its get detected. you can now start your build and work along.

No comments:

Post a comment