现在的位置: 首页 > 综合 > 正文

ubuntu下搭建svn步骤

2012年05月23日 ⁄ 综合 ⁄ 共 2815字 ⁄ 字号 评论关闭

这个是参照了好几篇方法一起的,算是记录一下以免下次再找了。

=================================步骤分割线======================================

ubuntu软件源:
ubuntu下使用apt-get安装软件时,其下载来源取决于软件源,如果直接使用apt-get install subversion不能找到安装的文件的话,可以使用apt-get update更新一下最新的软件源的列表;如果还是无法安装的话,则可能本地配置的软件源里面都没有这个软件,这时就需要替换或更新本地的软件源了。
ubuntu软件源文件的位置:/etc/apt/sources.list,直接修改该文件内容为如下即可。之后需要执行一下apt-get update命令使更改生效。

deb http://mirrors.163.com/ubuntu/ quantal main universe restricted multiverse
deb-src http://mirrors.163.com/ubuntu/ quantal main universe restricted multiverse
deb http://mirrors.163.com/ubuntu/ quantal-security universe main multiverse restricted
deb-src http://mirrors.163.com/ubuntu/ quantal-security universe main multiverse restricted
deb http://mirrors.163.com/ubuntu/ quantal-updates universe main multiverse restricted
deb http://mirrors.163.com/ubuntu/ quantal-proposed universe main multiverse restricted
deb-src http://mirrors.163.com/ubuntu/ quantal-proposed universe main multiverse restricted
deb http://mirrors.163.com/ubuntu/ quantal-backports universe main multiverse restricted
deb-src http://mirrors.163.com/ubuntu/ quantal-backports universe main multiverse restricted
deb-src http://mirrors.163.com/ubuntu/ quantal-updates universe main multiverse restricted

具体可以参考这个文章:
http://blog.sina.com.cn/s/blog_5eaeb24d01019rwg.html

svn安装:

apt-get install subversion
apt-get install subversion-tools
mkdir /home/svn
svnadmin create /home/svn          ##创建svn库的根目录位置

修改svn配置vi /home/svn/conf/svnserve.conf

#匿名访问的权限,可以是read,write,none,默认为read
anon-access = none
#认证用户的权限,可以是read,write,none,默认为write
auth-access = write
#密码数据库的路径,去掉前面的#
password-db = passwd
所有参数必须顶格,否则可能报错;

配置用户和密码:vi /home/svn/conf/passwd,在[users]下添加用户名和密码,如:xiaoming = hello;
启动SVN服务器:终端输入svnserve –d –r /home/svnrepos –listen-host 192.168.2.112(您的SVN服务器IP地址)
具体可以参考这个文章:
http://www.cnblogs.com/mindmac/archive/2012/03/19/2407085.html

svn使用:

svn co svn://192.168.2.112   ##导出
svn up	   ##更新
svn add file.txt	   ##添加要更新的文件
svn ci -m "commit message"  #提交更新的文件

具体可以参考这个文章:
http://www.cnblogs.com/analyzer/archive/2009/08/25/1553424.html

搭建apache服务:

apt-get install apache2
apt-get install libapache2-svn

修改配置文件: /etc/apache2/mods-available/dav_svn.conf 追加以下内容:

<Location /svn >
DAV svn
SVNPath /home/svn
AuthType Basic
AuthName "welcome to subversion repository"
AuthUserFile /etc/subversion/passwd
#<LimitExcept GET PROPFIND OPTIONS REPORT>
Require valid-user
#</LimitExcept>
</Location>

如果需要用户每次登录时都进行用户密码验证,请将 <LimitExcept GET PROPFIND OPTIONS REPORT> 与 </LimitExcept> 两行注释掉。

sudo /etc/init.d/apache2 restart
htpasswd -c /etc/subversion/passwd superman   ##第一次创建认证用户,需要带-c参数
htpasswd /etc/subversion/passwd user_name     ##非第一次就不要了

最后,访问http://localhost/svn/就会弹出一个认证的框,输入你设置的用户名、密码,就可以看到svn库中的内容了。如果认证过后没有立即显示正确,可以多刷新几下。
具体可以参考这个文章:

http://blog.csdn.net/meteors1113/article/details/5431753#_Toc257716627

----------------------------------------------------------------------注意的分割线----------------------------------------------------------------------

还有就是添加用户组的时候需要重启svn服务所在的服务器,不然提交内容时提示失败。500错误

抱歉!评论已关闭.