How to install subversion server

26,046

Solution 1

There are many configurations for svn, here a some short instructions to get a basic svn repository available over http.

  1. Install required packages: apt-get install subversion apache2 libapache2-svn
  2. Create an Directory-Structure: mkdir -p /var/svn/repos/
  3. Create a Repository:
    • cd /var/svn/repos/
    • svnadmin create --fs-type fsfs <your-repository>
  4. Now Create your Project-Struckture to import in the repository:
    • mkdir -p /tmp/myproject/trunk /tmp/myproject/tags /tmp/myproject/branches
  5. Import the Project to the Repository:
    • svn import /tmp/myproject file:///var/svn/repos/<your-repository> -m "initial import"
  6. Make it accesseable over http:
    • cd /etc/apache2/sites-available
    • touch subversion.conf
    • vim subversion.conf

Now edit the empty file with this configuration:

NameVirtualHost *:80

<VirtualHost *:80>   
  <Location /svn>
      ErrorDocument 404 default
      DAV svn
      SVNParentPath /var/svn/repos
      SVNListParentPath off
      Require valid-user
      AuthType Basic
      AuthName "subversion access"
      AuthUserFile /var/svn/.htpasswd
      AuthzSVNAccessFile /var/svn/authz 
  </Location>
</VirtualHost>
  • enable dav_svn module for apache: a2enmod dav_svn
  • enable authz_svn module for apache: a2enmod authz_svn
  • enable VHost configuration: a2ensite subversion.conf
  • now restart the webserver: /etc/init.d/apache2 restart
  • Create an htpasswd: htpasswd -c /var/svn/.htpasswd user
  • Create the access control file for the repository: touch /var/svn/authz
  • edit the empty authz file: vim /var/svn/authz
  • Give read/write rights to for user:

[your-repository:/]

user = rw

Let's try to checkout the the repo over http: svn checkout http://your-server/svn/your-repository

Solution 2

Start reading the manual. I am currently doing the same.

Once you have set up a repository with svnadmin create /path/to/repo, you can use svnserve --root /path/to/repo to make the repository available at svn://yourhost/. Open TCP port 3690 if necessary.

It's possible to use SVN over HTTP, but I have not read that part yet :o

Solution 3

You will need the subversion package.

sudo apt-get update
sudo apt-get install subversion

This package contains the client, tools to crate a Subversion repository and the server.

Share:
26,046

Related videos on Youtube

Benjamin
Author by

Benjamin

직장인들을 위한 소개팅 서비스 커피한잔을 개발, 운영하고 있습니다.

Updated on September 17, 2022

Comments

  • Benjamin
    Benjamin over 1 year

    I'd like to install a Subversion server on my Ubuntu machine.
    What packages to I need? How do I create a repository and set a new user?

    • somasekhar
      somasekhar almost 12 years
      Depending on your needs, you might be better of with a distributed SCM like Bazaar (bzr), which is easy to learn coming from Subversion, but that does not need a server running. This is great if you are working alone and just need some log and safety net. And I just have to mention git, which is the most powerful tool out there, imho.
    • AMIC MING
      AMIC MING over 10 years
      sudo apt-get install subversion
  • Kris Harper
    Kris Harper over 12 years
    Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference.
  • nanofarad
    nanofarad almost 12 years
    I can't do the edit as the changes are too small, but could you fix the last line to say checkout as opposed to ceckout?
  • Madhusudhan
    Madhusudhan over 11 years
    i can not find this package libapache2-svn. Error: #Reading state information... Done E: Unable to locate package libapache2-svn System: ubuntu 12.04 32bit (all repositories are enable)
  • mrswadge
    mrswadge about 11 years
    You also need to enable the authz_svn module, otherwise you will get Invalid command 'AuthzSVNAccessFile', perhaps misspelled or defined by a module not included in the server configuration. You can use the command a2enmod authz_svn to do this.