Setting up a Subversion Server on Dell Optiplex 745 running Windows

(by Brian Wilson, 2/4/07)


(Read a personal description of Backblaze here.)

Explanation & Setup Time:

I bought a Dell Optiplex 745 "small form factor" intended to be a subversion server because it is a completely standard PC clone, a physically small machine, nice and fast (2.66GHz Intel Core2 Duo, 1GHz front side bus, Gigabit ethernet) while being low power consumption.  I chose to run "Windows 2003 Server" on it.  I could have chosen any version of Windows like Windows XP Pro or Vista, but Microsoft limits the number of open sockets on those versions of their OS, so I went ahead and installed Windows 2003 Server on the Optiplex so I wouldn't run into any problems.  These instructions should work identically for any Microsoft Windows.  These instructions will also work on any other PC clone, I just happened to do them on the Optiplex.  So whenever I say "Optiplex", you can substitute "Brand XYZ PC Clone".

Setup Time -> I had never used subversion at all before today.  My Optiplex arrived at my door at 11am, and about midnight (13 hours) I had this webpage completed and the subversion system up and running.  With this webpage, you should be able to get subversion running on Windows in less than 30 minutes, just be super careful to follow the directions exactly.

The Big Picture:

The subversion "server" runs on the Optiplex, and you *NEVER* check in code locally.  Developers each sit at their desk, run the subversion "client" locally on the desktop, and it connects over the network to the subversion server.  The "svnserve" is the server executable run on the Optiplex.  The "svn" executable is the "client" that is run by the developers sitting at their desks to checkout and check in code.  I chose to run the subversion server on a native filesystem (as opposed to inside a database which has locking and stability and extra complexity and dependency problems).

 

References:

http://subversion.tigris.org/ - homepage for subversion project

http://svnbook.red-bean.com/nightly/en/svn-book.html - Main SVN manual

Windows Guru - Mike Farace

Current Up-to-date Technologist - Damon Uyeda

Common Sense Technologist - Chad West

 

Step 1: Install Windows 2003 Server Enterprise - clean install, from the ground up

From my MSDN subscription, I downloaded a CDROM iso image of Windows 2003 Server Enterprise (not sure why I did "enterprise", I don't know the difference) and burned it onto a CDROM.  Then I powered up the Dell Optiplex 745, hitting "F12" to stop the boot.  Popped in the CDROM, booted from it.  When the screen describing all the partitions came up, I deleted ALL of them, then created one new partition of the whole drive, formatted as NTFS the slow long way (there was a "quick" option).  The format took 2 hours on a 250GB SATA 3.0 drive, then my Optiplex automatically rebooted into a screen saying "setup will complete in 39 minutes" and it chugged away for 5 minutes.  Then it prompted me for some language options and I dug and ALSO installed all Asian language support (Install files for "right to left" and "East Asian").  In 2 more minutes I got to put in my name and org name, then type in a license key.  Got two choices of license -> so chose top "Bulk" license and typed in the number "100" for concurrent connections.  Then it rebooted itself.

At reboot I chose the "Windows 2003 Server" (the other, pre-install choice was there also).  Logged in as Administrator, and it came up and ran!  Set desktop to 1600x1200 with "Display" control panel.  It had a "Windows Server Post-Setup Security" trying to connect to internet.  No internet connectivity, so on another computer I downloaded the drivers for the onboard ethernet called "win_xp_2k3_32-10.24d.zip" file from downloads section of http://www.broadcom.com/ for my network adapter, put it on a USB Flash drive, carried it to the Optiplex, plugged it in.  On the Optiplex used "Add Hardware" control panel, said it was already installed hardware, Chose "Ethernet Controller", it said "no driver", then a few dialogs later I got to "Install the software from a specific location" which I browsed to the USB Flash Driver, said "go", and it installed the Broadcom NetXtreme 57xx Gigabit Controller in 2 seconds.  Had to play with ipconfig /renew for a few seconds to get network all connected in web browser.  Removed CDROM at this point, and the USB Flash drive.

THEN I was able to use the "Windows Server Post-Setup Security" to connect to the internet, download all updates and installed.  (60 MB of download).  Ran IE 3 more times and selected "Windows Update" to get all updates.

Now brought up "System" control panel, click on "Hardware" tab, click on "Device Manager".  Found 3 things in yellow including "video controller".  So went to http://www.intel.com looked around on downloads for the "Q965/Q963 Express Chipset" drivers.  Failed to ever find anything that would work, gave up.  The graphics work well enough (display 1600x1200 just fine).

MISC CONFIG - In "Control Panels"->"System", I do two things: 1) turn on "Automatic Updates at 4am", and 2) in the "Remote" tab I enable Remote Desktop to this computer.

ADD A USER - In the "Administrative Tools" menu, launch "Computer Management".  In that tool, there is "Local Users and Groups".  Select "Users" folder.  Go to "Action" menu and choose "New User".  Fill out all fields SPELL USERNAME EXACTLY the same as on other computers you are using, and use the same spelling later for subversion usernames.

