• 3rd, Apr 2011

Creating a SVN server on Amazon EC2

These settings are for a Suse Linux SP1 with Apache 2 server running

ip-10-48-162-89:~ # vi /etc/sysconfig/apache2
APACHE_MODULES=”… mod_dav mod_dav_svn mod_authz_svn”

ip-10-48-162-89:~ # vi /etc/apache/httpd.conf

<Location /svn>
	DAV svn
	SVNParentPath /srv/svn

	# how to authenticate a user
	AuthType Basic
	AuthName "Subversion repository"
	AuthzSVNAccessFile /etc/svn-auth-users
        AuthUserFile /etc/svn-auth-passwd
 	Require valid-user
</Location>

ip-10-48-162-89:~ # vi /etc/svn-auth-users

[/]
guest = r
admin = rw
ignacio = rw

ip-10-48-162-89:~ # htpasswd -cm /etc/svn-auth-passwd ignacio

New password:
Re-type new password:
Adding password for user ignacio

(Execute this command for each user, remove -c to avoid overwrite the file)

ip-10-48-162-89:~ # vi /etc/sysconfig/svnserve
SVNSERVE_OPTIONS=”-d -R -r /srv/svn”
SVNSERVE_USERID=”svn”
SVNSERVE_GROUPID=”svn”

Creating repository folder and unix user/group
ip-10-48-162-89:~ # mkdir /srv/svn
ip-10-48-162-89:~ # useradd svn
ip-10-48-162-89:~ # groupadd svn

Create a repository (use “repo” as the name of your company)
ip-10-48-162-89:~ # svnadmin create /srv/svn/repo
ip-10-48-162-89:~ # chown -R wwwrun:www /srv/svn
ip-10-48-162-89:~ # /etc/init.d/svnserve start
ip-10-48-162-89:~ # /etc/init.d/apache2 restart
ip-10-48-162-89:~ # cd ~
ip-10-48-162-89:~ # mkdir my_project
ip-10-48-162-89:~ # cd my_project/
ip-10-48-162-89:~/my_project # mkdir branches tags trunk
ip-10-48-162-89:~/my_project # cd trunk

Import all the files to your repository
ip-10-48-162-89:~/# cd ..
ip-10-48-162-89:~/# svn import . http://ec2-xx-xx-xx-amazon.com/svn/repo/ -m “Initial version”



Fist time you want to use the trunk version to your web server
cd /srv/www/htdocs
svn checkout http://ec2-xx-xx-xx-amazon.com/svn/repo/trunk .

Next times
cd /srv/www/htdocs
svn update

Notes
If you get “mod_security: Access denied with code 403.”
Add these lines to disable mod_security on /etc/apache/httpd.conf

# Turn off mod_security filtering.
SecFilterEngine Off

# The below probably isn’t needed, but better safe than sorry.
SecFilterScanPOST Off

Note: Replace ec2-xx-xx-xx-amazon.com for your instance e.g.ec2-46-23-152-198.eu-west-1.compute.amazonaws.com

TAGS: None

Leave a Reply

*

© 2010 unexpected[it]. All Rights Reserved.