Sunday, April 28, 2013

Allow root remote access to MySql database in linux

First install the database by entering:
sudo apt-get install mysql-server
After installing mysql database edit the file /etc/mysql/my.cnf:
change the line:
bind-address = 127.0.0.1
to:
bind-address = 0.0.0.0

Now restart the mysql service:
sudo service mysql restart

Now login to the server:
mysql -u root -p mysql
Now enter the following:
grant all privileges on *.* to 'root'@'%' identified by '' with grant option;
flush privileges;
exit

Now you are able to manage the database remotely by MySql Workbench.

Thursday, January 17, 2013

Allow multiple remote desktop session on Windows Server

Windows Server 2008 is by default configured to allow only one Remote Desktop Session. To change this to allow multiple sessions follow the following steps:

First start the tsconfig.msc to configure the settings

Now double click on the Restrict each user to a single session.


Now deselect the option Restrict each user to a single session.


Click OK and you are all set.

Saturday, January 12, 2013

Create a Mono C# Buildserver using Jenkins and GitHub

My favourite development environment is Visual Studio. All my serverside code I develop in Visual Studio on my workstation. I have a homeserver with VMware ESXi where I run several linux instances. All my webprojects I host from this instances. To keep the cost low I run them on Linux. Same with my Continuous Integration setup. I use the Linux - Jenkins - Mono - Github combination to build my projects. In this post I will demo how to create this setup.

Install Linux Ubuntu Server 12.04

First thing to do is install a Linux server and call it build01. It needs a minimum of 1gb of memory (because to the java stuff :-)) Look at my previous blog post how to install ubuntu.

Install Git

sudo apt-get update
sudo apt-get install git

Install Mono

sudo apt-get update
sudo apt-get install mono-complete

Install Jenkins

wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add -
sudo sh -c 'echo deb http://pkg.jenkins-ci.org/debian binary/ > /etc/apt/sources.list.d/jenkins.list'
sudo apt-get update
sudo apt-get install jenkins


Now it is time to start jenkins for the first time. Open a browser and browse to http://build01:8080


Configure Jenkins

Now go to Manage Jenkins and select Manage Plugins. We need to install the MSBuild Plugin. Goto the tab Available and type msbuild in the Filter box. Select the plugin and click Download now and install after restart.


Install the GitHub Plugin the same way. This will also install two other dependent plugins.
After installing enable all the plugins in the same screen. This is an important step.

Now goto Manage Jenkins - Configure System. Here we configure de MSBuild plugin and add a new MSBuild installation:



This is the mono msbuild tool called xbuild. Now the msbuild step will use this build tool to build visual studio sollutions or other msbuild project files. Remember this tool is not completely compatible with msbuild from Microsoft, but I can build my Console Applications and Libraries with it. I use NancyFx for my webapplications and these projects build fine also.

Now it's time to create a new project in jenkins. I have a simple solution with a consoleapp in it that copies my photos in the right folder using exif information in github at: https://github.com/broersa/photorename.git .
This project doesn't use downloading nuget packages at build time, but this is also supported. xbuild will run nuget.exe and download nuget packages. It all works on mono.

At the jenkins dashboard click New Job. Name the job and select Build a free style job project and click Ok.


In the next screen enter the github project url in  the GitHub project box and select Git at the Source Code Management section. Fill in the Repository URL and scroll down to the build steps.


Now click the second Advanced button to open the Git advanced options.


 Now a whole of options open and we need to select the option skip internal tag.



Goto Build section and click Add build step. Select an MSBuild step.



Now select the mono installation we configured in the previous steps and fill in the solution of the project to build.


Click Save to save the project. Now we can build the C# Mono Visual Studio solution on Linux.
From the dashboard click our project and select Build Now. The project is now building.


We see a succesfull build and can now view the log to see what jenkins did to build the solution:

