How to install Team City on Ubuntu Server

In any software development project a Continuous Integration / Continuous Deployment DevOps environment is essential. A recent project I elected to make use of Team City & Octopus Deploy all on an Azure stack.

In this post I twill detail the steps on how to install and configure Team City 10.x on a Ubuntu 16.X server.

Install Java

Team City is a Java Based application and therefore needs the JRE & JDK installed with the JAVA_HOME environment variable pointing to the Java installation directory. I am installing on a fresh install of ubuntu 16.X and Java is not installed by default.

In order to Install Java we will need to SSH on to the box and install Java Via via apt.

To install Java on your ubuntu server follow these steps

Open a Terminal window , in my case from a ubuntu box CTRL + ALT + T

Install default Java JDK

Shell

Check your Java Version

Shell

The version information returned should be similar too:

Shell

Install Database software

Team City is able to store TeamCity stores build history, users, build results and some run time data to a number of Relation Database Management Systems (RDBMS) including

  • Postrgre SQL
  • MySQL
  • MS SQL
  • Oracle
  • Default Internal DB

In my particular case I make use of MySQL, how to install MySQL on Ubuntu

Avoid

Never use internal HSQLDB database for production TeamCity instances.

Download & Install Team city

Download the latest TeamCity for linux from Jetbrains

Shell

After the download completes unpack the file

Shell

Install Nginx

We are installing TeamCity on a headless server via SSH so we will not be able to access TeamCity configuration screens using a browser on my server and navigating to http://localhost:8111.

We will therefore need to install nginx so we will be able to access the configuration screens.

Installing nginx is straight forward all we need to do is execute the command below

Shell

Once nginx installed we can create a new site, which we will call teamcity

Shell

Paste following configuration code into the file

Shell

Save the file by using CTRL + X then we need to create a symlink to the sites-enabled folder

Shell

What are SymLinks ?

Symbolic links are basically advanced shortcuts. There are two type of symbolic links: Hard and soft.

Soft symbolic links work similarly to a standard shortcut. When you open a soft link to a folder, you will be redirected to the folder where the files are stored. 
Hard Symbolic Link makes it appear as though the file or folder actually exists at the location of the symbolic link, and your applications won’t know any better. 

I generally delete the default site that nginx creates and also the symlink

Shell

We can now restart nginx to ensure it picks up the new information

Shell

Start Team City Service

We are now ready to start TeamCity and now all we have to do is

Shell

You should now be able to browse to your server location and continue to configure and Install TeamCity using the Web Application frontend

Summary

Team City is a vary easy to use to and configure CI/CD (Continuous Integration/Continuous Deployment) platform. A Freemium license for up to 20 build configurations and 3 free Build Agent licenses is available.

It is possible to use Team City to build Microsoft .net core applications on a Linux Server and all that is required is the basic configuration. Once the basic configuration is complete you can move on to either configuring a Windows Build Agent or Configure Ubuntu headless server 16.x as TeamCity Build Agent to use Cake

Gary Woodfine

Technical Director at Denizon
Gary is Technical Director at Denizon, an independent software vendor specialising in IoT, Field Service and associated managed services,enabling customers to be efficient, productive, secure and scalable in a way which helps them address and reduce their ecological impact.

Denizon's product line successfully integrate IoT, Artificial Intelligence and Blockchain technology to enable efficient, productive, secure and scalable solutions to help organisations address increasing energy demands, ecological impact and Health & Safety concerns of their staff.

Latest posts by Gary Woodfine (see all)