svn 代码库创建 简单手册

  因为工作需要,搞了段时间的svn,在 Linux 上安装的!现在整理资料的时候偶然看到了,给大家参考一下,想起当初我配置的时候,只有网上一点资料可寻,更郁闷的是有好多细节问题是很难着参考的,特别是在 Linux下,现在贴出来,也只是给些参考,兴许能解燃眉之急。
===================================================
Linuxe版本:SUSE Linux Enterise Server


tar xfj httpd-2.2.4.tar.bz2
cd httpd-2.2.4
./buildconf
./configure --enable-dav --enable-so --enable-maintainer-mode  //编译时加载*.so文件
make
make install

=====================
tar xfj subversion-1.4.3.tar.bz2
tar xfj subversion-deps-1.4.3.tar.bz2   //subversion-deps的文件也会解压到subversion-1.4.3目录中
cd subversion-1.4.3
rm -rf apr
rm -rf apr-util
ln -s /home/tmp/httpd-2.2.4/srclib/apr apr
ln -s /home/tmp/httpd-2.2.4/srclib/apr-util apr-util
./configure --with-apxs=/usr/local/apache2/bin/apxs
rm /usr/local/lib/libsvn*  //如果之前有安装过svn版本,才执行该句
make clean && make && make install
=====================
创建SVN库:

cd /home/svn
chmod 777 /home/svn -R    //设置版本库的权限
svnadmin create repo1

在Apache 的配置文件httpd.conf中加入以下代码,Apache中就可以配置好一个虚拟主机svn.mydomain.net,并把该域名下的根路径配置给 Subversion。通过AuthzSVNAccessFile和AuthUserFile指令分别配置SVN用户的用户名和密码文件。

<virtualhost *:80>
DocumentRoot /home/svn/htdocs  //根据配置 "/home/svn/htdocs" 不同配置不同,找到httpd.conf中 DocumentRoot,用DocumentRoot所指路径替换该处路径
<directory />
Options Includes
AllowOverride All
Order allow,deny
Allow from all
</directory>

<location />
DAV svn
SVNParentPath /home/svn  //库的根路径
AuthzSVNAccessFile /home/svn/svnroot/conf/accessfile
Require valid-user
AuthType Basic
AuthName "Subversion System"
AuthUserFile /home/svn/svnroot/conf/passwdfile
</location>

ServerName svn.mydomain.net
DirectoryIndex index.html
</virtualhost>
==========================
创建文件accessfile
路径就是httpd.conf中AuthzSVNAccessFile所指的/home/svn/svnroot/conf/accessfile



[groups]
user = jarod
anonymous = guest
[/]
* = r
@user = rw
@anonymous = r

再用htpasswd命令创建/home/svn/svnroot/conf/passwdfile文件:


htpasswd -c /home/svn/svnroot/conf/passwdfile 用户名 // 创建第一个用户时加 -c,以后不用加,因为要生成passwdfile文件
# 这时会提示输入密码

*******************************
因为在客户端登录时 保存了密码,所以,
如果要切换客户端用户,可删除改目录下的文件
C:\Documents and Settings\yankun\Application Data\Subversion\auth\svn.simple

====================================================================================

启动SVN:
server01:// # ls
.rnd  bin  boot  dev  etc  home  lib  lost+found  media  mnt  opt  proc  root  sbin  server  srv  subdomain  sys  tftpboot  tmp  usr  var
server01:// # cd usr/loacl/apache2
-bash: cd: usr/loacl/apache2: No such file or directory
server01:// # clear
server01:// # ls
.rnd  bin  boot  dev  etc  home  lib  lost+found  media  mnt  opt  proc  root  sbin  server  srv  subdomain  sys  tftpboot  tmp  usr  var
server01:// # cd usr
server01://usr # ls
X11  X11R6  bin  games  i586-suse-linux  include  lib  local  sbin  share  src  tmp
server01://usr # cd local/apache2
server01://usr/local/apache2 # cd bin
server01://usr/local/apache2/bin # ls
ab         apr-1-config  apxs      dbmmanage  envvars-std   htdbm     htpasswd  httxt2dbm   rotatelogs
apachectl  apu-1-config  checkgid  envvars    htcacheclean  htdigest  httpd     logresolve
server01://usr/local/apache2/bin # ./apachectl start



猜你喜欢

转载自kunyu0000.iteye.com/blog/290278