Creating a subversion repository

April 7, 2006 by bealers

This item assumes that you already have svn installed and this is the first time you’ve created a repository for this server (else leave out certain bits)

All items here worked on our local development server where subversion is already installed but up to now we had only been using it as a client to check out code from remote repositories.

Create the repository

[code]svnadmin create –fs-type fsfs /export/svn/ZF_blog[/code]

edit /export/svn/ZF_blog/conf/svnserve.conf

making sure
[general] is un-commented
passwd-db=/etc/subversion/passwd
realm=SomeString

Sort out authentication

[code]useradd -d /export/svn -s /bin/false -m svn
groupadd svn
cd /export/svn
chown -R svn:svn ZF_blog
find ZF_blog -type d -exec chmod 2770 \{\} \;
echo “[users]
bealers=password” >> /etc/subversion/passwd[/code]

cd to the folder where your code lies (in the correct structure):

[code]/ZF_blog/branches
/ZF_blog/tags
/ZF_blog/trunk
/ZF_blog/trunk/[/code]

Import

[code]cd ~bealers/tmp/ZF_blog
svn import . file:///export/svn/ZF_blog/
[/code]

Edit the commit notes document, for me it opens up in vi. write/quit and your files should be imported

Checkout

[code]svn co svn://localhost/ZF_blog/trunk/ zf.blog
svn: Can’t connect to host ‘localhost’: Connection refused[/code]

Ah, this server does not have the svn server running, or inetd to run it on so as an aside:

[code]apt-get install inetd
echo “svn stream tcp nowait svn /usr/bin/svnserve svnserve -i -r /export/svn/” >> /etc/inetd.conf
/etc/init.d/inetd start[/code]

Checkout (again)

[code]svn co svn://localhost/ZF_blog/trunk/ zf.blog
A zf.blog/sql
A zf.blog/sql/zf.blog.sql
A zf.blog/codebase
A zf.blog/codebase/app
A zf.blog/codebase/app/models
A zf.blog/codebase/app/models/db
A zf.blog/codebase/app/models/db/Posts.php
A zf.blog/codebase/app/controllers
A zf.blog/codebase/app/controllers/IndexController.php
A zf.blog/codebase/app/controllers/AdminController.php
A zf.blog/codebase/app/views
A zf.blog/codebase/app/views/postForm.php
A zf.blog/codebase/app/views/~list.php
A zf.blog/codebase/app/views/list.php
A zf.blog/codebase/app/views/template.php
A zf.blog/codebase/htdocs
A zf.blog/codebase/htdocs/index.php
A zf.blog/codebase/lib
A zf.blog/codebase/lib/BealersApplicationController.php
A zf.blog/codebase/etc
A zf.blog/codebase/etc/init.inc
Checked out revision 1.[/code]

All I need do now is edit a line in the app to add the codebase folder to the application path and do the same again within Apache’s httpd.conf for the VirtualHost for this app.

Related:
http://subversion.tigris.org/

Darren (a.k.a. Bealers by his friends) has been a professional web developer for 10+ years and currently runs Siftware. It's not all geekdom, though. When not in front of a computer he enjoys his garden, the odd bit of windsurfing and spending as much time as possible with his wife and 3 kids. He is also a trainee cabinet maker.


No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment