<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>LongSpine.com &#187; svnserve</title>
	<atom:link href="http://longspine.com/tag/svnserve/feed/" rel="self" type="application/rss+xml" />
	<link>http://longspine.com</link>
	<description>Yes, we are lazy.</description>
	<lastBuildDate>Tue, 06 Jul 2010 10:49:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
	<atom:link rel="next" href="http://longspine.com/tag/svnserve/feed/?page=2" />

		<item>
		<title>Install Lighttpd and Subversion on Debian Lenny</title>
		<link>http://longspine.com/how-to/install-lighttpd-and-subversion-on-debian-lenny/</link>
		<comments>http://longspine.com/how-to/install-lighttpd-and-subversion-on-debian-lenny/#comments</comments>
		<pubDate>Thu, 24 Sep 2009 16:15:13 +0000</pubDate>
		<dc:creator>poomk</dc:creator>
				<category><![CDATA[How-to]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[lenny]]></category>
		<category><![CDATA[lighttpd]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[subversion]]></category>
		<category><![CDATA[svnserve]]></category>

		<guid isPermaLink="false">http://longspine.com/?p=50</guid>
		<description><![CDATA[Introduction This article is a step-by-step guide for installing Lighttpd (pronounced lighty) and Subversion on Debian Lenny. My previous setup was Subversion with Apache, however Apache was too heavy for my virtual private server so I had to move to Lighttpd. Most resources from the previous article are used in this article as well. Sadly, [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Introduction</strong></p>
<p>This article is a step-by-step guide for installing Lighttpd (pronounced lighty) and Subversion on Debian Lenny.<br />
My previous setup was Subversion with Apache, however Apache was too heavy for my virtual private server so I had to move to Lighttpd. Most resources from the previous article are used in this article as well.</p>
<p>Sadly, however, there is no mod_svn for Lighttpd, and it will not be implemented in the near future. <a href="http://forum.lighttpd.net/topic/59#6369">This</a> is one of the good reasons why not.</p>
<p>The most common solution is to use mod_proxy and forward the command to Apache with the module dav_svn, but it doesn&#8217;t make sense to run Apache in parallel with Lighttpd if we tried to avoid using Apache since the beginning.</p>
<p>My solution was to use <strong>svnserve</strong>, which is the default server for svn and has a relatively better performance than WebDAV on Apache. The operations of lighttpd and svnserve are totally decoupled, which means we <strong>do not</strong> need to configure Lighttpd for svnserve and vice versa.</p>
<p>If you prefer using Apache than svnserve, as many people did, use this <a href="http://redmine.lighttpd.net/wiki/lighttpd/ApacheSubversionRecipe">very simple guide</a>.</p>
<p>Otherwise, please follow the following steps:</p>
<p><strong>Install and Configure Lighttpd</strong></p>
<p>Install the package from <em>aptitude</em>:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">aptitude</span> <span style="color: #c20cb9; font-weight: bold;">install</span> lighttpd</div></div>
<p>Edit the config file:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">vi</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>lighttpd<span style="color: #000000; font-weight: bold;">/</span>lighttpd.conf</div></div>
<p>Change the default document root by editing <em>server.document-root</em>:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">server.document-root = <span style="color: #ff0000;">&quot;/var/www/example1.com/&quot;</span></div></div>
<p>Where <em>example1.com</em> is the directory where you default website is located.</p>
<p>If you need to create a virtual host, add the following virtual host at the end of the file (otherwise skip this step):</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #007800;">$HTTP</span><span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #ff0000;">&quot;host&quot;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> == <span style="color: #ff0000;">&quot;(^|\.)example2\.com&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span><br />
server.document-root = <span style="color: #ff0000;">&quot;/var/www/example2.com/&quot;</span><br />
<span style="color: #7a0874; font-weight: bold;">&#125;</span></div></div>
<p>Don&#8217;t forget to change <em>example2.com</em> to your own directory.</p>
<p>Noted that Lighttpd has a module called <em>simple-vhost</em>, however, it&#8217;s not the robust choice and I don&#8217;t recommend it.</p>
<p>Now save the file and reload Lightty by:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>lighttpd force-reload</div></div>
<p>Try accessing the website by using your browsers. The default location is at <em>/var/www/example1.com/</em>, but if you enter your website with the name <em>example2.com</em> you&#8217;ll be redirected to your virtual host at <em>/var/www/example2.com/</em> instead (this requires a DNS).</p>
<p><strong>Install and Configure Subversion</strong></p>
<p>Install subversion from <em>aptitude</em>:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">aptitude</span> <span style="color: #c20cb9; font-weight: bold;">install</span> subversion</div></div>
<p>A new subversion user group should be created. This can be done by creating a new user called <em>svn</em> and and the existing users to this group, as follows:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">sudo</span> useradd <span style="color: #c20cb9; font-weight: bold;">svn</span><br />
<span style="color: #c20cb9; font-weight: bold;">sudo</span> usermod <span style="color: #660033;">-a</span> <span style="color: #660033;">-G</span> <span style="color: #c20cb9; font-weight: bold;">svn</span> user1</div></div>
<p>Where <em>user1</em> is an existing user that is added to the group <em>svn</em>.</p>
<p>Set a new password for the user <em>svn</em>:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">passwd</span> <span style="color: #c20cb9; font-weight: bold;">svn</span></div></div>
<p>Create a new directory for repositories, and create a new repository for testing:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">svn</span><br />
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">svnadmin</span> create <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>svn<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">test</span><br />
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">chown</span> <span style="color: #660033;">-R</span> <span style="color: #c20cb9; font-weight: bold;">svn</span>:<span style="color: #c20cb9; font-weight: bold;">svn</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">svn</span></div></div>
<p>This will create a new directory called <em>/var/svn</em> which contains a new testing repository <em>test</em>.</p>
<p>Don&#8217;t forget to change the permission for all users in the group <em>svn</em> for the test project:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #660033;">-R</span> g+<span style="color: #c20cb9; font-weight: bold;">w</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>svn<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">test</span></div></div>
<p>Test the setting by usinf the <em>file</em> protocol:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">svn</span> <span style="color: #c20cb9; font-weight: bold;">co</span> <span style="color: #c20cb9; font-weight: bold;">file</span>:<span style="color: #000000; font-weight: bold;">///</span>var<span style="color: #000000; font-weight: bold;">/</span>svn<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">test</span> <span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">test</span></div></div>
<p>This will check out our test project to <em>/tmp/test</em>. You should get an output like &#8220;Checked out revision 0&#8243;.</p>
<p><strong>Using svnserve</strong></p>
<p>Now, assuming that you need some level of security for your code, which will be transmitted through the Internet or LAN, we have to enable ssh tunneling for svnserve. The good news is that you can use the protocol svn+ssh, by default. This will make a ssh connection to you server, run svnserver, and stop svnserver after the command is executed. This is an example:</p>
<p>(on the client side)</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">svn</span> list <span style="color: #c20cb9; font-weight: bold;">svn</span>+<span style="color: #c20cb9; font-weight: bold;">ssh</span>:<span style="color: #000000; font-weight: bold;">//</span>example.com<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>svn<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">test</span></div></div>
<p>This command will list the subversion project at the location <em>/var/svn/test</em> of the server <em>example.com</em>. If you want to specify the username, just add the username and @ before the hostname as in this example:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">svn</span> list <span style="color: #c20cb9; font-weight: bold;">svn</span>+<span style="color: #c20cb9; font-weight: bold;">ssh</span>:<span style="color: #000000; font-weight: bold;">//</span>user1<span style="color: #000000; font-weight: bold;">@</span>example.com<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>svn<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">test</span></div></div>
<p>Don&#8217;t forget to change <em>user1</em>, <em>example.com</em>, and <em>/var/svn/test</em> to your own setting.</p>
<p>If SSH key authentication was not set, you will be asked for your password <strong>twice</strong>. If you feel annoyed by this strange design, set the  public key authentication up. If you don&#8217;t know how to do it, I found <a href="http://www.petefreitag.com/item/532.cfm">this</a> a nice and simple guide for beginners.</p>
<p><strong>Other port than 22?</strong></p>
<p>If, for a security reason, your ssh server doesn&#8217;t run on port 22, you need to edit <em>/etc/subvesion/config</em> in the client side (assuming you client also uses Debian Lenny):</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">vi</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>subversion<span style="color: #000000; font-weight: bold;">/</span>config</div></div>
<p>Now in the <em>[tunnel]</em> section add the following line:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">ssh2222 = <span style="color: #007800;">$SVN_SSH_2222</span> <span style="color: #c20cb9; font-weight: bold;">ssh</span> <span style="color: #660033;">-p</span> <span style="color: #000000;">2222</span> <span style="color: #660033;">-o</span> <span style="color: #007800;">ControlMaster</span>=no</div></div>
<p>This will use ssh tunneling on port 2222 instead of the default port 22. You can change the port to you own setting and also change <em>ssh2222</em> and <em>SVN_SSH_2222</em> to the name you prefer. ControlMaster option must be turned off, according to the default configuration file.</p>
<p>On the client side you can list the repository by using the command:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">svn</span> list <span style="color: #c20cb9; font-weight: bold;">svn</span>+ssh2222:<span style="color: #000000; font-weight: bold;">//</span>user1<span style="color: #000000; font-weight: bold;">@</span>example.com<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>svn<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">test</span></div></div>
<p>Good luck. Your comments are always appreciated.</p>
]]></content:encoded>
			<wfw:commentRss>http://longspine.com/how-to/install-lighttpd-and-subversion-on-debian-lenny/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
