Monday 26 January 2015

Install Subversion server with web access on Ubuntu 14.04

http://www.krizna.com/ubuntu/setup-svn-server-on-ubuntu-14-04/

1. Create a VMBox based on ubuntu14.04 image trusty64 on the real server
$ vagrant init trusty64  
$ nano VagrantFile   // enable a public_network and change memory 1024
$ vagrant up
$ vagrant ssh   // change the hostname, change to static ip and nameserver
$ sudo nano /etc/network/interface
auto eth1
inet iface eth1 static
address x.x.x.70
netmask 255.255.255.0
network x.x.x.0
gateway x.x.x.1
$ sudo nano /etc/resolvconf/resolve.conf/tail
nameserver x.x.0.252

2. update and install necessary packages
$ sudo apt-get update

// install SVN and apache webserver (To access SVN through http ) 
$ sudo apt-get install subversion apache2 libapache2-svn apache2-utils

3. setup the svn configuration

// create a directory and create a new repository in that directory
$ sudo mkdir -p /svn/repos/
$ sudo svnadmin create /svn/repos/testrepo

// change ownership for the repository.
$ sudo chown -R www-data:www-data /svn/repos/testrepo

// Create a file testrepo.conf in /etc/apache2/sites-available/
// and add the below lines for creating apache virtual host.
$ sudo nano /etc/apache2/site-available/testrepo.conf

  DAV svn
  SVNParentPath /svn/repos/
  AuthType Basic
  AuthName "Test Repo"
  AuthUserFile /etc/svnpasswd
  Require valid-user


// enable the site and restart or reload apache service.
$ sudo a2ensite testrepo
$ sudo service apache2 reload

// create user for accessing repository and add the user details to /etc/svnpasswd file.
$ sudo htpasswd -cm /etc/svnpasswd user1

enter password for the user

// for other users
$ sudo htpasswd -cm /etc/svnpasswd user2

// access svn server through:
http://x.x.x.70/svn/testrepo

4. create sub-directoryon the repository
$ svn mkdir -m "Making a new dir." http://x.x.x.70/svn/testrepo/newdir

No comments:

Post a Comment