Started by user anonymous
Building in workspace /var/lib/jenkins/jobs/photorename/workspace
Checkout:workspace / /var/lib/jenkins/jobs/photorename/workspace - hudson.remoting.LocalChannel@74ed41f8
Using strategy: Default
Cloning the remote Git repository
Cloning repository https://github.com/broersa/photorename.git
git --version
git version 1.7.9.5
Fetching upstream changes from https://github.com/broersa/photorename.git
Seen branch in repository origin/HEAD
Seen branch in repository origin/master
Commencing build of Revision 980fc0b10f9dc29dd6b1f8e00037534dca240f01 (origin/HEAD, origin/master)
Checking out Revision 980fc0b10f9dc29dd6b1f8e00037534dca240f01 (origin/HEAD, origin/master)
No change to record in branch origin/HEAD
No change to record in branch origin/master
Path To MSBuild.exe: /usr/lib/mono/4.0/xbuild.exe
Executing the command /usr/lib/mono/4.0/xbuild.exe PhotoRename.sln from /var/lib/jenkins/jobs/photorename/workspace
[workspace] $ /usr/lib/mono/4.0/xbuild.exe PhotoRename.sln
XBuild Engine Version 2.10.8.1
Mono, Version 2.10.8.1
Copyright (C) Marek Sieradzki 2005-2008, Novell 2008-2011.

Build started 1/12/2013 5:36:22 PM.
__________________________________________________
Project "/var/lib/jenkins/jobs/photorename/workspace/PhotoRename.sln" (default target(s)):
 Target ValidateSolutionConfiguration:
  Building solution configuration "Debug|x86".
 Target Build:
  Project "/var/lib/jenkins/jobs/photorename/workspace/PhotoRename/PhotoRename.csproj" (default target(s)):
   Target PrepareForBuild:
    Configuration: Debug Platform: x86
    Created directory "bin/Debug/"
    Created directory "obj/x86/Debug/"
   Target GetReferenceAssemblyPaths:
/usr/lib/mono/4.0/Microsoft.Common.targets:  warning : Unable to find framework corresponding to the target framework moniker '.NETFramework,Version=v4.0,Profile=Client'. Framework assembly references will be resolved from the GAC, which might not be the intended behavior.
   Target ResolveAssemblyReferences:
/usr/lib/mono/4.0/Microsoft.Common.targets:  warning : Reference 'mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' not resolved
    For searchpath /var/lib/jenkins/jobs/photorename/workspace/packages/ExifLib.1.2.4436.20486/lib/net20
    Considered '/var/lib/jenkins/jobs/photorename/workspace/packages/ExifLib.1.2.4436.20486/lib/net20/mscorlib' as a file, but the file does not exist
    Considered '/var/lib/jenkins/jobs/photorename/workspace/packages/ExifLib.1.2.4436.20486/lib/net20/mscorlib.exe' as a file, but the file does not exist
    Considered '/var/lib/jenkins/jobs/photorename/workspace/packages/ExifLib.1.2.4436.20486/lib/net20/mscorlib.dll' as a file, but the file does not exist
    For searchpath {CandidateAssemblyFiles}
    Warning: {CandidateAssemblyFiles} not supported currently
    For searchpath {HintPathFromItem}
    HintPath attribute not found
    For searchpath {TargetFrameworkDirectory}
    For searchpath {PkgConfig}
    Considered mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, but could not find in any pkg-config files.
    For searchpath {GAC}
    Considered mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, but could not find in the GAC.
    For searchpath {RawFileName}
    Considered '/var/lib/jenkins/jobs/photorename/workspace/PhotoRename/mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' as a file, but the file does not exist
    For searchpath bin/Debug/
    Considered '/var/lib/jenkins/jobs/photorename/workspace/PhotoRename/bin/Debug/mscorlib' as a file, but the file does not exist
    Considered '/var/lib/jenkins/jobs/photorename/workspace/PhotoRename/bin/Debug/mscorlib.exe' as a file, but the file does not exist
    Considered '/var/lib/jenkins/jobs/photorename/workspace/PhotoRename/bin/Debug/mscorlib.dll' as a file, but the file does not exist
