Centos 6.8 svn服务器搭建

来源:互联网 发布:m4男娃数据 编辑:程序博客网 时间:2024/06/06 09:10
1.安装svn服务端
yum install subversion 

2.创建版本库
svnadmin create /home/myrepos

ls -la /home/myrepos/
drwxr-xr-x. 6 root root 4096 7月 8 17:49 .drwxr-xr-x. 3 root root 4096 7月 8 17:49 ..drwxr-xr-x. 2 root root 4096 7月 8 17:49 conf ##存储版本库配置文件的目录drwxr-sr-x. 6 root root 4096 7月 8 17:49 db ##SVN所要管理的所有受版本控制的数据-r--r--r--. 1 root root 2 7月 8 17:49 format ##用来表示版本库布局版本号的整数drwxr-xr-x. 2 root root 4096 7月 8 17:49 hooks ##存储钩子脚本模版的目录drwxr-xr-x. 2 root root 4096 7月 8 17:49 locks ##存储SVN版本库锁定数据的目录-rw-r--r--. 1 root root 229 7月 8 17:49 README.txt


3.配置subversion
上述版本库/home/myrepos建立后在文件夹下会生成conf文件夹,进入/home/myrepos/conf下面会有下面3个文件
  1. authz 
  2. passwd 
  3. svnserve.conf  
 
svnserve.conf修改以下几个部分
  1. anon-access = read  
  2. auth-access = write  
  3. password-db = passwd  
  4. authz-db = authz  
或者
1.anon-access = none                  #非授权用户无法访问 2.auth-access = write                   #授权用户有写权限 3.password-db = passwd           #密码数据所在目录 4.authz-db = authz                      #认证数据所在目录

其它采用默认配置. 各语句都必须顶格写, 左侧不能留空格, 否则会出错.

passwd 修改为
  1. [users]  
  2. username = password    //yujiankd = 123456 这里的username和password自己设置 

authz最后加上以下两行(这两行解决了 SVN客户端解决authorization failed问题)
  1. [/]  
  2. * = rw  

4.启动svnserve即可:
  1. svnserve -d -r /home/myrepos/
 
  1. 查看服务是否启动 
ps aux | grep svnserve
netstat -tunlp | grep svnserve

3. 查看版本信息:
svn --version

svnserve的几个参数说明:
svnserve — serve for the svn repository access method
svnserve allows access to subversion repositaries using the svn network protocol.
-d, --daemon
Causes svnserve to run in daemon mode. svnserve backgrounds itself and accepts
and serves TCP/IP connections on the svn port (3690, by default).
--listen-port=port
Causes svnserve to listen on port when run in daemon mode.
-r root, --root=root
Sets the virtual root for repositaries served by svnserve. The pathname in URLs
provided by the client will be interpreted relative to this root, and will not be allowed
to escape this root.

5.客户端使用:
客户端用svn或者windows下的TortoiseSVN客户端
从服务端checkout版本库(在当前目录下)
  1. svn checkout svn://服务器的ip地址/  
  2. 自己增加一些文件,或者把之前的东西(如下面三个文件夹)拷贝到当前目录下,想让svn帮你管理
code project document 
 
3. 假设我把上述三个文件夹放到当前svn的文件夹下想让svn管理,然后我要做的是添加到svn版本库里:
svn add code project document    //或者直接用svn add * 
 
4. 最后提交到svn服务器
svn commit -m 'import three directories'  


然后跳出验证窗口,输入配置的用户名和密码即可。注意:如果服务器没关闭防火墙就会出现不能连接!

service iptables stop






















0 0