Posts Tagged fedora

Quick SVN & Trac Installation on CentOS/Fedora

Tested on CentOS 4 but the assumption is that this same setup should work on both Fedora and Redhat. SELinux has been disabled for this setup.

Install the mod_dav_svn module:
#yum -y install subversion mod_dav_svn

CREATE SUBVERSION ROOT REPOSITORY


#mkdir /srv/svn
#svnadmin create /srv/svn/repos
#chown -R apache /srv/svn/repos

ENABLING SVN HTTP ACCESS USING APACHE WEBSERVER

1.) Backup the original subversion.conf file that might be on your system.
#mv /etc/httpd/conf.d/subversion.conf /etc/httpd/conf.d/subversion.conf.old
#vi /etc/httpd/conf.d/subversion.conf

2.) After opening your subversion.conf file above, insert the following directives:

<Location /svn>
DAV svn
SVNParentPath /srv/svn
#SVNListParentPath on
# authentication
AuthType Basic
AuthName “Repository Name”
AuthUserFile /srv/users
Order deny,allow
Require valid-user

# authorization
# AuthzSVNAccessFile “/etc/httpd/conf/svn-auth.ini”
</Location>

Add a new user who can be authenticated against the repository:
#htpasswd -cm users user1

The first user you add, will require you to use the -cm switch. From then on, create new users as shown below:
#htpasswd -m users user2

SVNListParentPath allows you to have several repos under the same svn directory ie you can create repo2 and repo3…repon under the svn directory and apache will still be able to serve them.

PLEASE ENSURE YOU DO NOT PLACE the /srv/users file under the /srv/svn directory. This is because should you decide to list the files under this directory, and you allow anonymous access to this directory on apache, all your visitors to /srv/svn will be able to see your password.

Other authentication types include LDAP and Basic authentication. References:

> http://httpd.apache.org/docs/2.0/howto/auth.html (Basic authentication)
> http://httpd.apache.org/docs/2.2/mod/mod_authnz_ldap.html (LDAP)

Using LDAP has the benefit of having a universal authentication, authorizaton and access for your system configured from one place. Thus, LDAP system users, would automatically be users on the Subversion Server (as well as the Trac Server).

IMPORT PROJECTS INTO SUBVERSION REPOS

#svn import -m "Initial Import" local-directory-projectX http://server-name/svn/projectX

INSTALLING TRAC SERVER ON CENTOS

Enable extra repositories on Centos (Fedora and Redhat should be able to use the dag repository. Not sure about the karan repository):

#cd /etc/yum.repos.d
#vi dag.repo

Paste the following:

[dag]
name=Dag RPM Repository for Red Hat Enterprise Linux
baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag
gpgcheck=1
enabled=1


#wget http://centos.karan.org/kbsingh-CentOS-Extras.repo
#wget http://centos.karan.org/kbsingh-CentOS-Misc.repo

#rpm --import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt
#rpm --import http://centos.karan.org/RPM-GPG-KEY-karan.org.txt

#yum install mod_dav_svn mod_python clearsilver python-clearsilver python-sqlite trac

CONFIGURE TRAC SERVER ON APACHE WEBSERVER

#trac-admin /srv/trac initenv

Your repository path would be /srv/svn/repos when asked by trac-admin. Choose your desired Project Name. All other default values should be ok to use.

#chown apache:apache /srv/trac

Create a trac.conf file:

#vi /etc/httpd/conf.d/trac.conf

And paste the following

<Location /trac>
SetHandler mod_python
PythonHandler trac.web.modpython_frontend
PythonOption TracEnv /srv/trac
PythonOption TracUriRoot /trac

# authentication
AuthType Basic
AuthName “JoeWami Trac Server”
AuthUserFile /srv/users
Require valid-user
</Location>

Notice we use the same authentication file as above (Please see subversion.conf)

Finally, ensure you are loading the following modules for apache dav svn to work:

LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so

GOTCHAS

1.) Watch out for mod_security/mod_security2, either turn it off or enable mod_security(2) to let through dav requests (/etc/httpd/conf.d/mod_security.conf)

Comments (6)