Subversion(svn)
1. Change root user
su -
## OR ##
sudo -i
2. Install needed packages (mod_dav_svn and subversion)
rpm -ivh mod_dav_svn
rpm -ivh subversion
3. Add SVN (Subversion) users
Use following command:
## Create testuser ##
htpasswd -c -m /etc/svn-auth-users testuser
New password:
Re-type new password:
Adding password for user testuser
## Create testuser2 ##
htpasswd -m /etc/svn-auth-users testuser2
New password:
Re-type new password:
Adding password for user testuser2
Note: Use exactly same file and path name as used on subversion.conf file. This example use /etc/svn-auth-users file.
4. Create SVN Access Control file
On this guide, I use following /etc/svn-access-control file.
## Open /etc/svn-access-control file with your favourite editor ##
nano -w /etc/svn-access-control
Add following type content to file:
[groups]
testgroup = testuser1, testuser2
testgroup2 = testuser3, testuser4, testuser5
testgroup3 = testuser6, testuser7
[/]
* = r
@testgroup = rw
testuser4 = rw
[testrepo:/]
@testgroup2 = rw
testuser6 = rw
[testrepo2:/trunk]
@testgroup3 = rw
testuser5 = rw
[testrepo2:/tags]
@testgroup3 = r
testuser5 = rw
5. Add AuthzSVNAccessFile to subversion server config
Previously created /etc/httpd/conf.d/subversion.conf file:
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so
<Location /svn>
DAV svn
SVNParentPath /var/www/svn
AuthType Basic
AuthName "Subversion repositories"
AuthUserFile /etc/svn-auth-users
Require valid-user
</Location>
Add AuthzSVNAccessFile row to config:
AuthzSVNAccessFile /etc/svn-access-control
Finally /etc/httpd/conf.d/subversion.conf file should look something like following:
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so
<Location /svn>
DAV svn
SVNParentPath /var/www/svn
AuthType Basic
AuthName "Subversion repositories"
AuthUserFile /etc/svn-auth-users
AuthzSVNAccessFile /etc/svn-access-control
Require valid-user
</Location>
6. Restart Apache Web Server
/etc/init.d/httpd start
## OR ##
service httpd start
7. Create and configure SVN repository
mkdir /var/www/svn
cd /var/www/svn
svnadmin create testrepo
chown -R apache.apache testrepo
chcon -R -t httpd_sys_content_t /var/www/svn/testrepo
## Following enables commits over http ##
chcon -R -t httpd_sys_rw_content_t /var/www/svn/testrepo
Goto http://localhost/svn/testrepo address and you should see something like following, write username and password:
8. Configure repository
To disable anonymous access and enable access control add following rows to testrepo/conf/svnserve.conf file:
## Disable anonymous access ##
anon-access = none
## Enable access control ##
authz-db = authz
9. Create trunk, branches and tags structure under testrepo
Create “template” directories with following command:
mkdir -p /tmp/svn-structure-template/{trunk,branches,tags}
Then import template to project repository using “svn import” command:
svn import -m 'Initial import' /tmp/svn-structure-template/ http://localhost/svn/testrepo/
Adding /tmp/svn-structure-template/trunk
Adding /tmp/svn-structure-template/branches
Adding /tmp/svn-structure-template/tags
Committed revision 1.
Check results on browser and see testrepo revision 1:
http://www.if-not-true-then-false.com/2010/install-svn-subversion-server-on-fedora-centos-red-hat-rhel/
No comments:
Post a Comment