This is actually pretty stink'n easy if you already have your server up and running.

Refer to my other guide for setting up the basics (ignore the confluence stuff): http://peterjolson.com/confluence-on-smartos-java-image-using-tomcat-virtual-host/

  • Add teamcity to the tomcat virtual host:
cd $CATALINA_HOME/conf  
nano server.xml  

Add this:

<Host name="teamcity.stscode.com" appBase="/opt/teamcity" autoDeploy="true" unpackWARs="true" useBodyEncodingForURI="true"></Host>  

before the

    </Engine>
  </Service>
</Server>  

So it looks something like:

    <Host name="wiki.mysite.com" appBase="webapps" unpackWARs="false" autoDeploy="true">
     <Context path="" docBase="/opt/atlassian/confluence/confluence" debug="0" reloadable="true">
      </Context>
      </Host>
      <!-- deplayXML defaults to true so I don't need to specify it, deployOnStartup defaults to true as well -->
<Host name="track.mysite.com" appBase="/opt/youtrack" autoDeploy="true" unpackWARs="true"></Host>  
<Host name="teamcity.mysite.com" appBase="/opt/teamcity" autoDeploy="true" unpackWARs="true" useBodyEncodingForURI="true"></Host>  
    </Engine>
  </Service>
</Server>  

Set the data location in an environment variable:

cd $CATALINA_HOME/bin  
nano setenv.sh  
#add export TEAMCITY_DATA_PATH="/opt/teamcity/teamcity_data"
  • Create the needed folders:
mkdir -p /opt/teamcity/teamcity_data/lib/jdbc  
  • Download teamcity and rename it:
wget http://download.jetbrains.com/teamcity/TeamCity-8.1.4.war  
mv TeamCity-8.1.4.war ROOT.war  

Note: The teamcity docs tell you to name the war differently, but it needs to be called ROOT if your using tomcat virtual host.

  • Download mysql JDBC and extract it:
cd /opt/teamcity/teamcity_data/lib/jdbc  
wget http://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.32.tar.gz  
tar zxvf mysql-connector-java-5.1.32.tar.gz

cp mysql-connector-java-5.1.32/mysql-connector-java-5.1.32-bin.jar ./

rm mysql-connector-java-5.1.32 -r  
  • Set the permissions:
chown -R tomcat:tomcat /opt/teamcity  
  • Reboot tomcat and hope I didn't miss anything :) :
svcadm restart tomcat