[root@lucifer ~]# yum install mod_dav_svn subversion
[root@lucifer ~] vim /etc/httpd/conf/httpd.conf -- Edit what you need and save the file [root@lucifer ~] service httpd start [root@lucifer ~] chkconfig httpd on
[root@lucifer ~] cd /etc/httpd/conf.d/ [root@lucifer ~] vim subversion.conf # Make sure you uncomment the following if they are commented out LoadModule dav_svn_module modules/mod_dav_svn.so LoadModule authz_svn_module modules/mod_authz_svn.so # Add the following to allow a basic authentication and point Apache to where the actual # repository resides. <Location /repos> DAV svn SVNPath /var/www/svn/repos AuthType Basic AuthName "Subversion repos" AuthUserFile /etc/svn-auth-conf Require valid-user </Location>
[root@lucifer ~] htpasswd -cm /etc/svn-auth-conf yourusername New password: Re-type new password: Adding password for user yourusername [root@lucifer ~] htpasswd -m /etc/svn-auth-conf anotherusername New password: Re-type new password: Adding password for user anotherusername
[root@lucifer ~] cd /var/www/ -- Or wherever you placed your path above [root@lucifer ~] mkdir svn [root@lucifer ~] cd svn [root@lucifer ~] svnadmin create repos [root@lucifer ~] chown -R apache.apache repos [root@lucifer ~] service httpd restart
[root@lucifer ~] svn --help
. |-- project1 | |-- branches | |-- tags | `-- trunk `-- project2 |-- branches |-- tags `-- trunk
[root@lucifer ~] cd /tmp [root@lucifer ~] mkdir mytestproj [root@lucifer ~] cd mytestproj [root@lucifer ~] mkdir configurations options main [root@lucifer ~] vim configurations/testconf1.cfg -- Add whatever you want to these files. [root@lucifer ~] vim options/testopts1.cfg [root@lucifer ~] vim main/mainfile1.cfg
[root@lucifer ~] svn import /tmp/mytestproj/ file:///var/www/svn/repos/mytestproj -m "Initial repository layout for mytestproj" Adding /tmp/mytestproj/main Adding /tmp/mytestproj/main/mainfile1.cfg Adding /tmp/mytestproj/configurations Adding /tmp/mytestproj/configurations/testconf1.cfg Adding /tmp/mytestproj/options Adding /tmp/mytestproj/options/testopts1.cfg
[me@mylappy ~] cd /tmp [me@mylappy ~] svn co http://yoursvnserver/repos/mytestproj Authentication realm: <http://yoursvnserver:80> Subversion repos Password for 'youruser': A mytestproj/main A mytestproj/main/mainfile1.cfg A mytestproj/configurations A mytestproj/configurations/testconf1.cfg A mytestproj/options A mytestproj/options/testopts1.cfg Checked out revision 1.
[me@mylappy ~] cd mytestproj [me@mylappy ~] vim configurations/testconf1.cfg -- Add or delete something and save. [me@mylappy ~] svn commit -m "Added a line to testconf1.cfg." Sending configurations/testconf1.cfg Transmitting file data . Committed revision 2.
The nice thing about this then, is that you can delete all of the directories that you just checked out on your machine. The only reason you checked them out, was to edit them, and then send them back up the line. Web browse to your server to check out the different files.
[me@mylappy ~] svn co http://yoursvnserver/repos/mytestproj A mytestproj/main A mytestproj/main/mainfile1.cfg A mytestproj/configurations A mytestproj/configurations/testconf1.cfg A mytestproj/options A mytestproj/options/testopts1.cfg Checked out revision 2. [me@mylappy ~] cd mytestproj [me@mylappy ~] cp /etc/yum.repos.d/CentOS-Base.repo configurations/ [me@mylappy ~] svn add configurations/CentOS-Base.repo A configurations/CentOS-Base.repo [me@mylappy ~] svn commit -m "Added the CentOS Yum repo file." Adding configurations/CentOS-Base.repo Transmitting file data . Committed revision 3.
To delete items simply use delete instead of add. Commit your changes back up, and you’re good to go. It’s as simple as that. Go back over to your web browser again and you’ll notice the revision number should say 3. You’ll be able to click through the files to pick our your differences as well.
[me@mylappy ~] svn log http://yoursvnserver/repos -- For the entire repository [me@mylappy ~] svn log http://yoursvnserver/repos/mytestproj -- For the specific project
You’ll get a nice complete list of revision numbers along with the comments, like I mentioned above. This allows you to pick which revision you want to check back out now.
[me@mylappy ~] svn co -r 1 http://yoursvnserver/repos/mytestproj
This command will drag down revision number 1.
AuthzSVNAccessFile /etc/svn-acl-conf
You can add this to the relevant Location section:
<Location /repos> DAV svn SVNParentPath /var/www/svn/repos AuthzSVNAccessFile /etc/svn-acl-conf AuthType Basic AuthName "Subversion repos" AuthUserFile /etc/svn-auth-conf Require valid-user </Location>
You can then create /etc/svn-acl-conf. This file consist of sections of the following form:
[reponame:repopath] user = access
http://wiki.centos.org/HowTos/Subversion