# SVN Server

## Ward

I'm trying to install a svn server.

I've emerged subversion. But know I'm stuck. Googled for a bit, ty'd with apache but didn't work...

Anybody knows how to install subversion in order to connect with TortoiseSVN? What steps should I follow ?

Thanks

----------

## gustafson

As far as I know, if you have emerge subversion then you should have everything you need to run a server. 

(unless you specify use flags which prevent it, ie -apache2 -berkdb I think)

You might have to start apache, enable access to the repository, etc if you want to serve it via http.  

Otherwise, you should use one of the other protocols... I like to use sshd and svn+ssh://.  

(I don't use tortoisesvn, but according to the web page it should work).

Quoting the web page:

# All Subversion protocols are supported

    * http://

    * https://

    * svn://

    * svn+ssh://

    * file:///

    * svn+XXX://

----------

## Ward

I have a directory /var/svn --> with config

in this dir there is a conf and repos folder.

Now what I did is, I made a folder under /var/svn/ and try'd to connect with it by "svn://192.168.2.4/myfolder" but he sais "no repository found in  192.168.2.4/myfolder".

Does anybody knows how to fix it ?

----------

## WildCoder

 *Quote:*   

> 
> 
> I made a folder under /var/svn/ and try'd to connect with it by "svn://192.168.2.4/myfolder"
> 
> 

 

you can't just create a repository that way. you have to use svnadmin to create it for you

```

cd /var/svn

svnadmin create myfolder

```

Personally I preffer the DAV_FS (http/https) way to access the repository this way I don't need to create shell account for all my users. 

Great read to get you started: http://svnbook.red-bean.com/

-WildCoder

----------

## Ward

Ok it's created and how can I delete some repository ?

----------

## WildCoder

simply delete the directory with rm

svnadmin create creates the directory and a bunch of files in it for you. It doesn't store anything anywhere else that I know of.

-WildCoder

----------

## Ward

there are a bunch of maps. where can I put them ? 

But I think my repository isn't working proper I need user access to

----------

## Kosa

Maybe you should look here first: http://gentoo-wiki.com/Subversion It is nice tutorial about Subverversionon Gentoo.

I would personally recommend using Subversion with WebDAV - it can be easilly secured with HTTPS and granting permissions to repository is also a bit simplier - you can use every authentication module to Apache eg. mod_auth_mysql. Another HowTo is here: http://gentoo-wiki.com/HOWTO_Apache2_with_subversion_SVN_and_DAV

----------

## tgh

Here's my quick-n-dirty method for svn+ssh with Windows clients.  I've setup a dozen repositories on our SVN server in the last 3 weeks, so I have this stuff memorized.

1) Install subversion 1.4 (have to unmask it with ~amd64, and you'll probably need to add a "-java" flag in /etc/portage for that specific version)

2) Create a user account (useradd -m username)

3) Set a random password (passwd username), something really long and non-sensical.  We restrict the pub-keys that the users give us to only running the "svnserve -t" command, which keeps them away from the shell.

4) su as the username, go to ~/ and create the .ssh folder, chmod 700 ~/.ssh, cd ~/.ssh

5) Paste in or upload the user's pub key that they generated with PuTTY's keygen

6) ssh-keygen -i -f username.pub >> authorized_keys

7) chmod 600 ~/.ssh/*

8) edit the authorized_keys file, put the following on the front of their keyline: command="svnserve -t"

9) add the user to the appropriate groups

Now you can test TSVN or the window's command line client.  You should attempt to do a checkout against the base URL of a non-existent repository (svn+ssh://user@servername/nonexistingfolder) which should give you back a message that "repository does not exist".  Otherwise, you don't have your SSH+SVN setup properly on the server side.  Either the user didn't load their key into PAgent in Windows, or there's a problem with the public key on the server in the user's home folder.  If you get "connection closed" messages then you need to troubleshoot why PuTTY can't SSH to the server.

Setting up a new repository.  I currently create a new unix group for each repository and assign users to the group if they need read/write access.

1) cd /var/svn

2) mkdir foorepo

3) svnadmin create foorepo

4) chmod -R 770 foorepo

5) chmod -R g+s foorepo/db

6) chgrp -R svn-foorepo foorepo

(svn-foorepo is the group name that I created in /etc/group to hold the svn users)

The "770" chmod is a bit overkill for the repository permissions, but I don't recall what it was supposed to be.  

The checkout URL for this is: svn+ssh://user@servername/var/svn/repositoryname

The hard part (IMO) is getting SSH working.  Once you have SSH working, you can lock down the key by editing the ~/.ssh/authorized_keys file and putting the command="svnserve -t" restriction on the front of it.

----------

## hron

Hi!

I have a svn server with Apache DAV, but i want to use it over ssh.

But I have a some problem.

I have this folder /var/svn/repos

My svnserve config is:

```

# The commented variables in this file are the defaults that are used

# in the init-script.  You don't need to uncomment them except to

# customize them to different values.

# Options for svnserve

SVNSERVE_OPTS="--root=/var/svn"

# User and group as which to run svnserve

SVNSERVE_USER="apache"

SVNSERVE_GROUP="apache"

```

When I tried checkout some project, it says:

```

svn co svn+ssh://localhost/vmdk-gui

Password:

svn: No repository found in 'svn+ssh://localhost/repos/vmdk-gui'

```

But the project repo is exist because i can checkout it over http.

What is a problem? What's wrong?

Pls help me...

----------

## tgh

svn+ssh uses absolute paths (and pays no attention to svnserve.conf).  So if your repositories are stored under /var/svn/repos then your URL is:

svn+ssh://user@hostname/var/svn/repos/vmdk-gui

For local host access, you can use the file:// URL

file:///var/svn/repos/vmdk-gui

You'll need to carefully read the SVNBook for information about groups, sticky bits and setting the proper permissions on the db folder.  Otherwise you'll run into the issue that after one person checks things in, other users can't do check-ins due to permission issues.

svnserve.conf is only used if you run svnserve as a daemon (90% sure of that, or possibly with Apache?).  svn+ssh access requires shell access to the server where SVN runs the command "svnserve -t" which starts up an individual copy of svnserve in tunnel mode for the user that just authenticated.

----------

