Subversion, or “SVN” for short, is a development tool which is a versioned repository for your documents or code. It is allows you to maintain versions of files in an organized manner. Using SVN you can retrieve different versions of documents quite easily. Let’s take a look at how to set it up on Mac OS X Leopard.
- Let’s begin by installing SVN. There are a number of ways you can get and install SVN on your Leopard system. The easiest method, the one we will use here, is using XCode. XCode is a set of development tools that ship with your Mac. If you pop in the second DVD that came with your Leopard system, titled “everything else”. You will find the XCode 3 installer on this disk. Double click on it to install. In case you are unable to get your hands on the disc you can also download the XCode 3 installer from Apple’s website. You will, however, need to sign up for the Apple Development Connection program to be able to download XCode 3. The membership is free.
- Now let’s do a simple installation of SVN. Remember, this is a basic installation, without a lot of security. I’m assuming here that you are installing this on your machine for only you to use and will not open access to all. To do that you need to add a lot of security, which is beyond the scope of this article.
Here are steps we are going to follow:
- create a local SVN repository
- configure the Apache web server to work with SVN
- configure Apache to use the repository we created
- setup basic authentication for SVN
- Let’s create an SVN repository at the location ‘/usr/local/repo’. Launch the Terminal and execute the following command:
# sudo mkdir /usr/local/repo
At this point you will be prompted to enter your password. Enter the password you use for the user you are logged in as. Now create a new project called ‘testproject’ in SVN and under the directory we created earlier.
# sudo svnadmin create /usr/local/repo/testproject
We need to make sure that the Apache web server can read and write to this repository. So run the following command in the Terminal:
# sudo chown -R www /usr/local/repo
- We now need to configure the Apache web server to work with SVN. Follow the steps carefully, as we are going to be editing the configuration file used by Apache. If done wrong, this can break Apache. Open the Apache configuration file ‘httpd.conf’ in your favorite text editor, for example Vim:
Scroll down the document till you reach a section where you see a lot of instances of “LoadModule”. Create a new line at the end of this section using the ‘o’ key in Vim, and enter the following:
# sudo vim /etc/apache2/httpd.conf
Scroll down the document till you reach a section where you see a lot of instances of “LoadModule”. Create a new line at the end of this section using the ‘o’ key in Vim, and enter the following:
LoadModule dav_svn_module libexec/apache2/mod_dav_svn.so
- Now we will add a separate configuration file for SVN. Scroll down to the end of the document and ad the following line:
Include /private/etc/apache2/extra/httpd-svn.conf
Save and exit the file. If you are using Vim then you need to use the following key combination, “ESC + ‘:wq!’ + Enter” to do that. Now open this file using Vim and let’s configure it.
# sudo vim /private/etc/apache2/extra/httpd-svn.conf
Enter the following into the file:
DAV svn
SVNParentPath /usr/local/repo# user authentication
AuthType Basic
AuthName “Subversion repository”
AuthUserFile /etc/users
# only authenticated users may access the repository
Require valid-user
- Now let’s setup a user for SVN. I’ll create the user calvin and assign him a password. This password protects our Subversion repository.
# sudo htpasswd -cm /etc/users calvin
New password:
Re-type new password:
Adding password for user calvinWe’re done now. Hit the url “http://localhost/repo/testproject” in your web browser. You should be prompted for a password here. Enter the username and password you just set. you should be in. You can now create more projects like we created “testproject”.
No comments:
Post a Comment