<?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>易水博客 &#187; subversion</title>
	<atom:link href="http://easwy.com/blog/archives/tag/subversion/feed/" rel="self" type="application/rss+xml" />
	<link>http://easwy.com/blog</link>
	<description>关注Linux, Scala, Java, 开源软件和嵌入式系统</description>
	<lastBuildDate>Mon, 06 Sep 2010 01:24:21 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>在debian etch中配置subversion版本管理</title>
		<link>http://easwy.com/blog/archives/subversion-configuration-in-debian-etch/</link>
		<comments>http://easwy.com/blog/archives/subversion-configuration-in-debian-etch/#comments</comments>
		<pubDate>Mon, 16 Feb 2009 03:56:43 +0000</pubDate>
		<dc:creator>Easwy</dc:creator>
				<category><![CDATA[开发编程]]></category>
		<category><![CDATA[开源软件]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[subversion]]></category>

		<guid isPermaLink="false">http://easwy.com/blog/?p=181</guid>
		<description><![CDATA[本文介绍了如何在debian etch中配置subversion服务，来进行版本管理。

<div class="fixed"></div><div id="related_posts"><h3  class="related_post_title">相关文章</h3><ul class="related_post"><li><a href='http://easwy.com/blog/archives/install_apache_php_mysql_wordpress_on_debian_lenny/' rel='bookmark' title='Permanent Link: 在Debian Lenny上安装Apache2，PHP5，MySQL5, WordPress&#8230;'>在Debian Lenny上安装Apache2，PHP5，MySQL5, WordPress&#8230;</a></li>
<li><a href='http://easwy.com/blog/archives/install-apache-tomcat-on-debian-lenny/' rel='bookmark' title='Permanent Link: 在Debian Lenny上安装Apache Tomcat'>在Debian Lenny上安装Apache Tomcat</a></li>
<li><a href='http://easwy.com/blog/archives/subversion-client-too-old-error/' rel='bookmark' title='Permanent Link: Linux使用笔记: 解决Subversion提交时提示svn客户端版本太旧的问题'>Linux使用笔记: 解决Subversion提交时提示svn客户端版本太旧的问题</a></li>
</div><div class="fixed"></div>]]></description>
			<content:encoded><![CDATA[<p>
    以下操作如无特殊注明，均为root执行的操作。
  </p>
<div class="section" lang="zh-CN">
<div class="titlepage">
<div>
<div>
<h2 class="title" style="clear: both"><a name="id1295935"></a>安装软件包</h2>
</div>
</div>
</div>
<p>
      首先，需要下载安装下列软件包：
    </p>
<div class="itemizedlist">
<ul type="disc">
<li>apache2</li>
<li>apache2-common</li>
<li>apache2-utils</li>
<li>libapache2-svn</li>
<li>openssl</li>
<li>ssl-cert</li>
<li>subversion</li>
<li>subversion-tools</li>
</ul>
</div>
<p>
      使用apt-get install命令安装上列软件包。
    </p>
</div>
<div class="section" lang="zh-CN">
<div class="titlepage">
<div>
<div>
<h2 class="title" style="clear: both"><a name="id1296369"></a>生成SSL自认证证书</h2>
</div>
</div>
</div>
<p>
      如果要加密对版本服务器的访问，需要启用SSL。你可以到商业证书颁发机构去申请一个合法的证书，也可以采用自认证的方式。我们用下面的命令生成SSL自认证证书，并把它放在/etc/apache2/ssl/目录中。
    </p>
<pre class="programlisting">
mkdir /etc/apache2/ssl
/usr/sbin/make-ssl-cert /usr/share/ssl-cert/ssleay.cnf /etc/apache2/ssl/apache.pem </pre>
<p>
      根据提示回答相应的信息，最后就会生成所需的证书了。
    </p>
</div>
<div class="section" lang="zh-CN">
<div class="titlepage">
<div>
<div>
<h2 class="title" style="clear: both"><a name="id1296395"></a>配置apache2</h2>
</div>
</div>
</div>
<p>
      在apache2中启用ssl模块，使用下面的命令：
    </p>
<pre class="programlisting">
a2enmod ssl </pre>
<p>
      接下来，配置虚拟主机来使能ssl，我的apache2服务器只提供版本库的加密访问，不提供基本的http web服务，所以关闭了80端口，只开启443端口。
    </p>
<p>
      修改/etc/apache2/sites-available/default文件，将前两行改为：
    </p>
<pre class="programlisting">
NameVirtualHost *:443
&lt;VirtualHost *:443&gt; </pre>
<p>
      然后在文件中加入下面的内容：
    </p>
<pre class="programlisting">
      SSLEngine On
      SSLCertificateFile /etc/apache2/ssl/apache.pem </pre>
<p>
      上面的语句打开了SSL引擎，使用我们刚刚生成的证书文件进行认证。
    </p>
<p>
      default虚拟主机应该缺省已经使能了，也就是在/etc/apache2/sites-enabled/目录中已经存在一个符号链接，指向/etc/apache2/sites-available/default。如果没有的话，可以使用下面的命令使能这个虚拟主机：
    </p>
<pre class="programlisting">
a2ensite default </pre>
<p>
      现在修改文件/etc/apache2/ports.conf，把文件的内容改为：
    </p>
<pre class="programlisting">
Listen 443 </pre>
<p>
      也就是我们的apache2只监听443端口。
    </p>
<p>
      好了，现在启动apache2：
    </p>
<pre class="programlisting">
/etc/init.d/apache2 start </pre>
<p>
      如果你没有使用ServerName配置主机名的话，会提示下面的错误，忽略即可：
    </p>
<pre class="programlisting">
Starting web server (apache2)...apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName </pre>
<p>
      在浏览器中输入如下URL，看是否能够访问：
    </p>
<pre class="programlisting">

https://127.0.0.1/
</pre>
<p>
      如果正常的话，你会看到一个缺省的页面，上面显示&#8221;<span class="emphasis"><em>It works!</em></span>&#8220;。如果没有出现此页面，可能你的apache2配置有问题，查看一下错误日志和访问日志，以定位问题。这两个日志的缺省位置在 /var/log/apache2/。
    </p>
</div>
<div class="section" lang="zh-CN">
<div class="titlepage">
<div>
<div>
<h2 class="title" style="clear: both"><a name="id1296506"></a> 配置subversion </h2>
</div>
</div>
</div>
<p>
      首先新建一个用户svnadmin来管理版本库，使用下面的命令：
    </p>
<pre class="programlisting">
addgroup svn
adduser svnadmin –ingroup svn
adduser www-data svn </pre>
<p>
      上面的命令首先创建一个svn用户组，然后创建用户svnadmin，并把这个用户放在svn组中。第三个命令则是把www-data用户也加入到svn组，因为web server是以www-data用户在运行的，要从web server读写版本库，www-data用户必须有版本库的读写权限。
    </p>
<p>
      现在用<span class="command"><strong>su – svnadmin</strong></span>命令切换到svnadmin用户，我们要保证svn用户组的所有用户都具备版本库的读写权限，所以修改svnadmin的umask，修改svnadmin用户的~/.bashrc，在文件中加入下面这行：
    </p>
<pre class="programlisting">
umask 002 </pre>
<p>
      退出再重新登录。这样，由svnadmin创建的版本库，就可以被所有属于svn组的用户读写了。
    </p>
<p>
      现在创建版本库(由用户svnadmin执行下面的命令)：
    </p>
<pre class="programlisting">
svnadmin create ~/repos/svntest </pre>
<p>
      我们创建了一个名为svntest的版本库。如果你已经有cvs的版本库，想把它转到subversion上，可以安装<span class="emphasis"><em>cvs2svn</em></span>软件包，用里面的工具进行转换。
    </p>
</div>
<div class="section" lang="zh-CN">
<div class="titlepage">
<div>
<div>
<h2 class="title" style="clear: both"><a name="id1296568"></a>配置apache2/SVN</h2>
</div>
</div>
</div>
<p>
      首先，使能apache2的dav_svn模块：
    </p>
<pre class="programlisting">
a2enmod dav_svn </pre>
<p>
      我们使用基本的http认证对访问版本库的所有用户进行认证，只有认证用户才有版本库的访问权。
    </p>
<p>
      首先为版本库的用户生成密码文件：
    </p>
<pre class="programlisting">
htpasswd -cm /etc/svnusers xxxxx
htpasswd -m /etc/svnusers yyyyy </pre>
<p>
      上面的命令创建了密码文件/etc/svnusers，并增加两个用户xxxxx和yyyyy。
    </p>
<p>
      然后在/etc/apache2/sites-available/default文件中加入如下语句：
    </p>
<pre class="programlisting">
&lt;Location /svn&gt;
DAV svn
SVNParentPath /home/svnadmin/repos
AuthType Basic
AuthName "Subversion Auth"
AuthUserFile /etc/svnusers
require valid-user
&lt;/Location&gt; </pre>
<p>
      这段话，对URL中指向/svn目录的访问请求，使用DAV进行访问。我们把/home/svnadmin/repos做为所有版本库的父目录，在该目录下可以增加多个版本库。另外，使用/etc/svnusers密码文件对用户进行认证。
    </p>
<p>
      现在，重启apache2服务：
    </p>
<pre class="programlisting">
/etc/init.d/apache2 restart </pre>
<p>
      在浏览器中输入：
    </p>
<pre class="programlisting">
https://127.0.0.1/svn/svntest </pre>
<p>
      这时，会询问你是否接受服务器的证书，选择接受，然后输入你的用户名和密码，验证通过后，在浏览器中就可以看到版本库了。
    </p>
<p>
      测试通过后，你就可以使用其它的subversion客户端对版本库进行访问了。
    </p>
</div>
<p><span class="bold"><strong> [参考文档] </strong></span>
<div class="orderedlist">
<ol type="1">
<li><a class="link" href="http://www.subversion.org.cn/" target="_blank">http://www.subversion.org.cn/</a></li>
<li><a class="link" href="http://fanqiang.chinaunix.net/app/web/2005-05-18/3257.shtml" target="_blank">Apache2/SSL+Subversion+PAM认证服务器配置</a></li>
<li><a class="link" href="http://blog.csdn.net/httpnet/archive/2007/04/22/1574192.aspx" target="_blank">http://blog.csdn.net/httpnet/archive/2007/04/22/1574192.aspx</a></li>
<li><a class="link" href="http://lamp.linux.gov.cn/Apache/ApacheMenu/ssl/ssl_intro.html" target="_blank">http://lamp.linux.gov.cn/Apache/ApacheMenu/ssl/ssl_intro.html</a></li>
</ol>
</div>
<div class="posturl">
<p><span class="bold"><strong>原创文章，请阅读页脚的<a href="#license">许可方式</a>，转载请注明：</strong></span>转载自<a class="link" href="http://easwy.com/blog/" target="_top">易水博客</a> [ <a class="link" href="http://easwy.com/blog/" target="_top">http://easwy.com/blog/</a> ]</p>
<p><span class="bold"><strong>本文链接地址:</strong></span> <a class="link" href="http://easwy.com/blog/archives/subversion-configuration-in-debian-etch/" target="_top">http://easwy.com/blog/archives/subversion-configuration-in-debian-etch/</a></p>
</div>
<p style="margin-top: 0; margin-bottom: 15px; color: #888888; font-size: 80%; font-style: italic">文章的脚注信息由WordPress的<a href="http://easwy.com/blog/wordpress/wp-posturl/" style="color: #8888FF; text-decoration: underline;">wp-posturl插件</a>自动生成</p>


<div class="fixed"></div><div id="related_posts"><h3  class="related_post_title">相关文章</h3><ul class="related_post"><li><a href='http://easwy.com/blog/archives/install_apache_php_mysql_wordpress_on_debian_lenny/' rel='bookmark' title='Permanent Link: 在Debian Lenny上安装Apache2，PHP5，MySQL5, WordPress&#8230;'>在Debian Lenny上安装Apache2，PHP5，MySQL5, WordPress&#8230;</a></li>
<li><a href='http://easwy.com/blog/archives/install-apache-tomcat-on-debian-lenny/' rel='bookmark' title='Permanent Link: 在Debian Lenny上安装Apache Tomcat'>在Debian Lenny上安装Apache Tomcat</a></li>
<li><a href='http://easwy.com/blog/archives/subversion-client-too-old-error/' rel='bookmark' title='Permanent Link: Linux使用笔记: 解决Subversion提交时提示svn客户端版本太旧的问题'>Linux使用笔记: 解决Subversion提交时提示svn客户端版本太旧的问题</a></li>
</div><div class="fixed"></div>]]></content:encoded>
			<wfw:commentRss>http://easwy.com/blog/archives/subversion-configuration-in-debian-etch/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
