In this article, i will talk about installing and using Subversion on Ubuntu 10.04 LTS machine.
What is Subversion?
In brief Subversion is a kind of version tracking and common software development software.
You can easily develop your software projects by creating revisions using Subversion.
Now let’s install Subversion on our GNU/Linux machine, Ubuntu 10.04 LTS.
1-) Installing Subversion packages,
bolat@bolat-vaio:~$ sudo apt-get install subversion libapache2-svn
2-) Creating subversion group and adding users,
a- Choose System > Administration > Users and Groups from your Ubuntu menu.
b- Select the Group tab.
c- Click the 'Add Group' button
d- Name the group 'subversion'
e- Add yourself (for me username: bolat) and www-data (the Apache user) as users to this group
In order to see your user name and subversion group,
- Start gconf settings editor: Alt+F2 gconf-editor Enter.
- In the tree, locate /apps/gnome-system-tools/users.
- Select the "showall" check-box.
3- Creating Subversion folder.
bolat@bolat-vaio:~$ sudo mkdir /var/svn
bolat@bolat-vaio:~$ cd /var/svn
bolat@bolat-vaio:/var/svn $ sudo mkdir projects
4- Creating repository in the Subversion folder.
bolat@bolat-vaio:~$ sudo svnadmin create /var/svn/projects
5- Configuring file permissions,
bolat@bolat-vaio:~$ cd /var/svn
bolat@bolat-vaio:/var/svn $ sudo chown -R www-data:subversion projects
bolat@bolat-vaio:/var/svn $ sudo chmod -R g+rws projects
6- Importing projects into Subverion repository,
bolat@bolat-vaio:~$ svn import /home/bolat/embedded/lpc2368projects file:///var/svn/projects
7- Configuring apache web server for WebDAV access, (You can easily access the subversion repositories through http, using WebDAV plugin)
bolat@bolat-vaio:~$ sudo nano /etc/apache2/mods-available/dav_svn.conf
then add these lines below,
<Location /svn/projects>
DAV svn
SVNPath /var/svn/projects
AuthType Basic
AuthName "myproject subversion repository"
AuthUserFile /etc/subversion/passwd
<LimitExcept GET PROPFIND OPTIONS REPORT>
Require valid-user
</LimitExcept>
</Location>
or in order to see all repositories at once,
<Location /svn>
DAV svn
SVNParentPath /var/svn
SVNListParentPath On
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /etc/subversion/passwd
<LimitExcept GET PROPFIND OPTIONS REPORT>
Require valid-user
</LimitExcept>
</Location>
then,
bolat@bolat-vaio:~$ sudo /etc/init.d/apache2 restart
8- Adding users into authenticating WebDAV access,
bolat@bolat-vaio:~$ sudo htpasswd -c /etc/subversion/passwd bolatsvnuser
not: must be used -c parameter, in order to create first user.
bolat@bolat-vaio:~$ cat /etc/subversion/passwd
you can be sure that user added.
9- Trying Subversion repository,
bolat@bolat-vaio:~$ svn co http://hostname/svn/projects projects --username bolatsvnuser
not: if you use for local machine, host name must be localhost instead of hostname.
10- Accessing methods Subversion repository,
Basic subversion access methods,
- file:// Direct repository access (for local disk)
- http:// Access via WebDAV protocol to Subversion-aware Apache2 web server
- svn:// Access via custom protocol to an svnserve server
- svn+ssh:// Same as svn://, but through an SSH tunnel
Direct access to Subversion repository from local,
bolat@bolat-vaio:~$ svn co file:///var/projects
not: be careful about three slash,
bolat@bolat-vaio:~$ svn co file://localhost/var/projects
Access to the repository via http:// WebDAV
bolat@bolat-vaio:~$ svn co http://hostname/projects projects
Access to the repository via custom protocol svnserve server,
bolat@bolat-vaio:~$ svn co svn://hostname/projects projects
Access to the repository via custom protocol svnserve through SSH tunnel,
bolat@bolat-vaio:~$ svn co svn+ssh://hostname/projects projects
If you want to configure user access to Subversion repository,
bolat@bolat-vaio:~$sudo nano /var/svn/projects/conf/svnserve.conf
then edit
# anon-access = read
# auth-access = write
section to allow anonymous and/or authoritative access.
If you would like to use proprietary svn access to Subversion repository, you must set svnserv as,
bolat@bolat-vaio:~$ svnserve -d --foreground -r /path/to/repos
# -d -- daemon mode
# --foreground -- run in foreground (useful for debugging)
# -r -- root of directory to serve
For more usage details, please refer to:
$ svnserve --help
Now we installed Subversion, imported a project, and configured Subversion access, let’s check it out,
bolat@bolat-vaio:~$ svn co http://localhost/svn/projects -username bolatsvnuser
bolat@bolat-vaio:~$ cd projects
bolat@bolat-vaio:~/projects $ svn update; svn log
Sources,
https://help.ubuntu.com/8.04/serverguide/C/subversion.html
https://help.ubuntu.com/community/Subversion