SVN Bitnami

Steps to install SVN in a VM:

1. Download the VM on the web: https://bitnami.com/stack/subversion/virtual-machine

2. Configuration to star the VM with virtualbox: https://bitnami.com/stack/subversion/README.txt

3. Change keyboard configuration:

# dpkg-reconfigure keyboard-configuration

Reboot the system.

4. Enable sshd for Ubuntu:

# mv /etc/init/ssh.conf.back /etc/init/ssh.conf

# start ssh

5. Create Empty SVN (Subversion) repository with user and group svnsubversion, for example in /opt/bitnami/SVN.

Then load a repository called reponame (or create a new one). Load a repository:

# mkdir /opt/bitnami/SVN

# chown subversion:subversion /opt/bitnami/SVN

# mkdir /opt/bitnami/SVN/reponame

# svnadmin create /opt/bitnami/SVN/reponame

# svnadmin load /opt/bitnami/SVN/reponame < reponame.dump

# chown subversion:subversion /opt/bitnami/SVN/reponame

 Or create a new one:

$ rm -rf /tmp/reponame

$ mkdir -p /tmp/reponame/release

$ mkdir -p /tmp/reponame/branch

$ mkdir -p /tmp/reponame/trunk

$ svn import -m "reponame repository creation" /tmp/reponame  file://opt/bitnami/SVN/reponame

$ rm -rf /tmp/reponame

6. Change the script: /opt/bitnami/subversion/scripts/ctl.sh:

#!/bin/sh

SVN_PIDFILE=/opt/bitnami/subversion/tmp/svnserve.pid

SVN_START="/opt/bitnami/subversion/bin/svnserve -d -r /opt/bitnami/SVN --listen-port=3690 --pid-file=$SVN_PIDFILE"

....

7. Edit the file in /opt/bitnami/SVNreponame/conf/svnserve.conf. The variables anon-access and auth-access can be set to the values none, read, or write. Setting the value to none prohibits both reading and writing; read allows read-only access to the repository, and write allows complete read/write access to the repository.

For example, you can uncomment these lines:

[general]

anon-access = read

auth-access = write

...

password-db = passwd

...

authz-db = authz

You have to edit /opt/bitnami/SVN/reponame/conf/passwd file at the same folder to manage subversion users. For example, if you uncomment these lines you create two subversion users; harry and sally:

[users]

harry = harryssecret

sally = sallyssecret

You have to edit /opt/bitnami/SVN/reponame/conf/authz file at the same folder to manage access permissions:

[groups]

# harry_and_sally = harry,sally

# harry_sally_and_joe = harry,sally,&joe developers = username


# [/foo/bar]

# harry = rw

# &joe = r

# * =


# [repository:/baz/fuz]

# @harry_and_sally = rw

# * = r


# [reponame:/] @developers = rw

# * = r

It is necessary to restart svnserve to apply the changes.

OPTIONS:

1. Active the Subversion repository from the web browser. Change the Apache configuration file /opt/bitnami/apache2/conf/httpd.conf:

...

LoadModule dav_module modules/mod_dav.so

LoadModule dav_fs_module modules/mod_dav_fs.so

..

LoadModule dav_svn_module     modules/mod_dav_svn.so                                                 

LoadModule authz_svn_module   modules/mod_authz_svn.so

...

<Location /example_repository>                                  

  DAV svn                                                                         

  SVNPath "/opt/bitnami/SVN/example_repository"                                         

</Location>

LoadModule dav_module modules/mod_dav.so

LoadModule dav_fs_module modules/mod_dav_fs.so

..

LoadModule dav_svn_module     modules/mod_dav_svn.so                                                 

LoadModule authz_svn_module   modules/mod_authz_svn.so

...

<Location /example_repository>                                  

  DAV svn                                                                         

  SVNPath "/opt/bitnami/SVN/example_repository"                                         

</Location>

Then restart Apache:

# /opt/bitnami/ctlscript.sh restart apache

2. Configure basic authentication for your repository:

Once you are able to access your repository, it is possible to configure Apache basic authentication for different users. The configuration below allows you create a/opt/bitnami/SVN/users.passwd file with the user credentials for the repository:

<Location />

    DAV svn

    #SVNPath "/opt/bitnami/reponame"

    SVNParentPath "/opt/bitnami/SVN"

    SVNListParentPath On

    AuthType Basic

    AuthName "SVNSubversion"

    AuthUserFile /opt/bitnami/SVN/users.passwd

    AuthzSVNAccessFile /var/SVN/svn.authz

    Require valid-user

</Location>

In order to create this file, you can run the following command:

# htpasswd -c  /opt/bitnami/SVN/users.passwd newuser

  New password:

If you want to add more users to the same file, you can remove the "-c" option to not overwrite the file and only append new users:

# htpasswd /opt/bitnami/SVN/users.passwd otheruser

New password:

Then restart the Apache server.

NOTE: If you don't need svn:// protocol you can comment all variables in the step 7.

3. Enabling HTTPS:

You can also access through HTTPS if you already configured the Apache SSL certificate for your server. The following error can happen when the hostname reported by the server does not the match hostname given in the SSL certificate. Make sure your server configuration uses correct value for ServerName.

svn: OPTIONS of 'https://example.com/repository': SSL negotiation failed: SSL error code -1/1/336032856 (https://example.com)