Install Subversion and Websvn on Ubuntu 16.04

admin/ October 31, 2016/ Linux/ 9 comments

Install Subversion Server on Ubuntu Machine.

Why Subversion ?
Apache Subversion is a full-featured version control system originally designed to be a better CVS. Subversion has since expanded beyond its original goal of replacing CVS, but its basic model, design, and interface remain heavily influenced by that goal. Even today, Subversion should still feel very familiar to CVS users.

There are few steps below-:

Step 1-:
Install required packages.

$ sudo apt-get update
$ sudo apt-get install apache2 subversion libapache2-svn php7.0 libsvn-dev zip wget php-xml
$ sudo a2enmod dav
$ sudo a2enmod dav_svn
$ sudo service apache2 restart

Step 2-:

Download websvn zip or tar.gz from http://www.websvn.info/download/.

$ cd /var/www/html/
$ wget -qO- -O tmp.zip http://websvn.tigris.org/files/documents/1380/49057/websvn-2.3.3.zip && unzip tmp.zip && rm tmp.zip && mv websvn-* websvn
$ chown -R www-data:www-data /var/www/html/websvn/

Check Websvn on http://localhost/websvn or http://domain or ip/websvn/

Step 3-:

Create the Subversion Environment.

$ sudo mkdir -p /var/lib/svn/FirstRepo
$ sudo svnadmin create --fs-type fsfs /var/lib/svn/FirstRepo
$ sudo chmod -R 775 /var/lib/svn

Add User admin for repository authentication.

$ sudo htpasswd -c /etc/global.htpasswd admin

Step 4-:

Open the dav_svn.conf file.

$ sudo nano /etc/apache2/mods-enabled/dav_svn.conf

Add the below content bottom of the file.

<Location /svn>
DAV svn
SVNParentPath /var/lib/svn
</Location>
 $ sudo service apache2 reload

Copy config.php in the include directory

 $ sudo cp /var/www/html/websvn/include/distconfig.php /var/www/html/websvn/include/config.php

add the below line for the websvn at /var/www/html/websvn/include/config.php.

$config->parentPath("/var/lib/svn");
$config->addRepository("FirstRepo", "file:///var/lib/svn/FirstRepo");

Step 5-:

Test the Subversion Server.
Checkout the FirstRepo

svn co http://127.0.0.1/svn/FirstRepo

Output-:

Authentication realm: <http://127.0.0.1:80> FirstRepo Subversion Repository
Password for 'root': 

Authentication realm: <http://127.0.0.1:80> FirstRepo Subversion Repository
Username: admin
Password for 'admin': *********


-----------------------------------------------------------------------
ATTENTION!  Your password for authentication realm:

   <http://127.0.0.1:80> FirstRepo Subversion Repository

can only be stored to disk unencrypted!  You are advised to configure
your system so that Subversion can store passwords encrypted, if
possible.  See the documentation for details.

You can avoid future appearances of this warning by setting the value
of the 'store-plaintext-passwords' option to either 'yes' or 'no' in
'/root/.subversion/servers'.
-----------------------------------------------------------------------
Store password unencrypted (yes/no)? no
Checked out revision 0.

Additional Part of this Article.

If you want to create SVN Repository using script. Create a file like create_svn.sh

 $ nano create_svn.sh

Copy all the below content into this file.

 #!/bin/bash
PositionalParamExists="$1"
if [ -z "${PositionalParamExists}" ]; then
 echo "Please enter proper Repository Name"
 exit;
fi
svnadmin create /var/lib/svn/$1
chmod -R 775 /var/lib/svn/$1
chown -R www-data:www-data /var/lib/svn/$1
echo "<Location /svn/$1>
 AuthType Basic
 AuthName \"$1 Subversion Repository\"
 AuthUserFile /etc/global.htpasswd
 Require user admin 
</Location>" >> /etc/apache2/mods-enabled/dav_svn.conf
nano /etc/apache2/mods-enabled/dav_svn.conf
/etc/init.d/apache2 reload

