Skip to content
December 13, 2016 / lasseathome

Installing an SVN server on an ASUS Router

I want to have a low power device that can always be connected and  accessible from anywhere on the internet, so I can work, version control and store my software projects while being home or traveling. The most convenient solution I have found for my needs is to use the router that I have as firewall with a USB disk attached to it, and put an SVN server on it. This collects my procedure and commands used for installing an SVN server on my ASUS RT-AC88N router, the router is sufficiently powerful for serving as a server and with the attached USB disk it has enough storage for the SVN data and other things. The most important thing for me is later how I can configure the system so that it allows multiple users with access rights to different repositories.

Pre-requisites for the installation

The things I have is the ASUS router and an external USB 3.0 disk that will go as NAS and storage space for the SVN server, the prerequisites I have is to install Asuswrt-Merlin which is a custom firmware for ASUS routers that is Linux-hacking friendly then add the modern optware software called Entware and its latest version called Entware-ng. The preparatory steps for my installation are:

  1. Change the default username from admin to something else to increase security.
  2. Install the Asuswrt-Merlin, it is as easy as download the binary and upload it to the router.
  3. Format the USB disk to EXT4 I did it on a separate Linux machine named it NAS and connect it to the router. A USB 3.0 disk in the USB 3.0 port does not work on the ASUS router due to the fact that an old kernel ( with a known kernel bug for high speed USB) is used on the router (it is corrected in 2.6.37-rc5 and later) according to ubuntu forums. To get my disk working I have to connect the USB 3.0 disk to the USB 2.0 port. It is possible to connect a USB 2.0 device to the USB 3.0 port since it does not excite the bug, I am waiting for a new kernel to be compiled and available so that I can enjoy high speed USB (even though 2.0 is enough for my needs right now).
  4. Enable ssh-login and JFFS scripts in the Asuswrt-Merlin web interface menu Administration-System.
  5. Login to the router with ssh and check that the drive is correctly mounted at /tmp/mnt/NAS/.
  6. Then run the Entware installation script that is included in the Merlin distribution. This installs currently installs the newer Entware-ng.
  7. Now I can start working with the entware system and start to install my favourite Unix tools, by using the Entware package manager opkg.
    opkg install gzip bzip2 nano rsync tar
  8. This finishes the prerequisites for me. Next up is to install and configure my subversion server.

Installation of Subversion

I only need to have access to the SVN repository through the svn:// and ssh+svn:// protocols. The steps are basically to install the svn-server and ssh and open the ports on the router:

  1. Install svn server from Entware:
    opkg install subversion-server
  2. Make a repository file on the NAS disk
     cd /tmp/mnt/NAS; mkdir svn; cd svn; mkdir theProject;
  3. Create the repository and edit the svn configuration file
    svnadmin create /tmp/mnt/NAS/svn/theProject
    cd theProject/conf
    nano svnserve.conf
  4. In here we disable the anonymous access and set a link to the password file
    anon-access = none
    password-db = passed
  5. Then we edit the password file  with nano passwd.
    username1 = password1
    username2 = password2
  6. Then it is time to start the svnserver option -d to demonize and -r for repository.
    svnserve -d -r /tmp/mnt/NAS/svn/theProject

    This command is put into the /jffs/scripts/post-mount so that it is executed at startup or post mounting of the USB disk.

  7. Finally we need to open the svnserve port on the firewall.
    iptables -I INPUT -p tcp --dport 3690 -j ACCEPT

    This is also put in the /jffs/scripts/post-mount file so that it is executed when the disk is ready.

  8. Now it should be up and running, and we can list the contents by:
    svn list svn://addressToRouter/theProject/

This finishes the SVN installation on the ASUS router. The ssh+svn access is not yet tried


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: