1 / 13

Setting up a Subversion repository

By: Matt Krass Last Updated: 4/11/07. Setting up a Subversion repository. What is Subversion?. Version Control System Backup of files Ability to work from anywhere with an Internet connection Multiple Programmers can work on something without conflict. How do I use Subversion?.

xuxa
Download Presentation

Setting up a Subversion repository

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. By: Matt Krass Last Updated: 4/11/07 Setting up a Subversion repository

  2. What is Subversion? • Version Control System • Backup of files • Ability to work from anywhere with an Internet connection • Multiple Programmers can work on something without conflict.

  3. How do I use Subversion? • Most modern Linux systems come with the standard command line client, svn • For Windows users there is TortoiseSVN, a GUI client that integrates straight in to Windows Explorer.

  4. How do I use Subversion? For the command line client, the two most common options are to check out and commit changes. $ svn checkout https://storage.sclab.clarkson.edu/svn/myrepository This will prompt for your username/password combination to access the server. $ svn commit This will prompt for a log message, as well as your login details, then commit the differences between your local working copy and the server’s repository.

  5. What do I need for a Subversion server? • Subversion • Apache 2 (with OpenSSL if you want secure SVN access, though we won't be going over this) • The “svn” module-pack for Apache 2

  6. Setting up Subversion First, we must install Subversion, this is easy to do on Ubuntu/Debian via the apt-get command. $ apt-get install subversion subversion-tools This installs Subversion, tools to help maintain Subversion, and dependencies. Now we need to create a place to store the repositories and configuration files. I will be using /svn for the base, then I store the repositories in /svn/repos/public and /svn/repos/private. There’s a few configuration files you’ll need: /svn/svnauth – a list of which users can do what to which repositories /svn/svnusers – a list of users and hashed passwords, similar to the systems /etc/passwd file To generate the svnusers file, use Apaches htpasswd2 utility. $ htpasswd2 –c /svn/svnusers <your preferred username> This will create the file and prompt you for a password for your first user. Run without the –c flag to update an existing svnusers file with a new user.

  7. Setting up Subversion Before we can create the svnauth file, we need a repository to set the permissions for, so we need to create one. The command for this is svnadmin with a create parameter. Inside the /svn/repos/public or /svn/repos/private subdirectory, use this to make a new repository: $ svnadmin create reponame Now we need to make your username authorized to read and write to it, lets create the svnauth file Now. Sample /svn/svnauth [reponame:/] username = rw guest = r This allows the user username to read/write to the repository, while the user guest can only read from it. Add users and repositories as needed. This can all be done with something simple like emacs or gedit.

  8. Setting up Apache Subversion is now all set up, time for Apache. On most distributions you can set up Apache with either apt-get or yum, and installing the required packages. Ubuntu/Debian’s apt-get install also pulls in various other packages including the SSL support you need for a secure repository. $ apt-get install apache2 Once installed, it must be configured and set up, on a Ubuntu/Debian system the apache2 service should automatically be set to start with the computer. If you need to start it manually you can use this Command: $ /etc/init.d/apache2 start Apache maintains different “sites” to run, and they’re all stored as individual configuration files in /etc/apache2/sites-available/ and they’re enabled by symlinking to the file in /etc/apache2/sites-enabled/

  9. Setting up Apache There are a few modules, addons to Apache that will be necessary for this to work, such as the dav, dav_fs and dav_svn modules. This are easy to install in a Ubuntu/Debian system through the apt-get command. $ apt-get install libapache2-svn Once installed the modules must be “enabled” for use by Apache, the easiest way to do this is with the a2enmod command. $ a2enmod Which module would you like to enable? Your choices are: actions asis auth_anon auth_dbm auth_digest auth_ldap cache cern_meta cgi cgid dav dav_fs dav_svn deflate disk_cache expires ext_filter file_cache headers imap include info ldap mem_cache mime_magic php5 proxy proxy_connect proxy_ftp proxy_http rewrite speling ssl suexec unique_id userdir usertrack vhost_alias Module name? Simply repeat this process three times, selecting dav, dav_fs and dav_svn.

  10. Setting up Apache Now, you need a site file for SVN. You can either modify the /etc/apache2/sites-available/default site file or create a new one for SVN, I generally create a site file named svn, and either modify/delete default as per my need. The contents of the file look like this: NameVirtualHost 128.153.144.184:80 <virtualhost 128.153.144.184:80> ServerAdmin krassma@clarkson.edu <Location /svn> DAV svn SVNParentPath /svn/repos/public AuthType Basic AuthName "COSI Subversion Repository" AuthUserFile /svn/svnusers AuthzSVNAccessFile /svn/svnauth Require valid-user </Location> </virtualhost>

  11. Setting up Apache Once you’ve created your site file in Apaches sites-available directory, you must link it to sites-enabled and restart Apache $ ln –s /etc/apache2/sites-available/svn /etc/apache2/sites-enabled/001-svn $ /etc/init.d/apache2 restart Once that’s done, your website should be up for SVN hosting, provided all the required modules are Installed and the configuration file completed properly. If there are any errors or Apache fails to restart, Check /var/log/apache2* for details regarding the problem. To disable SVN hosting all you need to do is use unlink to remove the symlink to the file, and restart Apache. $ unlink /etc/apache2/sites-enabled/001-svn $ /etc/init.d/apache2 restart And the repository is down, for maintenance, backups, irritating your peers, whatever reason.

  12. Summary You should be all set, to summarize, you’ve installed and configured Subversion, created a repository and set up a user list and a permission list. You’ve then installed and configured Apache to use the Subversion module pack to access the repository, authenticating against the user/permission lists you’ve created. Let’s just end with some quick troubleshooting tips: • If Apache won’t start, look in the logs for an explanation, it’s usually an unloaded module, or a typo in the config file, or you’ve forgotten to stop Apache (the restart directive is helpful here). Also make sure any addresses coded in to the config file are correct, and that all of your paths are correct. • If the svn client throws a permission error, or an unable to commit or checkout error, check the permissions of the repository. Apache will need permission to read/write the files, whether through ownership or group permissions. • Be careful you don’t ever run: chmod 777 ./ from the system root directory, or you’ll know what I feel like :-) • Make sure any firewalls are configured to allow the traffic, and that you’ve set your svnauth permissions correctly for the repository

  13. Contact Info If you need to reach me for any questions you can get me at Email: krassma@clarkson.edu AIM: MattKrass358 IRC: KC2RGZ @ comm.sclab.clarkson.edu/#cosi

More Related