Adam PashSubversion is open source version control software used primarily by developers that keeps every revision of important, frequently changing files. However, Subversion can be useful for many different purposes, whether you're a web developer or a novelist - especially if you like to work in plain text. Think of Subversion as a wiki-like repository for your files. Each time you make a change to a file or group of files that you're happy with, you can commit those changes to your Subversion repository. If you don't like where the changes got you, Subversion can compare your current version with any previously-committed version and pick out the best of the best so you never have to worry about finding your way back to a good or working version of a file.In this first of my two-part Subversion series, I'll show you how to set up and run your own Subversion server. Next week, we'll get into the nitty gritty of using Subversion. Please note: You can choose to run Subversion without the server component (Apache) and it still works wonders for keeping versioned copies of your files. The only catch is you won't be able to access your files from other computers. If you'll only be using it as a personal repository on one computer, you can skip the steps geared toward Apache (marked with an asterisk [*]). If you're not sure if Subversion is for you, I'd recommend trying it without Apache first. Setting up Subversion by itself is VERY easy, but if you do decide to run the web server in conjunction with Subversion, make sure your computer's properly patched and beefed up on security. Oh, it is? Good, let's go! Setting up your Subversion server 1.* Download and install Apache 2.0... - for Windows, you want the Win32 Binary (MSI Installer) about half way down the page - you don't want 2.2.... When you're installing Apache, you can keep all the defaults unless you know what you're doing and have your own good reasons for switching things up. 3.Download and install Subversion 1.3.2 (the svn-1.3.2-setup.exe download). Again, just accept all of the defaults in the setup, making sure that "Install and configure Subversion modules..." is checked. 4.Download and install TortoiseSVN (TortoiseSVN-18.104.22.16804-svn-1.3.2.msi), an attractive Subversion client for Windows that makes dealing with Subversion repositories a breeze via right-click. 5.* Edit your Apache httpd.conf file at C:\Program Files\Apache Group\Apache2\conf\httpd.conf (make a backup first in case something goes awry) to add the following lines of code to the end of the file: # Configure Subversion repository
Save and close the httpd.conf file, then restart Apache. 6.Create two folders on your C:\ drive - one called svn and another called svn_conf (svn_conf is not necessary if you're using Subversion without Apache). 7.* Password protect your Subversion repository by firing up the command line and typing the following commands: cd "C:\Program Files\Apache Group\Apache2\bin" htpasswd -c C:\svn_conf\passwd adam substituting your name for adam. Create your first repository
The last thing we're going to do this week is create our repository. Go to your C:\ drive, right-click the svn folder and select TortoiseSVN -> Create repository here... command. If all goes well, TortoiseSVN should ask you what type of repository you'd like to create. Select Native filesystem (FSFS) and click OK. You will get a message telling you that "The Repository was successfully created." Congrats! Finally, let's import the directory of files that you want to keep under version control into your newly-minted repository. Right-click on your to-be-controlled folder and select TortoiseSVN -> Import.... You need to give TortoiseSVN the directory of your repository, so browse for C:\svn. Click OK and all of the files under your chosen directory will be imported into your Subversion repository at C:\svn.
If you set up Subversion with Apache, you can test it out by directing your browser to http://localhost/svn and entering your username and password. If you're not using Apache, you can verify that everything worked by right-clicking on a new folder and checking out your files from the repository (right-click -> SVN Checkout...). Just direct TortoiseSVN to the directory of your Subversion repository. We've really just skimmed the surface of what you can do with Subversion, so if you still aren't quite sure what the point is, be sure to tune in next week when I'll demonstrate the glory of Subversion in action. In the meantime, you might want to play around with your repository, checking out and committing files, to get familiar with its most basic functions.
Adam Pash is an associate editor for Lifehacker who takes comfort in the knowledge that he can always go back to a file from two weeks ago if he really messes something up. His special feature Hack Attack appears every Tuesday on Lifehacker.