Subversion
Patch the system:
pico /etc/apt/sources.list
deb http://ro.archive.ubuntu.com/ubuntu hoary universedeb-src http://ro.archive.ubuntu.com/ubuntu hoary universe
Install the required packages, running the following command:
apt-get install libapache2-svn subversion subversion-tools
Creating your repository
Run as root:
cd /home
mkdir /home/svn
chown www-data:tomcat6 /home/svn
su www-data -c "svnadmin create /home/svn/src"
Your repository will live in /home/svn/src.
Note that if you let your users run things as www-data (eg. they can install CGI applications) they will be able to write to your repository!
Configure Apache
Become root again and add the following lines to our apache configuration (ssl), inside of the VirtualHost declaration.
$pico /etc/apache2/mods-enabled/dav_svn.conf
<Location /svn/src>
DAV svn
SVNPath /home/svn/src
AuthType Basic
AuthName "QBW Subversion Repository"
AuthUserFile /home/svn/.dav_svn.passwd
Require valid-user
</Location>
If you don't want to use passwords for read-only access, use this instead of the Require valid-user line:
<LimitExcept GET PROPFIND OPTIONS REPORT>
Require valid-user
</LimitExcept>
Once you've applied these changes,
Create some users
Add an user with the following command:
su www-data -c "htpasswd -c -m /home/svn/.dav_svn.passwd user"
The -c is only required the first time you run this command, in order to create the passwords' file. Subsequent runs won't require it:
su www-data -c "htpasswd -m /home/svn/.dav_svn.passwd user"
Note that the passwd file does not need to be created as www-data. It can be created as root, for example. However, it must be visible by www-data.
In the meantime htpasswd had changed – htpasswd will do it (apache2 – Version: 2.2.4-1 on Debian apache2-utils_2.2.4-1_i386.deb)
Testing the repository
Using your browser. Load https://hostname/svn/src/ in your browser. Replace hostname with your host name or ip. You will get something like:
Revision 0: /Powered by Subversion version 1.1.3 (r12730).
Import your initial data:
svn --username user import src https://localhost/svn/src -m "initial import"Authentication realm: <https://localhost:443> My Subversion RepositoryPassword for 'user':Adding src/checkersAdding src/checkers/trunkAdding src/checkers/trunk/gendelta.plAdding src/checkers/siteAdding src/checkers/branchesAdding src/checkers/tags
Committed revision 1.
Now load your URL in your browser again and make sure you can browse what you imported:
- checkers/Powered by Subversion version 1.1.3 (r12730).
backup/restore repository
sudo su
backup repo
$ svnadmin dump /media/shares/svn > /media/backup/svn.dump
WIN CMD: svnadmin dump d:\QBW_Subversion\repository > d:\QBW_Subversion\svn.dump
create a new repo
mkdir src2
chown www-data:tomcat6 src2
svnadmin create /home/svn/src2
restore to a new repo
svnadmin load --force-uuid /home/svn/src2 < /var/svn.dump
mv /home/svn/src /home/svn/src_old
mv /home/svn/src2 /home/svn/src
Restoring from Backups (svn.qbytesworld.info) webfactions¶
Backups can be restored with the svnadmin‘s load command. To restore a backup:
-
Open an SSH session to your account.
-
Switch to the directory of a new Subversion application. Entercd ~/webapps/svn, where svn is the name of the Subversion application as it appears in the control panel, and press Enter.
-
Enter svnadmin load . < dump_file where dump_file is the path to the backup, and press Enter.
Note
To prevent your restoration from being stopped for excessive processor utilization (particularly for repositories with many commits or a large total file size), prefix the svnadmin command with the nice command for deference to other processes:
nice -n 19 svnadmin load . < dump_file
MVN setup???
Alias /maven/ "/home/davidq/"
<Location /home/davidq>
AuthType Basic
AuthName "QBW Maven Repository"
AuthUserFile /home/svn/.dav_svn.passwd
Require valid-user
SSLRequireSSL
</Location>
SVN BOOK
http://svnbook.red-bean.com/