/usr/lib/mono/4.0/Microsoft.Common.targets:  warning : Reference 'mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' not resolved
    For searchpath /var/lib/jenkins/jobs/photorename/workspace/packages/NDesk.Options.0.2.1/lib
    Considered '/var/lib/jenkins/jobs/photorename/workspace/packages/NDesk.Options.0.2.1/lib/mscorlib' as a file, but the file does not exist
    Considered '/var/lib/jenkins/jobs/photorename/workspace/packages/NDesk.Options.0.2.1/lib/mscorlib.exe' as a file, but the file does not exist
    Considered '/var/lib/jenkins/jobs/photorename/workspace/packages/NDesk.Options.0.2.1/lib/mscorlib.dll' as a file, but the file does not exist
    For searchpath {CandidateAssemblyFiles}
    Warning: {CandidateAssemblyFiles} not supported currently
    For searchpath {HintPathFromItem}
    HintPath attribute not found
    For searchpath {TargetFrameworkDirectory}
    For searchpath {PkgConfig}
    Considered mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, but could not find in any pkg-config files.
    For searchpath {GAC}
    Considered mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, but could not find in the GAC.
    For searchpath {RawFileName}
    Considered '/var/lib/jenkins/jobs/photorename/workspace/PhotoRename/mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' as a file, but the file does not exist
    For searchpath bin/Debug/
    Considered '/var/lib/jenkins/jobs/photorename/workspace/PhotoRename/bin/Debug/mscorlib' as a file, but the file does not exist
    Considered '/var/lib/jenkins/jobs/photorename/workspace/PhotoRename/bin/Debug/mscorlib.exe' as a file, but the file does not exist
    Considered '/var/lib/jenkins/jobs/photorename/workspace/PhotoRename/bin/Debug/mscorlib.dll' as a file, but the file does not exist
/usr/lib/mono/4.0/Microsoft.Common.targets:  warning : Found a conflict between : 'System' and 'System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Using 'System' reference.
   Target CopyFilesMarkedCopyLocal:
    Copying file from '/var/lib/jenkins/jobs/photorename/workspace/packages/ExifLib.1.2.4436.20486/lib/net20/ExifLib.dll' to '/var/lib/jenkins/jobs/photorename/workspace/PhotoRename/bin/Debug/ExifLib.dll'
    Copying file from '/var/lib/jenkins/jobs/photorename/workspace/packages/NDesk.Options.0.2.1/lib/NDesk.Options.dll' to '/var/lib/jenkins/jobs/photorename/workspace/PhotoRename/bin/Debug/NDesk.Options.dll'
   Target GenerateSatelliteAssemblies:
   No input files were specified for target GenerateSatelliteAssemblies, skipping.
   Target CoreCompile:
    Tool /usr/bin/dmcs execution started with arguments: /noconfig /debug:full /debug+ /optimize- /out:obj/x86/Debug/PhotoRename.exe Program.cs Properties/AssemblyInfo.cs /target:exe /define:"DEBUG;TRACE" /platform:x86 /reference:../packages/ExifLib.1.2.4436.20486/lib/net20/ExifLib.dll /reference:../packages/NDesk.Options.0.2.1/lib/NDesk.Options.dll /reference:/usr/lib/mono/gac/System/4.0.0.0__b77a5c561934e089/System.dll /reference:/usr/lib/mono/gac/System.Xml.Linq/4.0.0.0__b77a5c561934e089/System.Xml.Linq.dll /reference:/usr/lib/mono/gac/System.Data.DataSetExtensions/4.0.0.0__b77a5c561934e089/System.Data.DataSetExtensions.dll /reference:/usr/lib/mono/gac/Microsoft.CSharp/4.0.0.0__b03f5f7f11d50a3a/Microsoft.CSharp.dll /reference:/usr/lib/mono/gac/System.Data/4.0.0.0__b77a5c561934e089/System.Data.dll /reference:/usr/lib/mono/gac/System.Xml/4.0.0.0__b77a5c561934e089/System.Xml.dll /reference:/usr/lib/mono/gac/System.Core/4.0.0.0__b77a5c561934e089/System.Core.dll /warn:4
Program.cs(18,18): warning CS0219: The variable `verbose' is assigned but its value is never used
Program.cs(25,26): warning CS0219: The variable `extra' is assigned but its value is never used
   Target DeployOutputFiles:
    Copying file from '/var/lib/jenkins/jobs/photorename/workspace/PhotoRename/obj/x86/Debug/PhotoRename.exe.mdb' to '/var/lib/jenkins/jobs/photorename/workspace/PhotoRename/bin/Debug/PhotoRename.exe.mdb'
    Copying file from '/var/lib/jenkins/jobs/photorename/workspace/PhotoRename/obj/x86/Debug/PhotoRename.exe' to '/var/lib/jenkins/jobs/photorename/workspace/PhotoRename/bin/Debug/PhotoRename.exe'
  Done building project "/var/lib/jenkins/jobs/photorename/workspace/PhotoRename/PhotoRename.csproj".
Done building project "/var/lib/jenkins/jobs/photorename/workspace/PhotoRename.sln".

Build succeeded.

Warnings:

/var/lib/jenkins/jobs/photorename/workspace/PhotoRename.sln (default targets) ->
(Build target) ->
/var/lib/jenkins/jobs/photorename/workspace/PhotoRename/PhotoRename.csproj (default targets) ->
/usr/lib/mono/4.0/Microsoft.Common.targets (GetReferenceAssemblyPaths target) ->

 /usr/lib/mono/4.0/Microsoft.Common.targets:  warning : Unable to find framework corresponding to the target framework moniker '.NETFramework,Version=v4.0,Profile=Client'. Framework assembly references will be resolved from the GAC, which might not be the intended behavior.

/var/lib/jenkins/jobs/photorename/workspace/PhotoRename.sln (default targets) ->
(Build target) ->
/var/lib/jenkins/jobs/photorename/workspace/PhotoRename/PhotoRename.csproj (default targets) ->
/usr/lib/mono/4.0/Microsoft.Common.targets (ResolveAssemblyReferences target) ->

 /usr/lib/mono/4.0/Microsoft.Common.targets:  warning : Reference 'mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' not resolved
 /usr/lib/mono/4.0/Microsoft.Common.targets:  warning : Reference 'mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' not resolved
 /usr/lib/mono/4.0/Microsoft.Common.targets:  warning : Found a conflict between : 'System' and 'System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Using 'System' reference.

/var/lib/jenkins/jobs/photorename/workspace/PhotoRename.sln (default targets) ->
(Build target) ->
/var/lib/jenkins/jobs/photorename/workspace/PhotoRename/PhotoRename.csproj (default targets) ->
/usr/lib/mono/4.0/Microsoft.CSharp.targets (CoreCompile target) ->

 Program.cs(18,18): warning CS0219: The variable `verbose' is assigned but its value is never used
 Program.cs(25,26): warning CS0219: The variable `extra' is assigned but its value is never used

  6 Warning(s)
  0 Error(s)

Time Elapsed 00:00:01.1354710
Finished: SUCCESS





Thursday, September 6, 2012

Find the Distinguished Name of a certificate to use in WCF SSL

When you need a secure connection to a WCF webservice you need te specify the Distinguished Name (DN) of the server certificate in the web.config. This name must be the exact name in microsoft format with comma's, spaces and capitals. The get this string from a certificate you can use the C# program below:

using System;
using System.Security.Cryptography.X509Certificates;

public class X509
{
    public static void Main(string[] args)
    {

        // The path to the certificate.
        string Certificate = args[0];

        // Load the certificate into an X509Certificate object.
        X509Certificate cert = new X509Certificate(Certificate);

        // Get the value.
        string resultsTrue = cert.ToString(true);

        // Display the value to the console.
        Console.WriteLine(resultsTrue);

        // Get the value.
        string resultsFalse = cert.ToString(false);

        // Display the value to the console.
        Console.WriteLine(resultsFalse);

    }

}

Friday, July 27, 2012

Best free software to mount an ISO file in Windows

Why do I always have to search through all kind of crap software to find the best free tool I need to mount an ISO cd/dvd image in Windows. Let's make a blog post so I always remember the one and only tool that works for me:

Virtual Clone Drive

http://www.slysoft.com/en/virtual-clonedrive.html

Sunday, July 8, 2012

Install Zabbix 2.0.1 server from source on Ubuntu Server usingPostgreSql

For my Home network (one dual core esxi server with 9 Linux instances and 1 windows xp instance) I'm in need of a good service monitor. My choice is Zabbix. But after installing from the ubuntu packages I discovered it was a fairly old version at this moment. Time to install from source.

First some decissions I prefer


I create a single ubuntu server virtual machine for this installation. It is called mon01 (from monitor). I prefer PostgreSql above MySql so that is my preferred database and luckily Zabbix can deal with it. Although I have a separate database virtual machine for PostgreSql I prefer to have my complete monitor service on a single virtual machine. The only exception I make is for the frontend which I will install on my Nginx/PHP web virtual machine, but it can simply be installed on the same mon01 virtual machine. Also I like to install my own software builds to install in the home directory of the user that builds it. I create a user for zabbix and when I configure I will give it a prefix in the home directory of the user zabbix. Just to keep the distro clean.

