Thursday, February 12, 2009

Ubuntu SVN/Subversion Server

I use Subversion/SVN all the time to keep track of the project as we build them. Here are some notes on how to make your own SVN server so that you can do the same.

First you might want to check and see if the SVN software has been installed using the command
which svn

If it comes back with a path then it has been correctly installed if not then run this command to install the latest version
sudo apt-get install subversion

Now that the software has been we need to create the service in the init.d folder
cd /etc/init.d/

Add the subversion SYSTEM user to the machine
useradd --system subversion

Add the repositories folder to the system. Some people say make a folder in the home directory, I like to put it into the /var directory
mkdir /var/repositories

Now we need to create the service file
nano svnserve

Paste the below text into the editor and then save it.
#!/bin/sh -e
# svnserve - brings up the svn server so anonymous users
# can access svn

# Get LSB functions
. /lib/lsb/init-functions
. /etc/default/rcS


# Check that the package is still installed
[ -x $SVNSERVE ] || exit 0;

case "$1" in
        log_begin_msg "Starting svnserve..."
        umask 002
        if start-stop-daemon --start \
        --chuid $SVN_USER:$SVN_GROUP \
        --exec $SVNSERVE \
        -- -d -r $SVN_REPO_PATH; then
            log_end_msg 0
            log_end_msg $?

        log_begin_msg "Stopping svnserve..."
        if start-stop-daemon --stop --exec $SVNSERVE; then
        log_end_msg 0
        log_end_msg $?

        "$0" stop && "$0" start

    e    cho "Usage: /etc/init.d/svnserve {start|stop|restart|force-reload}"
        exit 1

exit 0

Now set the permissions on the file you just created.
sudo chmod +x svnserve

Now you can try and start the service
sudo /etc/init.d/svnserve start

Make it start when rebooting
update-rc.d svnserve defaults

No comments:

Post a Comment

Raspberry Pi Zero W - Wireless Configuation

create the file under "boot" folder wpa_supplicant.conf country=GB ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev u...