Subversion (SVN) is a version control system initiated in 2000 by CollabNet Inc. It is used to maintain current and historical versions of files such as source code, web pages, and documentation. Its goal is to be a mostly-compatible successor to the widely used Concurrent Versions System (CVS).
Subversion is well-known in the open source community and is used on many open source projects, including Apache Software Foundation, KDE, Free Pascal, FreeBSD, GCC, Python, Django, Ruby, Mono, SourceForge.net, ExtJS and Tigris.org. Google Code also provides Subversion hosting for their open source projects. BountySource systems use it exclusively. Codeplex offers access to both Subversion as well as other types of clients.
Subversion is also being adopted in the corporate world. In a 2007 report by Forrester Research, Subversion was recognized as the sole leader in the Standalone Software Configuration Management (SCM) category and a strong performer in the Software Configuration and Change Management (SCCM) category.
Here’s how I installed subversion on a machine with RHEL6
For anyone learning or using Subversion, I highly recommend that you read the book.
[mateen@reuters ~]$ yum install *subversion
now Check version
mateen@reuters ~]$ svn --version
svn, version 1.6.11 (r934486)
compiled May 31 2011, 05:46:33
Then you’ll need to setup at least one repository. I’m going to need multiple repositories that I can use for different clients so I have a bit of extra admin work ahead of me. You can setup as many repositories as you need, but no matter what you’ll need at least one. Here create the folders…
# mkdir /svn
# mkdir /svn/repos
# mkdir /svn/users
# mkdir /svn/permissions
# mkdir /svn/repos
# mkdir /svn/users
# mkdir /svn/permissions
Now you have to give proper permissions to folder
chown -R apache.apache /svn
Then need to tell subversion to make a repository.
svnadmin create /svn/repos
Then, I need to setup a config file for svnserve.
cd /svn/repos/conf/
vim svnserve.conf
Then, look for variations of the following code and edit it as necessary. By default any anonymous user can access the code so to disable that you must include anon-access = none, just commenting the value out will not prevent anonymous access.
[general]
anon-access = none
password-db = passwd <-Passwd file
realm = My SVN Repository
auth-access = write
password-db = passwd <-Passwd file
realm = My SVN Repository
auth-access = write
Please note: don’t just insert these three lines at the very end, like I did. They need to go in the [general] section, not the [sasl] section, otherwise “Authorization failed” type errors will occur whenever you try to check in any new stuff
vim passwd
svnuser = password
Now start SVN Server
$svnserve -d
One side note – svnserve just runs and doesn’t have a way to stop besides killing the process. If you make changes to the svnserve.conf or user file you’ll need to restart svnserve.
To back up a Subversion repository
Don’t try and copy and paste the repository or anything like that. Create a gzipped Subversion file as follows:
$svnadmin dump /MyPath/Repos | gzip > MyBackupRepos.svn.gzNow, let’s setup apache.
Create a new apache include file that will hold our configurations (You may already have this is subversion was already installed).
vim /etc/httpd/conf.d/subversion.conf
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so
DAV svn
SVNPath /svn/repos
AuthType Basic
AuthName “Subversion Repository”
AuthUserFile /svn/users/svnpass
Require valid-user
AuthzSVNAccessFile /svn/permissions/svnauthz
SVNPath /svn/repos
AuthType Basic
AuthName “Subversion Repository”
AuthUserFile /svn/users/svnpass
Require valid-user
AuthzSVNAccessFile /svn/permissions/svnauthz
htpasswd -cm /svn/permissions/svnauthz admin
password
0 comments:
Post a Comment