CREATE A SHARED FOLDER - Create the folder "C:\bowl", then right click on it and "Properties", click on "Sharing" tab, "share this folder", give it the name "share", click on "Permissions" and allow everyone "Full Control".  TO TEST-> immediately on another computer go to \\<optiplexname>\bowl and it will prompt for username/password, then it should allow creation of docs in that directory.

PERMISSIONS/SECURITY on the SHARED FOLDER - (ADDED LATER) - when more people started in the office, we had troubles where one person created a file from a Macintosh on the common \\whistler\bowl share, then another person on a Windows box couldn't delete or rename that file, and vice versa.  This was solved by Right-Clicking on the C:\bowl and selecting "Properties", then clicking the "Security" tab, then selecting each of the "Group or user names" and then making each and every group have "Full Control" (single checkbox).

OTHER MISC FOLDERS - Create "C:\tmp" and "C:\temp"

HOSTS FILE - Edited C:\WINDOWS\System32\drivers\etc\hosts to contain the 7 computers in my network

PRINTER DRIVER - I have a Canon MP500 printer on this computer for all the computers on the network to print to, so I installed the print driver (stored on \\whistler\bowl\PrinterDrivers).

 

Step 2: Install Subversion (as a Client on *ANOTHER* Windows computer!!)

2.1 - Go to http://subversion.tigris.org/ and find the latest Windows binary versions.  At the moment I did this, it was 1.4.3 released January 25, 2007.  I found it as http://subversion.tigris.org/downloads/svn-win32-1.4.3.zip, inside that zip was a folder called "svn-win32-1.4.3".  I also found the directions here useful (skip EVERYTHING about building from source code, section "D" is Windows Installation): http://svn.collab.net/repos/svn/trunk/INSTALL

2.2 - On ANOTHER computer (not the Optiplex) -> Copy all the contents to the directory "C:\Program Files\Subversion\"  so that (for example) this binary exists: "C:\Program Files\Subversion\bin\svn.exe"

2.3 - Change PATH environment variable to include "C:\Program Files\Subversion\bin" -> you do this by opening the "System" control panel, then going to "Advanced" tab, then clicking "Environment Variables" button, then in "System Variables" edit "Path".

2.4 - Set APR_ICONV_PATH environment variable to be "C:\Program Files\Subversion\iconv" so that it has foreign language support

2.5 - Set SVN_EDITOR environment variable to be "C:\WINDOWS\System32\notepad.exe".  (NOTE: on Windows 2003 it should be C:\Windows\notepad.exe)

 

Step 3: Install Subversion (as a Server on the Optiplex running Windows 2003 Server)

Just follow the identical instructions as "Step 2" above on the Windows 2003 server box.  It turns out the server and client of svn are the exact same install.  But notice "Step 4" below to get the server running.

 

Step 4: Create the Subversion Repository on the Optiplex Server

In the following steps, the top level directory is called "svntop".  This is the directory that will hold several "repositories", and the first repository is called "tree".  "Repositories" are named containers to hold source code.  It is customary to have a "trunk" in each repository, and helps later when you get branches.

4.1 - Create a directory "C:\svntop"

4.2 - run this command:   svnadmin create C:\svntop\tree --fs-type fsfs

4.3 - run this command:   svn mkdir file:///C:/svntop/tree/trunk

