24.03.2015 Views

Unix Toolbox - 中文版 - LinuxTone.Org

Unix Toolbox - 中文版 - LinuxTone.Org

Unix Toolbox - 中文版 - LinuxTone.Org

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Using the local file system, it is now possible to import and then check out an existing project.<br />

Unlike with CVS it is not necessary to cd into the project directory, simply give the full path:<br />

# svn import /project1/ file:///home/svn/project1/trunk -m 'Initial import'<br />

# svn checkout file:///home/svn/project1<br />

The new directory "trunk" is only a convention, this is not required.<br />

Remote access with ssh<br />

No special setup is required to access the repository via ssh, simply replace file:// with<br />

svn+ssh/hostname. For example:<br />

# svn checkout svn+ssh://hostname/home/svn/project1<br />

As with the local file access, every user needs an ssh access to the server (with a local account)<br />

and also read/write access. This method might be suitable for a small group. All users could<br />

belong to a subversion group which owns the repository, for example:<br />

# groupadd subversion<br />

# groupmod -A user1 subversion<br />

# chown -R root:subversion /home/svn<br />

# chmod -R 770 /home/svn<br />

Remote access with http (apache)<br />

Remote access over http (https) is the only good solution for a larger user group. This method<br />

uses the apache authentication, not the local accounts. This is a typical but small apache<br />

configuration:<br />

LoadModule dav_module modules/mod_dav.so<br />

LoadModule dav_svn_module modules/mod_dav_svn.so<br />

LoadModule authz_svn_module modules/mod_authz_svn.so # Only for access control<br />

<br />

DAV svn<br />

# any "/svn/foo" URL will map to a repository /home/svn/foo<br />

SVNParentPath /home/svn<br />

AuthType Basic<br />

AuthName "Subversion repository"<br />

AuthzSVNAccessFile /etc/apache2/svn.acl<br />

AuthUserFile /etc/apache2/svn-passwd<br />

Require valid-user<br />

<br />

The apache server needs full access to the repository:<br />

# chown -R www:www /home/svn<br />

Create a user with htpasswd2:<br />

# htpasswd -c /etc/svn-passwd user1 # -c creates the file<br />

Access control svn.acl example<br />

# Default it read access. "* =" would be default no access<br />

[/]<br />

* = r<br />

[groups]<br />

project1-developers = joe, jack, jane<br />

# Give write access to the developers<br />

[project1:]<br />

@project1-developers = rw<br />

13.2 SVN commands and usage<br />

— SVN —<br />

See also the Subversion Quick Reference Card 36 . Tortoise SVN 37<br />

is a nice Windows interface.<br />

36

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!