在Linux上搭建VisualSVN Server(svn服务端)
1、检查是否安装了低版本的SVN
# rpm -qa | grep subversion
如果已安装SVN,则会返回版本信息。这时需要卸载旧版本的SVN。
卸载旧版本SVN
# yum remove subversion
2、安装SVN
# yum install subversion
3、代码库创建
[root@iZbp183jt9g03j7yvtwkvsZ svn]# ll total 4 drwxr-xr-x 6 root root 4096 Dec 2 10:19 sjzt [root@iZbp183jt9g03j7yvtwkvsZ svn]# svnadmin create /opt/svn/test [root@iZbp183jt9g03j7yvtwkvsZ svn]# ll total 8 drwxr-xr-x 6 root root 4096 Dec 2 10:19 sjzt drwxr-xr-x 6 root root 4096 Dec 2 10:52 test
4、配置代码库
4.1 用户密码passwd配置
[root@iZbp183jt9g03j7yvtwkvsZ conf]# ll total 12 -rw-r--r-- 1 root root 1080 Dec 2 10:52 authz -rw-r--r-- 1 root root 309 Dec 2 10:52 passwd -rw-r--r-- 1 root root 3090 Dec 2 10:52 svnserve.conf [root@iZbp183jt9g03j7yvtwkvsZ conf]# pwd /opt/svn/test/conf [root@iZbp183jt9g03j7yvtwkvsZ conf]# vi passwd [root@iZbp183jt9g03j7yvtwkvsZ conf]# cat passwd ### This file is an example password file for svnserve. ### Its format is similar to that of svnserve.conf. As shown in the ### example below it contains one section labelled [users]. ### The name and password for each user follow, one account per line. [users] # harry = harryssecret # sally = sallyssecret test=test [root@iZbp183jt9g03j7yvtwkvsZ conf]#
4.2 权限控制authz配置
[root@iZbp183jt9g03j7yvtwkvsZ conf]# vi authz [root@iZbp183jt9g03j7yvtwkvsZ conf]# tail -2 authz
[/] test=rw [root@iZbp183jt9g03j7yvtwkvsZ conf]#
4.2 服务svnserve.conf配置
[root@iZbp183jt9g03j7yvtwkvsZ conf]# vi svnserve.conf anon-access = none auth-access = write password-db = passwd. authz-db = authz realm = test
5、启动SVN服务
[root@iZbp183jt9g03j7yvtwkvsZ conf]# svnserve -d -r /opt/svn/
svnserve: E000098: Can't bind server socket: Address already in use
[root@iZbp183jt9g03j7yvtwkvsZ conf]# killall svnserve
[root@iZbp183jt9g03j7yvtwkvsZ conf]# svnserve -d -r /opt/svn/
[root@iZbp183jt9g03j7yvtwkvsZ conf]#
-d [--daemon] : daemon mode
-r [--root] ARG : root of directory to serve
[root@iZbp183jt9g03j7yvtwkvsZ conf]# svnserve --help
usage: svnserve [-d | -i | -t | -X] [options]
Valid options:
-d [--daemon] : daemon mode
-i [--inetd] : inetd mode
-t [--tunnel] : tunnel mode
-X [--listen-once] : listen-once mode (useful for debugging)
-r [--root] ARG : root of directory to serve
-R [--read-only] : force read only, overriding repository config file
--config-file ARG : read configuration from file ARG
--listen-port ARG : listen port
[mode: daemon, listen-once]
--listen-host ARG : listen hostname or IP address
[mode: daemon, listen-once]
-6 [--prefer-ipv6] : prefer IPv6 when resolving the listen hostname
[IPv4 is preferred by default. Using IPv4 and IPv6
at the same time is not supported in daemon mode.
Use inetd mode or tunnel mode if you need this.]
-c [--compression] ARG : compression level to use for network transmissions
[0 .. no compression, 5 .. default,
9 .. maximum compression]
-M [--memory-cache-size] ARG : size of the extra in-memory cache in MB used to
minimize redundant operations.
Default is 128 for threaded and 16 for non-
threaded mode.
[used for FSFS repositories only]
--cache-txdeltas ARG : enable or disable caching of deltas between older
revisions.
Default is no.
[used for FSFS repositories only]
--cache-fulltexts ARG : enable or disable caching of file contents
Default is yes.
[used for FSFS repositories only]
-T [--threads] : use threads instead of fork [mode: daemon]
--foreground : run in foreground (useful for debugging)
[mode: daemon]
--log-file ARG : svnserve log file
--pid-file ARG : write server process ID to file ARG
[mode: daemon, listen-once]
--tunnel-user ARG : tunnel username (default is current uid's name)
[mode: tunnel]
-h [--help] : display this help
--version : show program version information
-q [--quiet] : no progress (only errors) to stderr
6、查看端口,客户端连接
[root@iZbp183jt9g03j7yvtwkvsZ conf]# netstat -anpt|grep svn tcp 0 0 0.0.0.0:3690 0.0.0.0:* LISTEN 28496/svnserve [root@iZbp183jt9g03j7yvtwkvsZ conf]#

We only live once, and time just goes by.

浙公网安备 33010602011771号