Hosting Subversion Service on your router

From DD-WRT Wiki

Jump to: navigation, search


Contents

[edit] Assumptions

  • It is assumed that you've properly mounted your USB flash/disks.
  • It is assumed that you've optware settled on /opt
  • It is assumed that you've SSH access to the router.

[edit] Installing Subversion

SSH to the router.

Execute the following commands to install svn from optware:

ipkg-opt update
ipkg-opt install svn

Wait some time and you'll see messages saying the svn package has been installed successfully.

[edit] Configuring Subversion

[edit] Prepare Repository Directories

The commands below will create subversion repo directories on /mnt/subversion/repos

mkdir /mnt/subversion/repos
svnadmin create /mnt/subversion/repos
ls /mnt/subversion/repos

You'll see something like

README.txt  conf        db          format      hooks       locks

[edit] Configuring Users and Permissions

Edit /mnt/subversion/repos/conf/svnserve.conf with the following:

[general]
anon-access = none
auth-access = write
password-db = passwd
authz-db = authz    
realm = My Subversion

Edit /mnt/subversion/repos/conf/passwd (consult SVN configuration documentations for more sophisticated settings, this is for demonstration purpose only!)

[users]
silentfish = secret

Edit /mnt/subversion/repos/conf/authz (consult SVN configuration documentations for more sophisticated settings, this is for demonstration purpose only!)

[groups]
admins = silentfish

[/]
@admins = rw
* =

[edit] Edit Startup script to start SVN daemon

Open browser to visit the DDWRT Web Interface, go to tab "Administration" -> "Commands".

  • If you already have startup commands, then click "Edit" button under "Starup" section, then add the following line to "Commands" text area, click "Save Startup" button.
  • Otherwise, add the following line to "Commands" text area, click "Save Startup" button.
/opt/bin/svnserve -d -r /mnt/subversion/repos

[edit] Edit Firewall script to open SVN ports externally

Open browser to visit the DDWRT Web Interface, go to tab "Administration" -> "Commands".

  • If you already have firewall commands, then click "Edit" button under "Firewall" section, then add the following line to "Commands" text area, click "Save Firewall" button.
  • Otherwise, add the following line to "Commands" text area, click "Save Firewall" button.
iptables -I INPUT -p tcp --dport 3690 -j ACCEPT
iptables -I INPUT -p udp --dport 3690 -j ACCEPT

[edit] Last Step

Congratulations, your subversion server is ready! Just reboot the router and use your favoriate SVN client to access your SVN server, with URL "svn://your-ip-or-domain".