Save the file.

$ sudo chmod +x create_svn.sh
Run the script.
$ sudo sh create.sh

or

$ sudo ./create_svn.sh

Gotechnies Websvn Blog

2016-05-20
Rating: 5.0
Votes: 400
Reviews: 330

9 Comments

  1. This guide doesn’t work.

    For example, this file doesn’t exists: /etc/websvn/svn_deb_conf.inc

    1. Hi Peeter,

      Have you installed
      1. libapache2-svn
      $ sudo apt-get install libapache2-svn
      Enable dav_svn module of apache.
      2. $ sudo a2enmod dav_svn

      After that you will fine /etc/websvn/svn_deb_conf.inc.

      Thanks for the reply

      1. Hi ADMIN,

        I too have encountered this problem.

        The steps have been followed exactly (and rechecked), but the /etc/websvn/ directory isn’t being created.

        Is there anything else to check?

        Regards

        Antony

        1. Hi Antony,

          I am sorry. I have update the blog post again. Please check it.

          You can edit file using below command-:

          $ sudo nano /var/www/html/websvn/svn_deb_conf.inc

      2. I’m getting `Unable to locate package libapache2-svn` error. What else is needed?

          1. Hello

            Thanks for the reply, but that didn’t help. I’m getting:

            Ign:13 http://ppa.launchpad.net/dominik-stadler/subversion-1.7/ubuntu artful/main all Contents (deb)
            Ign:14 http://ppa.launchpad.net/dominik-stadler/subversion-1.7/ubuntu artful/main i386 Contents (deb)
            Ign:15 http://ppa.launchpad.net/dominik-stadler/subversion-1.7/ubuntu artful i386 Contents (deb)
            Ign:16 http://ppa.launchpad.net/dominik-stadler/subversion-1.7/ubuntu artful all Contents (deb)
            Ign:17 http://ppa.launchpad.net/svn/ppa/ubuntu artful/main all Packages
            Ign:18 http://ppa.launchpad.net/svn/ppa/ubuntu artful/main i386 Packages
            Ign:19 http://ppa.launchpad.net/svn/ppa/ubuntu artful/main Translation-en
            Ign:20 http://ppa.launchpad.net/svn/ppa/ubuntu artful/main Translation-en_US
            Ign:21 http://ppa.launchpad.net/svn/ppa/ubuntu artful/main i386 Contents (deb)
            Ign:22 http://ppa.launchpad.net/svn/ppa/ubuntu artful/main all Contents (deb)
            Ign:23 http://ppa.launchpad.net/svn/ppa/ubuntu artful i386 Contents (deb)
            Ign:24 http://ppa.launchpad.net/svn/ppa/ubuntu artful all Contents (deb)
            Ign:9 http://ppa.launchpad.net/dominik-stadler/subversion-1.7/ubuntu artful/main all Packages
            Ign:10 http://ppa.launchpad.net/dominik-stadler/subversion-1.7/ubuntu artful/main i386 Packages
            Ign:11 http://ppa.launchpad.net/dominik-stadler/subversion-1.7/ubuntu artful/main Translation-en
            Ign:12 http://ppa.launchpad.net/dominik-stadler/subversion-1.7/ubuntu artful/main Translation-en_US
            Ign:13 http://ppa.launchpad.net/dominik-stadler/subversion-1.7/ubuntu artful/main all Contents (deb)
            Ign:14 http://ppa.launchpad.net/dominik-stadler/subversion-1.7/ubuntu artful/main i386 Contents (deb)
            Ign:15 http://ppa.launchpad.net/dominik-stadler/subversion-1.7/ubuntu artful i386 Contents (deb)
            Ign:16 http://ppa.launchpad.net/dominik-stadler/subversion-1.7/ubuntu artful all Contents (deb)
            Ign:17 http://ppa.launchpad.net/svn/ppa/ubuntu artful/main all Packages
            Ign:18 http://ppa.launchpad.net/svn/ppa/ubuntu artful/main i386 Packages
            Ign:19 http://ppa.launchpad.net/svn/ppa/ubuntu artful/main Translation-en
            Ign:20 http://ppa.launchpad.net/svn/ppa/ubuntu artful/main Translation-en_US
            Ign:21 http://ppa.launchpad.net/svn/ppa/ubuntu artful/main i386 Contents (deb)
            Ign:22 http://ppa.launchpad.net/svn/ppa/ubuntu artful/main all Contents (deb)
            Ign:23 http://ppa.launchpad.net/svn/ppa/ubuntu artful i386 Contents (deb)
            Ign:24 http://ppa.launchpad.net/svn/ppa/ubuntu artful all Contents (deb)
            Ign:9 http://ppa.launchpad.net/dominik-stadler/subversion-1.7/ubuntu artful/main all Packages
            Err:10 http://ppa.launchpad.net/dominik-stadler/subversion-1.7/ubuntu artful/main i386 Packages
            404 Not Found
            Ign:11 http://ppa.launchpad.net/dominik-stadler/subversion-1.7/ubuntu artful/main Translation-en
            Ign:12 http://ppa.launchpad.net/dominik-stadler/subversion-1.7/ubuntu artful/main Translation-en_US
            Ign:13 http://ppa.launchpad.net/dominik-stadler/subversion-1.7/ubuntu artful/main all Contents (deb)
            Ign:14 http://ppa.launchpad.net/dominik-stadler/subversion-1.7/ubuntu artful/main i386 Contents (deb)
            Ign:15 http://ppa.launchpad.net/dominik-stadler/subversion-1.7/ubuntu artful i386 Contents (deb)
            Ign:16 http://ppa.launchpad.net/dominik-stadler/subversion-1.7/ubuntu artful all Contents (deb)
            Ign:17 http://ppa.launchpad.net/svn/ppa/ubuntu artful/main all Packages
            Err:18 http://ppa.launchpad.net/svn/ppa/ubuntu artful/main i386 Packages
            404 Not Found
            Ign:19 http://ppa.launchpad.net/svn/ppa/ubuntu artful/main Translation-en
            Ign:20 http://ppa.launchpad.net/svn/ppa/ubuntu artful/main Translation-en_US
            Ign:21 http://ppa.launchpad.net/svn/ppa/ubuntu artful/main i386 Contents (deb)
            Ign:22 http://ppa.launchpad.net/svn/ppa/ubuntu artful/main all Contents (deb)
            Ign:23 http://ppa.launchpad.net/svn/ppa/ubuntu artful i386 Contents (deb)
            Ign:24 http://ppa.launchpad.net/svn/ppa/ubuntu artful all Contents (deb)
            Reading package lists… Done
            W: The repository ‘http://ppa.launchpad.net/dominik-stadler/subversion-1.7/ubuntu artful Release’ does not have a Release file.
            N: Data from such a repository can’t be authenticated and is therefore potentially dangerous to use.
            N: See apt-secure(8) manpage for repository creation and user configuration details.
            W: The repository ‘http://ppa.launchpad.net/svn/ppa/ubuntu artful Release’ does not have a Release file.
            N: Data from such a repository can’t be authenticated and is therefore potentially dangerous to use.
            N: See apt-secure(8) manpage for repository creation and user configuration details.
            E: Failed to fetch http://ppa.launchpad.net/dominik-stadler/subversion-1.7/ubuntu/dists/artful/main/binary-i386/Packages 404 Not Found
            E: Failed to fetch http://ppa.launchpad.net/svn/ppa/ubuntu/dists/artful/main/binary-i386/Packages 404 Not Found
            E: Some index files failed to download. They have been ignored, or old ones used instead.

  2. Pingback: alhambra collana oro rosa imitazione

Leave a Reply