4.4 - test that everything is good by starting the server with this command on the optiplex:   svnserve -d -r C:\svntop
        (then if it runs and sits there and doesn't complain everything is Ok, now kill that command and go to "Step 5" below).

 

Step 5: Add Logins to the Subversion Repository on the Optiplex Server (Configure Subversion to Allow Access to Users Correctly)

Open C:\svntop\tree\conf\svnserve.conf in any text editor, and "uncomment" and change these lines as follows:

  [general]  
  anon-access = none  
  auth-access = write  
  password-db = passwd  
  realm = BrianSoftwareHouse 

Create a new file C:\svntop\tree\conf\passwd in any text editor, and add these lines (replacing "username1" with real logins, and "password1" with an appropriate password):

  [users]  
  username1 = password1  
  username2 = password2  
 

Step 6: Import the first file into the Subversion Repository from ANOTHER COMPUTER (not the Optiplex)

Run the svnserve process on the Optiplex Server with the command "svnserve -d -r C:\svntop" and then ON ANOTHER COMPUTER (not the Optiplex!!!) run these commands:

   6.1 - mkdir C:\tmp6
   6.2 - mkdir C:\tmp6\base
   6.3 - edit C:\tmp6\base\foo.txt and put a couple of lines of text in it
   6.4 - svn import C:\tmp6 svn://<optiplex_hostname>/tree/trunk -m "initial import"

When you run the above command, IT SHOULD first mention "BrianSoftwareHouse" (proving it connected over the network to the subversion server) and THEN prompt you for your subversion password.  Type in your password, and it should import the file.  Subversion will cache this password and won't prompt you ever again.  Now execute the following commands (NOT ON THE OPTIPLEX):

   6.1 - mkdir C:\tree     (Do this on another computer, NOT ON THE OPTIPLEX!!)
   6.2 - cd C:\tree        (Do this on another computer, NOT ON THE OPTIPLEX!!)
   DEPRECATED -> 6.3 - svn checkout svn://<optiplex_hostname>/tree/trunk   (Do this on another computer!) 
   6.3 HTTP Version - svn checkout http://bzsvn/svntop/tree/trunk   (Do this on another computer!) 

When you run the above command, IT SHOULD check out the file you imported above into the location C:\tree\trunk\base\tmp.h

 

Step 7: Make Subversion a Windows Service (so you don't need to be logged in to have it run)

Below are the directions I found here: http://wiki.beyondunreal.com/wiki/Setting_Up_A_Subversion_Server, but edited to be specific to my system and only the parts I actually did:

7.1 - We need the programs "instsrv.exe" and "SRVANY.EXE", so download windows resource kit tools from http://www.microsoft.com/downloads, "System Tools".  Specifically the package "rktools.exe" which is listed as "Windows Server 2003 Resource Kit Tools". Install this by double clicking the installer and following prompts.

7.2 - Make the word "Subversion" the name of a service which is actually the "SRVANY.EXE" utility with the following command line:

      instsrv "Subversion" "C:\Program Files\Windows Resource Kits\Tools\srvany.exe"  

7.3 - Change the Windows Registry so that SRVANY.EXE runs correct subversion executable with the correct parameters when it runs.

   7.3.1 - Run regedit
   7.3.2 - Select this folder: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Subversion  
   7.3.3 - From the Edit pulldown menu, select New→Key 
   7.3.4 - For the name of the new key, type "Parameters" 
   7.3.5 - From the Edit pulldown menu, select New→String Value 
   7.3.6 - For the name of the new string value, type "Application" 
   7.3.7 - From the Edit pulldown menu, select "Modify" (or just double-click the new "Application" key in the right pane) 
   7.3.8 - Type into the edit box:     C:\Program Files\Subversion\bin\svnserve.exe
   7.3.9 - From the Edit pulldown menu, select New→String Value 
   7.3.10 - For the name of the new string value, type "AppParameters" 
   7.3.11 - From the Edit pulldown menu, select "Modify" (or just double-click the new "AppParameters" key in the right pane) 
   7.3.12 - Type into the edit box:    -d -r C:\svntop 
(The "-d" means daemon(server), the "-r" says where the repositories live)
Below is a screenshot of what the above 12 steps should have achieved in regedit:

7.4 - Check that our service is configured properly by giving it a try.  Open the "Services" control panel under "Administrative Tools", hopefully the "Subversion" service is listed now as a service, highlight it, click "Start".  Everything work?  Now you should be able to access this from other machines through "svn://<optiplex_hostname>/tree/trunk"

 

Appendix A: Installing Subversion as a Client on Apple Macintosh

On 2/12/04 I brought online an "Apple Macintosh Mini", and connected it to the subversion repository. Go to http://www.codingmonkeys.de/mbo/ and get the "Subversion 1.4.3 Installer Package" made by Martin Ott, run it, done.  Should take you less than 30 seconds including the download.  (There is an alternative where you first install a Macintosh package manager called "MacPorts", but the Martin Ott installer is much more simple.)  The "svn" application appears on the Macintosh in /usr/local/bin/svn, so you need to add that directory to your PATH so you can run it from the Macintosh Terminal program.  Also set SVN_EDITOR to be "vi".  I had to use an IP address for the subversion server like this: svn checkout svn://192.168.168.26/tree/trunk

Appendix B: Setting up email notifications on SVN/Subversion commit

Added 8/28/07.  I looked into configuring "svnnotify" but gave up, but it just involves too many packages I don't want to deal with (including Apache!)  Open source people are loonatics, it takes the following list of packages to get svnnotify to run: 1) "Apache 2.0.55", 2) Active Perl 5.8.8-817, 3) Perl Module "Module::Build", 4) Perl Module "Authen::SASL", 5) Perl Module "Net::SMTP_auth", 6) Perl Module "SVN::Notify".  That sounds like a mountain of work I probably can't even get working, so I wrote a small 'C' program that is MUCH SAFER and a lot less hassle than all of that.  My tool is called "bzsvnalert".

To install bzsvnalert -> Go to C:\svntop\tree\hooks on the Windows 2003 Subversion server box, and duplicate the file "post-commit.tmpl" to be "post-commit.bat" (NOTICE THE ".BAT" AT THE END!!) and then edit it with Notepad to have *ONLY* this one line in it (in Windows, the %1 means "argument 1" and in SVN the first arg is Repository and second argument is "revision":

C:\bztools\bzsendsvnalert -postcommit %1 %2 <EMAIL_ADDR> <SMTP_SERVER> <SMTP_AUTH_USERNAME> <SMTP_AUTH_PASSWORD>

the <EMAIL_ADDR> looks like blah@blah.net

(for me the <SMTP_SERVER> is "smtpout.secureserver.net" which is my hosting provider's outbound SMTP server)


(Read a personal description of Backblaze here.)

Click Here to return to Ski-Epic Home, and Click Here to return to Random Stuff in Brian's Life