Installing & configuring TeamCity on Windows with MS SQL Server

TeamCity is a Continuous Integration and build management server from JetBrains. With it you can set up automatic builds, tests and deployment. Getting it up and running took a lot of reading on my end, so I would like to share a detailed step by step guide on how I got it done on my Windows 8.1 Pro computer with MS SQL Server 2014.

Start by going to Jetbrains downloads and get the latest version which at the time being is TeamCity 8.1.3.
After the download completes run the .exe file, click next and accept license agreement
1
2

NOTE: Remember where you put everything since we will move files to these folders later. Also be sure to have the correct permissions:
32

My TeamCity program files will be located at C:\Program Files (x86)\JetBrains\TeamCity
3

Keep all components checked in the next window and continue.
4

The Data Directory is where the TeamCity server stores configuration settings, build results and current operation files. It can become quite big, so TeamCity recommends to place it on a non-system disk.

NOTE: Be sure to place the Data Directory path in it’s own folder if you install it in the same place as the TeamCity program files, it didn’t work if I installed everything in the same folder level.

I will place mine at D:\Elizabeth\Documents\TeamCity Data Directory. (If you have a smaller SSD disk and a larger HDD disk, I recommend to do as I and put it in the spacey HDD.)
5

After the installer has run, choose a port. The default is 80 which you might need to change if it’s already occupied, as it is on my machine. I’m going to put mine at port 81, so my address to the TeamCity UI will be localhost/81
6

Next the “Configure Build Agent Properties” came up and I simply clicked save.
build agent

Following the setup wizard further you can either run the TeamCity Service Account as SYSTEM or an user account. I picked user account because I am an Administrator on my computer and I tried with the SYSTEM installation multiple times but it refused to work. (Feel free to try either one, your system might be different from mine).
7.1

Type in your Windows User credentials
7.2

The same goes for the TeamCity Agent.
8.1
8.2

After the installation it will ask if you want to start the services for TeamCity, keep them ticked and finish the setup wizard.
9

NOTE: From here on out to run TeamCity, simply start the two services in the Task Manager.

Woohoo, TeamCity is now installed!
10

Your browser will then open TeamCity at localhost:<port> and a configuration setup for first use will appear. (<port> is whichever number you chose in the setup)
11

As TeamCity recommends you should store the data in an external database and only use their internal one if it’s for evaluation purposes, so select MS SQL Server from the drop down list. Make sure to check that the directory TeamCity is looking for is correct. (If you didn’t change the path of the TeamCity Data Directory during the installation it might be located in a hidden folder such as C:\ProgramData\JetBrains\TeamCity\lib\jdbc. Just copy the file path above and paste it in your file explorer to validate its existence.)
choose mssql

Inside the blue box it might tell you that the MS SQL Server JDBC driver wasn’t found. Go to Microsoft Download Center and get the latest driver. (In my case it’s 4.0)
sqljdbc download

Following Microsoft installation instructions, unpack the zip file and then copy it into %ProgramFiles% under the default directory of “Microsoft JDBC Driver 4.0 for SQL Server”.
sqljdbc_4.0

Find the sqljdbc4.jar file inside the sqljdbc_4.0\enu folder and copy it over to your TeamCity Data Directory\lib\jdbc.
jar file

Go to SQL Management Studio and create a new database, name ending convention is <name>_CS_AS
16

Go back to the TeamCity UI configuration and type in the database name (TeamCity_CS_AS) and choose authentication method from the drop down list. (My MS SQL Server uses windows authentication, so I will choose this)
25

You might run into the error “The TCP/IP connection to the host localhost, port 1433 has failed. Error: “Connection refused: connect. Verify the connection properties. Make sure that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port. Make sure that TCP connections to the port are not blocked by a firewall.”
tcp fail
(UPDATE: The above picture is from the 8.1.4 build)

To fix this, I opened up my Sql Server Configuration Manager and clicked the SQL Server Network Configuration -> Protocols for MSSQLSERVER in the list to the right and enabled the TCP/IP
tcp enabled
It will notify you to restart the service, so go and restart all the running services in SQL Server Services (again in the list to the right)
restart services
services restarted

Another error I encountered when I tried to proceed was the error “This driver is not configured for integrated authentication”
not authenticated(UPDATE: The above picture is from the 8.1.4 build)

To fix this I found and followed the 64bit OS instructions on Mike O’Brien’s blog post:

  1. Copy the \auth\x64\sqljdbc_auth.dll (Note the x64 in the path) from the Microsoft JDBC driver folder you downloaded earlier into your C:\Windows\System32 folder (Or some location in the system path).
  2. Copy the contents of the TeamCity jre folder (my path: C:\Program Files (x86)\JetBrains\TeamCity\jre) into a folder called x86 (my path C:\Program Files (x86)\JetBrains\TeamCity\jre\x86) as a backup.
    NOTE: You may get a “Folder In Use” prompt when you try to move the lib folder: just stop both the TeamCity services and (if any) java services and try again.19 20
  3. Download the 64 bit Windows tar.gz version (Not the installer) of the jre here and extract it to a folder.
    21
    Depending on your compression tool you may have to uncompress and then extract the .tar archive in two separate steps. (with 7-zip you can just navigate into the files until you find the jre folder and extract that. My folder is called jre1.7.0_65)
  4. Copy the files from the jre folder that you downloaded and extracted into your TeamCity jre folder (my path: C:\Program Files (x86)\JetBrains\TeamCity\jre).
  5. Finally restart TeamCity and you should be golden.
    24

Proceed with the TeamCity configuration after the initialization
25

Accept the terms of use
28

Create your Admin account
29

You should now see “My Settings & Tools” screen in the TeamCity UI.
31

This concludes the installation and first start configuration and I hope this post has helped someone out there. =)

 

13 Comments

  1. Anders Poulsen

    Just ran into the “This driver is not configured for integrated authentication” problem. Thank you for a good explanation.

  2. Robert L

    Thanks! This was a fantastic step-by-step.

  3. Andy

    Thanks! I’d been searching for the solution to: “This driver is not configured for integrated authentication” for a while!

  4. thank you! I had been struggling with this authentication issue.

  5. Mark Wojciechowicz

    Hi Elizabeth – another thank you for helping with this error: This driver is not configured for integrated authentication! You have left great detailed steps,

    Mark

  6. Oka

    This tutorial help me a lot.
    Thank you.

  7. Pruthwi

    Thanks Elizabeth, This tutorial help me.

  8. Nandu

    Thanks Elizabeth,
    You have done a wonderful job.. It really helped me.. Saved a lot of time..
    Superbbb tutorial for beginners..

  9. Tony

    Fantastic – this should be on the JetBrains web site. Thank-you for such a comprehensive guide.

  10. Kris

    Thanks alot this helped me to install Team City! It saved me many hours of searching :)

  11. Liubov

    Thanks a lot! This is very helpful instruction!

  12. Peter

    Oh man that connection string and the TCP/IP enable thing had me going in circles for a day… Yea I know this is really old version but we had to da a migration to another server, like for like, so I could do a controlled updated. The learning curve for connection string was just unnecessarily to complex and the error message daft.

  13. SAILLESH PAWAR

    I am extremely thankful to you. Following the mentioned steps solved my problem.

Leave a Reply