简体   繁体   中英

Subversion Repository on Linux Dev

What's the best practice for setting up a subversion repository on a linux development machine. External users need to be able to access a specific repository, but nothing else on the machine. I know one answer is to set up a dedicated repository, but I'm looking for a single machine solution: location of repositories, accounts, backup procedures.

One of the popular access methods to Subversion is via Apache module. You can set put different rights at the directory level to control access. See Choosing a Server Configuration and httpd, the Apache HTTP Server . For authentication, I recommend using external authentication source like Microsoft AD via mod_auth_sspi .

If you need to mix and match rights, see my answer for How can I make only some folders show up for certain developers with SVN .

I work for an IT operations infrastructure automation company; we do this all the time.

Location of repository: We use "/srv/svn" by default to store all SVN repositories, unless a customer has a specific requirement, for example an existing repository might be stored on a ReadyNAS shared filesystem.

Accounts: All our customers use LDAP. Either OpenLDAP server running on a master host, but sometimes Active Directory because some customers have a Windows domain in their office, which we can configure as well. Developers get access to the "SCM" group (usually svn, git or devel), and the 'deploy' group. These groups only have permissions to log in and perform SCM related activities (ie, write commits to the repo based on group ownership), or do application deployments to production.

Backup procedures: We use svnadmin hotcopy unless the customer already has something in place (usually svnadmin dump, heh).

svnadmin hotcopy /srv/svn /srv/svn_backups/$(date +%Y%m%d)

For access to the repo, it's usually simple svn+ssh. Some customers already have an Apache setup, but not many. I recommend SSH. Developers push their public ssh keys out and all is well. There's little to no maintenance with LDAP user management (the only way to go).

I'd recommend looking at the chapter on server configuration in the subversion book . It makes suggestions about which configuration is more appropriate for your use.

For what it's worth, setting up a repository using the stand alone svn daemon is very straight forward. The annoying thing is managing user rights.

I have a blog posting that describes the steps necessary to set up and initiate a Linux-based Subversion server in order to maintain code repositories etc.

Basically the steps are:

  1. Download the Subversion tarball.
  2. Unzip and install Subversion.
  3. Deal with any installation problems that arise when running ./configure , if any.
  4. Create the Subversion repository using svnadmin create .
  5. Edit the repository configuration file using your text editor of choice.
  6. Ditto the password file.
  7. Import your code, projects etc into the repository using svn import .
  8. Start the server as a daemon eg svnserve -d . It is also possible to get it to do this automatically upon reboot.
  9. Start using it using standard Subversion commands to eg check out, check in, backup etc...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM