/data/project/demo /data/project/toyix
[root@3c5dc52d25fe ~]# mkdir -p /data/project/demo [root@3c5dc52d25fe ~]# svnadmin create /data/project/demo [root@3c5dc52d25fe ~]# ll /data/project/demo/ total 8 -rw-r--r-- 1 root root 229 Sep 3 08:50 README.txt drwxr-xr-x 2 root root 54 Sep 3 08:50 conf drwxr-sr-x 6 root root 233 Sep 3 08:50 db -r--r--r-- 1 root root 2 Sep 3 08:50 format drwxr-xr-x 2 root root 231 Sep 3 08:50 hooks drwxr-xr-x 2 root root 41 Sep 3 08:50 locks [root@3c5dc52d25fe ~]# mkdir -p /data/project/toyix [root@3c5dc52d25fe ~]# svnadmin create /data/project/toyix/修改文件passwd,设置哪些用户可以访问SVN资源库, 进入上面生成的文件夹conf下,进行配置:
[root@3c5dc52d25fe ~]# vim /data/project/demo/conf/passwd [users] # harry = harryssecret # sally = sallyssecret admin = admin user = 123456 user2 = 123456 demo = demo toyix = 123456 [root@3c5dc52d25fe ~]# vim /data/project/toyix/conf/passwd [users] # harry = harryssecret # sally = sallyssecret admin = admin user = 123456 user2 = 123456 demo = demo toyix = 123456 # 这样创建了几个用户,以上语句必须顶格写,左侧不能留有空格修改authz文件,设置哪些用户有什么权限访问哪些目录
[root@3c5dc52d25fe ~]# vim /data/project/demo/conf/authz [aliases] # joe = /C=XZ/ST=Dessert/L=Snake City/O=Snake Oil, Ltd./OU=Research Institute/CN=Joe Average [groups] # harry_and_sally = harry,sally # harry_sally_and_joe = harry,sally,&joe # [/foo/bar] # harry = rw # &joe = r # * = # [repository:/baz/fuz] # @harry_and_sally = rw # * = r admin = admin,user,user2 定义admin组 [/] @admin = rw admin组中成员可写 toyix = r toyix只读 [root@3c5dc52d25fe ~]# vim /data/project/toyix/conf/authz admin = admin,user,user2 [/] @admin = rw toyix = r 注:所有语句必须顶格写,左侧不能留空格,否则会报错svnserve -d -r /project/demo 或者 /etc/init.d/svnserve restart
1)带 -d 选项即可以作为一个单独的守护进程运行,-r 选项可以指定发布哪个目录下的版本库;
2)一旦服务器运行,就在默认端口3690进行监听,使用 telnet 可以测试到 3690 端口已经开放了
3)若需更改SVN服务默认端口:
查看端口使用情况:netstat -antp
启动svn和指定端口的方法是:svnserve -d --list-port 3700 -r /project/demo
[root@3c5dc52d25fe ~]# svnserve -d -r /data/project/demo [root@3c5dc52d25fe ~]# svnserve -d --listen-port 3700 -r /data/project/toyix [root@3c5dc52d25fe ~]# ps -ef|grep svn root 216 1 0 09:41 ? 00:00:00 svnserve -d -r /data/project/demo root 247 1 0 09:45 ? 00:00:00 svnserve -d --listen-port 3700 -r /data/project/toyix root 291 82 0 10:01 pts/0 00:00:00 grep --color=auto svn [root@3c5dc52d25fe ~]# netstat -tnlp|grep svn tcp 0 0 0.0.0.0:3690 0.0.0.0:* LISTEN 216/svnserve tcp 0 0 0.0.0.0:3700 0.0.0.0:* LISTEN 247/svnserve访问地址 svn://192.168.1.171/data/project/demo svn://192.168.1.171:3700/data/project/toyix
--------------------end