Initial Setup
sudo aptitude install subversion
The next steps is to create a new group that will be responsible for subversion tasks.
- From the Panel, navigate to System > Administration > Users and Groups
- If necessary, unlock the dialog, and then click “Manage Groups”
- Click “Add Group”. Create a group named “subversion”, and add yourself to it.
- Log out and back re-log in for the changes to take effect.
- n a terminal, create your new folder, using the commands:
cd /home
sudo mkdir svn
Adding the First Repository
cd /home/svn
sudo mkdir my-project
Finally, we use the “svnadmin” command to create some base files and configure the repository.
sudo svnadmin create /home/svn/my-project
Now, change the access permissions to give the subversion group the proper settings:
sudo chgrp -R subversion my-projectsudo chmod -R g+rws my-project
Configuring Your Repository
At this point, you should have a working repository. However, there are still a few options you might want to tweak. In particular, the access permissions. By default, a fresh repository will be readable by anyone and writable by authorized users. To change these settings, open /home/svn/my-project/conf/svnserve.conf in your favorite text editor– you can use the command:
gedit /home/svn/my-project/conf/svnserve.conf
The lines that control access restrictions look like:
# anon-access = read# auth-access = write
These two lines control anonymous access and authenticated access, respectively. To change from the default behavior for each value, remove the leading ‘#’ character, and set the right-side value to ‘read’, ‘write’, or ‘none’, for read-only, read-write, or no access, respectively. When you are finished, you can save the file and close it.
If you plan on using authenticated access to your repository, you will need to set up at least one username and password. To do so, open the/home/svn/my-project/conf/passwd file in a text editor:
gedit /home/svn/my-project/conf/passwd
To create a username, simply add a line to the bottom of the form:
username = password
There are a few examples already in the file, but commented out. You may add as many usernames as you need.
Access From the Host Computer
At this point you are ready to test out your new repository. Any configured repositories should be accessible from the host computer as-is. You can test it out by checking-out your first working copy:
svn checkout file:///home/svn/my-project ~/my-project-wc
Perhaps you would like to add a “trunk” directory, where you will develop your project:
cd ~/my-project-wcmkdir trunksvn add trunksvn commit -m "Add a trunk directory for development."
Depending on your configuration above, you may be asked for a user name and password. You should use the values you entered in the passwd file.