Let's start


The first thing to do is install the dependencies that zabbix needs to build. Luckily this are all default ubuntu packages.
sudo apt-get install build-essential postgresql libpq-dev snmp libsnmp-dev snmpd libcurl4-openssl-dev fping libiksemel3 libiksemel-dev libssh2-1-dev libopenipmi-dev

After this create a new user to run the zabbix environment.
sudo adduser zabbix

Now switch to this new user.
sudo su - zabbix

Get the latest source from the zabbix website: http://www.zabbix.com (zabbix-2.0.1.tar.gz)

Extract the source.


tar zxvpf zabbix-2.0.1.tar.gz

Now it is time to create the postgres database. First logout the zabbix user and than switch to the postgres user.


broersa@mon01:~$ sudo su - postgres
postgres@mon01:~$ psql -U postgres
psql (9.1.4)
Type "help" for help.

postgres=# create user zabbix with password 'xxxx';
CREATE ROLE
postgres=# create database zabbix owner zabbix;
CREATE DATABASE
postgres=# \q
postgres@mon01:~$

 Now we need to edit the following file to set the postgresql access for user zabbix.


 vi /etc/postgresql/9.1/main/pg_hba.conf

 Add the following two lines at the start of the file:


local   zabbix  zabbix  md5
host    zabbix  zabbix 192.168.2.1/32  md5

replace the ip address with the address of the frontend server.

Now we need to bounce the postgres server. Execute the following as a superuser:


sudo service postgresql restart

You can test your connection to the server by logging in as the postgres user and connect to the zabbix database:


broersa@mon01:~$ sudo su - postgres
postgres@mon01:~$ psql -U zabbix zabbix
Password for user zabbix:
psql (9.1.4)
Type "help" for help.

zabbix=> \q
postgres@mon01:~$

When this succeeds we can continue to create and fill the database schema:


sudo su - postgres

cd ~zabbix/zabbix-2.0.1/database/postgresql/

cat schema.sql | psql -U zabbix zabbix
cat images.sql | psql -U zabbix zabbix
cat data.sql | psql -U zabbix zabbix

Now we can switch back to the zabbix user and start building the code:


sudo su - zabbix
cd zabbix-2.0.1
./configure --prefix=/home/zabbix/server --enable-server --enable-ipv6 --with-postgresql --with-jabber --with-libcurl --with-net-snmp --with-ssh2 --with-openipmi
make install

Now we have the server part in ~zabbix/server and the configuration file in ~zabbix/server/etc/zabbix/zabbix_server.conf

Edit this file and set the database settings.

The last step to get the server running is creating an start stop file so the server is started automaticly at a reboot.

First thing to do is create the file /etc/init.d/zabbixserver :


sudo vi /etc/init.d/zabbixserver

Add the following:


#!/bin/sh
# Starts and stops zabbix_agentd
#

case "$1" in
start)

        start-stop-daemon --start --exec ~zabbix/server/sbin/zabbix_server

;;

stop)

        start-stop-daemon --stop --exec ~zabbix/server/sbin/zabbix_server
;;

restart)
        $0 stop
        $0 start
;;

status)
             if pidof -o %PPID ~zabbix/server/sbin/zabbix_server > /dev/null; then
                     echo "Running"
                     exit 0
             else
                     echo "Not running"
                     exit 1
             fi
;;

*)
        echo "Usage: $0 {start|stop|restart|status}"
        exit 1
esac

Change the mode of the file and take care that it will get started at system boot. It will automatically get started as the zabbix user.


sudo chmod 755 /etc/init.d/zabbixserver
sudo update-rc.d zabbixserver defaults

 To start the server execute the following:


sudo service zabbixserver start

You can view the log in /tmp

This is the server part, in my next posts I will cover the agents and the frontend.

Friday, May 18, 2012

Install TeamCity Continuous Integration in Ubuntu Linux

In this post I will install the TeamCity Continuous Integration server in the Ubuntu Linux environment as configured in this previous blogpost. Before we start we have to give the Ubuntu Server a bit more memory as the 512 MB configured. Double it to 1024 MB.

