So, most of Linux distribution has not included Subversion 1.7 yet. What I like most from Subversion 1.7 is that it only contains one .svn directory just like Git (I'm a Git fan actually). I'm going to document my experience installing Subversion 1.7 on Ubuntu 11.04 and migrating from 1.5 into this version
Adding to repo
- Check if version 1.7 is available to download
apt-cache show subversion | grep Version:
- If it is not, add to repository
echo "deb http://opensource.wandisco.com/ubuntu lucid svn17" | sudo tee /etc/apt/sources.list.d/svn.list sudo wget -q http://opensource.wandisco.com/wandisco-debian.gpg -O- | sudo apt-key add - sudo apt-get update sudo apt-get dist-upgrade
Installation
- Install the package
sudo apt-get install subversion
- Create repository directory
sudo mkdir /var/lib/svn
Access via HTTP
- Install required packages
sudo apt-get install libapache2-svn
- Create file /etc/apache2/mods-available/dav_svn.conf containing
# Allowing to list all repositories available DAV svn SVNParentPath /var/lib/svn # Authentication AuthType Basic AuthName "Subversion Repository" AuthUserFile /etc/apache2/dav_svn.passwd # Any access (GET, POST, etc) requires authenticated users Require valid-user # Disable request size limit # LimitXMLRequestBody 0
- Create empty file for authentication
sudo touch /etc/apache2/dav_svn.passwd
- Restart Apache
sudo service apache2 restart
- Create a repo and user for testing (see the following guidence)
Create a repository
Do the following commands using root by invoking "sudo su -"cd /var/lib/svn svnadmin create myproject chown -R www-data.www-data myproject
Create user
Only if you use AuthUserFile directive like defined above.- Create user
sudo htpasswd -c /etc/apache2/dav_svn.passwd user_name
- Restart Apache
sudo service apache2 restart
- Test checkout
svn co http://hostname/svn/myproject myproject --username user_name
Using LDAP auth
- Activate LDAP authentication module on Apache 2
sudo a2enmod authnz_ldap
- Change configuration to use LDAP
On /etc/apache2/mods-available/dav_svn.conf, comment AuthUserFile and put the following lines
AuthBasicProvider ldap AuthLDAPURL ldap://myldapserver/dc=mybcmp,dc=com?uid?sub AuthLDAPBindDN cn=admin,dc=mybcmp,dc=com AuthLDAPBindPassword "myLdapAdminpassword"
- Reload configuration
sudo apache2ctl restart
Migrating from older SVN
- Copy repositories' directory of older SVN into the new SVN directory.
- Change permission recursively into www-data.
- I suggest you use svndump instead of this way.
Linux way to use svndump faster
- Mount remote directory.
sshfs ichsan@oldsvn.com:/svn/parent /tmp/remoteparent
- Dump and restore
Run the following script as root (put it in an executable file e.g. dumpres.sh)
#!/bin/sh cd /tmp/remoteparent/ SAVEIFS=$IFS IFS=$(echo -en "\n\b") for repo in *; do t="/var/lib/svn/$repo" svnadmin create "$t" svnadmin dump "$repo" | svnadmin load "$t" done IFS=$SAVEIFS
After some research, I came into some conclusions:
- User is stored in each SVN repository metadata.
- SVN Server 1.7 can serve old repo directory (the repo structure was created by older version of SVN). Client 1.7 will see only one .svn directory.
- Migration using copy way compared to svndump way, both take the same time in doing "svn log". But the size on the server is quite different. Copying is larger than svndump (46M vs 39M on one example of mine)
Reference:
http://ubuntuforums.org/showthread.php?t=1876156
https://help.ubuntu.com/community/Subversion
No comments:
Post a Comment