Creating a Subversion repository

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 for me on my local development server where I’d already installed subversion but up to now 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/

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">