10
How To Install and Configure SVN on Ubuntu Contents Overview ....................................................................................................................................................... 1 Applies To:................................................................................................................................................. 1 Pre-Requisites ............................................................................................................................................... 1 Update OS Patches.................................................................................................................................... 1 Install Apache2 .......................................................................................................................................... 2 Install Ubuntu Firewall .............................................................................................................................. 2 Create User and Group (Apache) .............................................................................................................. 2 Install SVN and Dependent Packages ........................................................................................................... 3 Create subversion Root Directory............................................................................................................. 3 Create SVN Repository .............................................................................................................................. 4 Change Ownership SVN Repositories ....................................................................................................... 4 Add User(s) to SVN Group......................................................................................................................... 4 Configure SVN in Apache2 Web Access .................................................................................................... 5 Enable and configure WebDAV and SVN .................................................................................................. 5 Reconfigure WebSVN ............................................................................................................................ 6 Add SVN Repository Users .................................................................................................................... 7 Listing Created Users for SVN Access.................................................................................................... 7 Access SVN Repository via Web ................................................................................................................ 8 WebDAV Configuration Tags and Purpose ................................................................................................... 9 Define SVN Web Alias Name ................................................................................................................. 9 Enable Apache Module DAV for SVN .................................................................................................... 9 Set SVNParentPath................................................................................................................................ 9 Listing SVN Repositories........................................................................................................................ 9 Enabling Anonymous Login ................................................................................................................... 9 Authentication Settings ........................................................................................................................ 9

Install and Configure SVN Server (Subversion)

Embed Size (px)

Citation preview

How To Install and Configure SVN on Ubuntu

Contents

Overview ....................................................................................................................................................... 1

Applies To: ................................................................................................................................................. 1

Pre-Requisites ............................................................................................................................................... 1

Update OS Patches .................................................................................................................................... 1

Install Apache2 .......................................................................................................................................... 2

Install Ubuntu Firewall .............................................................................................................................. 2

Create User and Group (Apache) .............................................................................................................. 2

Install SVN and Dependent Packages ........................................................................................................... 3

Create subversion Root Directory ............................................................................................................. 3

Create SVN Repository .............................................................................................................................. 4

Change Ownership SVN Repositories ....................................................................................................... 4

Add User(s) to SVN Group ......................................................................................................................... 4

Configure SVN in Apache2 Web Access .................................................................................................... 5

Enable and configure WebDAV and SVN .................................................................................................. 5

Reconfigure WebSVN ............................................................................................................................ 6

Add SVN Repository Users .................................................................................................................... 7

Listing Created Users for SVN Access .................................................................................................... 7

Access SVN Repository via Web ................................................................................................................ 8

WebDAV Configuration Tags and Purpose ................................................................................................... 9

Define SVN Web Alias Name ................................................................................................................. 9

Enable Apache Module DAV for SVN .................................................................................................... 9

Set SVNParentPath ................................................................................................................................ 9

Listing SVN Repositories........................................................................................................................ 9

Enabling Anonymous Login ................................................................................................................... 9

Authentication Settings ........................................................................................................................ 9

How To Install and Configure SVN on Ubuntu

1 | P a g e

Overview

This guide will help in installing and configuration subversion on Ubuntu 12.04 operating system, subversion is a source code version management tool. It is an open source. This document focus on web support of SVN.

Applies To:

To know the version of the Operating system execute the command;

lsb_release -a

Pre-Requisites

Update OS System Patches

Apache2 Web Server, if you would like to browse for SVN repository from webpage (browser)

Update OS Patches

First and foremost thing, which needs to be done is to update Operating System patches, run the command;

sudo apt-get update

How To Install and Configure SVN on Ubuntu

2 | P a g e

Install Apache2

sudo apt-get -y install apache2

For detailed steps, refer to Apache2 Installation and configuration document, which is a required package for websvn support.

Install Ubuntu Firewall

sudo apt-get -y install ufw

For detailed steps, refer to Ubuntu firewall Installation and configuration document, which is a required package for configuring Ubuntu Firewall, for svn access over web; open port 80 on the firewall.

Create User and Group (Apache)

Though www-data user and group will be created by default, if the user doesn’t exists, you should create it manually.

sudo groupadd www-data

sudo useradd www-data -G www-data

How To Install and Configure SVN on Ubuntu

3 | P a g e

sudo chown -R www-data:www-data /var/lib/svn

sudo chmod -R g+rw /var/lib/svn

Note:

www-data Web Server User

www-data Web Server Group

Install SVN and Dependent Packages

Install the packages that are required for SVN, in order to install SVN with web access, install package “websvn”.

sudo apt-get install subversion subversion-tools libapache2-svn websvn eximon4 exim4-doc-html exim4-doc-info spf-tools-perl swaks gettext-doc php-pear db4.8-util libwww-perl perl-doc libterm-readline-gnu-perl libterm-readline-perl-perl libpod-plainer-perl php5-suhosin libmail-box-perl python-subversion-dbg libsvn-ruby1.8

Create subversion Root Directory

SVN Repository requires a directory to store the repository files, hence we have to create the directory accordingly. To create the directory execute command

mkdir -p /var/lib/svn or your customized directories

Note: Default directory for SVN repository is “/var/lib/svn” which is also defined in dav_svn.conf of “Apache Modules” folder; it should be customized according to your requirements.

How To Install and Configure SVN on Ubuntu

4 | P a g e

Create SVN Repository

svnadmin is the administrative tool for monitoring and repairing your Subversion repository. Though, it will not create intermediate directories.

To create SVN repository utilize the command “svnadmin create”; as an example

sudo svnadmin create /var/lib/svn/YourSVNTestRepository1

sudo svnadmin create /var/lib/svn/YourSVNTestRepository2

sudo svnadmin create /var/lib/svn/YourSVNTestRepository3

Change Ownership SVN Repositories

Modify owner of SVN repository to “www-data” user and group membership.

sudo chown -R www-data:www-data /var/lib/svn/YourSVNTestRepository1

sudo chown -R www-data:www-data /var/lib/svn/YourSVNTestRepository2

sudo chown -R www-data:www-data /var/lib/svn/YourSVNTestRepository3

Add User(s) to SVN Group

sudo useradd vcp.muthukrishna -G www-data

sudo useradd testing.user1 -G www-data

How To Install and Configure SVN on Ubuntu

5 | P a g e

sudo useradd testing.user2 -G www-data

Configure SVN in Apache2 Web Access

sudo vi /etc/apache2/mods-enabled/dav_svn.conf

Enable and configure WebDAV and SVN

To enable WebDAV for web access, append the contents at the end of the file

sudo vi /etc/apache2/mods-available/dav_svn.conf

<Location /svn>

DAV svn

SVNParentPath /var/lib/svn

SVNListParentPath on

AuthType Basic

AuthName "Access Subversion Repository"

AuthUserFile /etc/apache2/dav_svn.passwd

Require valid-user

</Location>

How To Install and Configure SVN on Ubuntu

6 | P a g e

Reconfigure WebSVN

dpkg -reconfigure websvn

How To Install and Configure SVN on Ubuntu

7 | P a g e

Add SVN Repository Users

Create and modify password file “-c” create new password file; “-m” use md5 encryption method for users passwords.

sudo htpasswd -cm /etc/apache2/dav_svn.passwd <New SVN Username>

Listing Created Users for SVN Access

cat /etc/apache2/dav_svn.passwd

How To Install and Configure SVN on Ubuntu

8 | P a g e

Access SVN Repository via Web

http://localhost/svn/

http://<SVN Server FQDN>/svn/

http://<SVN Server IP Address>/svn/

How To Install and Configure SVN on Ubuntu

9 | P a g e

WebDAV Configuration Tags and Purpose

Define SVN Web Alias Name

Location entry defines web url alias name; example http://localhost/svn

<Location /svn>

Enable Apache Module DAV for SVN

Enable DAV module for svn path

DAV svn

Set SVNParentPath

SVNParentPath is SVN Repository directory where all the files are stored, uncomment it to enable it and create the directory accordingly.

SVNParentPath /var/lib/svn sudo mkdir -p /var/lib/svn

Listing SVN Repositories

To List SVN repositories, append SVNListParentPath with on; setting this option to “off” will disable listing of repositories.

SVNListParentPath on

Enabling Anonymous Login

To enable anonymous login, uncomment or add these 3 lines.

<LimitExpect GET PROPFIND OPTIONS REPORT> Require valid-user

</LimitExpect>

Authentication Settings

AuthType Basic

AuthName "Access Subversion Repository"

AuthUserFile /etc/apache2/dav_svn.passwd