3,430 bytes added
, 16:38, 11 March 2012
[http://subversion.apache.org/ Apache Subversion] is a full-featured version control system originally designed to be a better CVS. Subversion has since expanded beyond its original goal of replacing CVS, but its basic model, design, and interface remain heavily influenced by that goal. Even today, Subversion should still feel very familiar to CVS users.
This tutorial will show you how to install, create a repo, and browse that repo on your HDA. To use Subversion, you will need a client. There are many to choose from but [http://tortoisesvn.net/ Tortise SVN] is one of the most popular.
==Setup==
<ul>
<li>Create web app ([[Advanced_Settings|Advanced Settings]] must be enabled on HDA)</li>
<ol>
<li>From the Dashboard main page, select '''Apps''' at the top.</li>
<li>Choose ''Webapps''</li>
<li>Select '''New Web App''' button at the bottom</li>
<li>Enter ''apachesvn'' for the Name (ensure the path reflects the name correctly)</li>
<li>Choose '''Create'''</li>
<li>[[Open_Terminal_as_root|Open a terminal as root]] user and do the following:
{{Code|cd /etc/httpd/conf.d}}</li>
<li>Look for the ''####-apachesvn.conf'' (#### is some number, i.e. 1000) file and open it in your favorite editor. Add the following to it between '''ServerAlias''' and '''DocumentRoot''' lines
{{Text|Text=<Location /svn>
DAV svn
SVNParentPath /var/hda/web-apps/apachesvn/html
AuthType Basic
AuthName "Subversion repositories"
AuthUserFile /etc/svn-auth-users
Require valid-user
</Location>}}</li>
<li>Restart web server to enable the changes
{{Code|/etc/init.d/httpd restart;}}</li>
<li>Create web page to browse repository</li>
{{Code|cd /var/hda/web-apps/apachesvn
echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Your Page Title</title>
<meta http-equiv<nowiki>=</nowiki>"REFRESH" content<nowiki>=</nowiki>"0;url<nowiki>=</nowiki>http://apachesvn/svn/myrepo"></HEAD>
<BODY>
Optional page text here.
</BODY>
</HTML>' > html/index.html
chown apache.users html/index.html}}
</ol>
<li>Install dependencies
{{Code|yum install mod_dav_svn subversion -y}}
<li>Establish a user account (change ''username'' and ''password'' to whatever you desire)
{{Code|htpasswd -cmb /etc/svn-auth-users username password}}
<li>Create and setup the repository (call it anything you like)
{{Code|svnadmin create html/myrepo
chown -R apache.apache html/myrepo
chcon -R -t httpd_sys_content_t html/myrepo
chcon -R -t httpd_sys_rw_content_t html/myrepo}}
<li> Configure the repository</li>
{{Code|sed -i '13 i anon-access <nowiki>=</nowiki> none' html/myrepo/conf/svnserve.conf
sed -i '15 i authz-db <nowiki>=</nowiki> authz' html/myrepo/conf/svnserve.conf}}
<li>Perform initial repository import (''username'' and ''password'' same as above); when prompted, choose '''no''' for password being stored as plain text
{{Code|mkdir -p /tmp/svn-structure-template/<nowiki>{trunk,branches,tags}</nowiki>
svn import -m 'Initial import' --username username --password password /tmp/svn-structure-template/ http://apachesvn/svn/myrepo/}}
</ul>
==Complete==
Navigate to http://apachesvn. You should see 3 directories: trunk, branches, and tags. Install a Subversion client and begin using your new repository.
==References==
[http://www.if-not-true-then-false.com/2010/install-svn-subversion-server-on-fedora-centos-red-hat-rhel Install SVN (Subversion) Server on Fedora 16/15, CentOS/Red Hat (RHEL) 6/5.7]