First thing to do is install the latest Java Developers Kit in our Ubuntu server. (I will use the latest openJDK although it is not supported by TeamCity it is much easier to install in Ubuntu and I won't use this configuration for mission critical operations).
me@ubuntu01:~$ sudo apt-get update
me@ubuntu01:~$ sudo apt-get install openjdk-7-jre

After this download the latest TeamCity distribution from the linux tab from http://www.jetbrains.com/teamcity/download/
me@ubuntu01:~$ wget http://download.jetbrains.com/teamcity/TeamCity-7.0.3.tar.gz

Now unpack the distro to this location:
me@ubuntu01:~$ cd /var
me@ubuntu01:/var$ sudo tar zxvf ~/TeamCity-7.0.3.tar.gz

Now start the TeamCity server:
me@ubuntu01:/var$ cd TeamCity
me@ubuntu01:/var/TeamCity$ sudo ./bin/runAll.sh start
Using CATALINA_BASE:   /var/TeamCity
Using CATALINA_HOME:   /var/TeamCity
Using CATALINA_TMPDIR: /var/TeamCity/temp
Using JRE_HOME:        /usr
Using CLASSPATH:       /var/TeamCity/bin/bootstrap.jar:/var/TeamCity/bin/tomcat-juli.jar
Starting TeamCity build agent...
Java executable is found in '/usr/bin/..'.
Starting TeamCity Build Agent Launcher...
Agent home directory is /var/TeamCity/buildAgent
Current Java runtime version is 1.6
Lock file: /var/TeamCity/buildAgent/logs/buildAgent.properties.lock
Using no lock
Done [2761], see log at ../logs/teamcity-agent.log
me@ubuntu01:/var/TeamCity$

Create service start and stop procedures:
me@ubuntu01:/var/TeamCity$ sudo vi /etc/init.d/teamcity

Copy and paste the following:
#! /bin/sh
# /etc/init.d/teamcity
#

# Carry out specific functions when asked to by the system
case "$1" in
  start)
    echo "Starting script teamcity "
    /var/TeamCity/bin/runAll.sh start
    ;;
  stop)
    echo "Stopping script teamcity"
    /var/TeamCity/bin/runAll.sh stop
    ;;
  *)
    echo "Usage: /etc/init.d/teamcity {start|stop}"
    exit 1
    ;;
esac

exit 0

Now add it to the default Ubuntu boot procedure:
me@ubuntu01:/var/TeamCity$ sudo chmod 755 /etc/init.d/teamcity
me@ubuntu01:/var/TeamCity$ sudo update-rc.d teamcity defaults
 Adding system startup for /etc/init.d/teamcity ...
   /etc/rc0.d/K20teamcity -> ../init.d/teamcity
   /etc/rc1.d/K20teamcity -> ../init.d/teamcity
   /etc/rc6.d/K20teamcity -> ../init.d/teamcity
   /etc/rc2.d/S20teamcity -> ../init.d/teamcity
   /etc/rc3.d/S20teamcity -> ../init.d/teamcity
   /etc/rc4.d/S20teamcity -> ../init.d/teamcity
   /etc/rc5.d/S20teamcity -> ../init.d/teamcity
me@ubuntu01:/etc/init.d$

Now you can start and stop the TeamCity server with the service teamcity stop/start command. The TeamCity server will also be restarted after a reboot of your Linux server.

Normally we can now open the TeamCity admin page in our webbrowser at http://127.0.0.1:8111 . But because we have installed our installation in a virtual box virtual machine and we don't have a graphic browser in our Ubuntu server environment so we have to create a Virtual Box port forward to our Ubuntu virtual machine. I described the port forward construct in this blogpost, so I will show the short version here. We have to create a port forward of a local port 8111 to the Ubuntu Virtual Machine at port 8111. To do this you have to shut down your Virtual Machine. (But remember TeamCity will automatically come up after a reboot ;-). Open a command line shell on your workstation and type the following after the shutdown of the Ubuntu virtual machine:
Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\broersa>cd "c:\Program Files\Oracle\VirtualBox"

c:\Program Files\Oracle\VirtualBox>VBoxManage modifyvm "ubuntu01" --natpf1 "gues
tteamcity,tcp,,8111,,8111"

c:\Program Files\Oracle\VirtualBox>

Now restart you Ubuntu virtual machine and point your local browser to http://127.0.0.1:8111 .


 
Click proceed and your new server is starting for the first time.