Create Repository (c)

1. Create a folder in a directory without spaces non-Chinese, as the repository root directory.

  For example: D: \ svnDep

2. Create the repository in the root directory and subdirectories that correspond to specific projects - The purpose of this is to make a SVN server can manage multiple projects simultaneously, rather than set up an SVN server for each project - which is obviously a waste the resources.

  For example: D: \ svnDep \ CRM

    D:\svnDep\ERP

    D: \ svnDep \ OA

3. Create Repository

Project as an example to OA

svnadmin create repository path
 # For example: svnadmin create D: \ svnDep \ OA

The directory structure of the repository Description:

conf: configuration files used by the repository directory

db: storage directory database files stored version of the data

hooks: storage directory repository hooks program

locks: Lock repository directory, database used to track visitors

format: a file storage integers, the integer representing the library hierarchy version

README.txt: Repository Readme

4. Start the server program

SVN server must be running in order to respond to client requests, help us manage project files. So we have to SVN server starts up. There are two ways to start the SVN server, a command-line mode, a Windows service is registered.

(1) command line

# -D represents the background 
# -r repository root 
svnserve -d -r D: \ svnDep

Verify service is started:

SVN server listens on port 3690, open a new cmd window, use the netstat -an command to see if port 3690 is listening
 
Defects command line is: as long as the command line to run the server program a window is closed, the service stops, very convenient, and each boot needs to be started manually. 

(2) Service Mode

注册 Windows 服务需要利用 XP、2000 以上系统自带工具 Service Control,执行文件是 sc.exe,注意这个命令不是 SVN 的命令。 
# MySVNService 服务名
# binpath依次包括:
#     SVN 安装目录\bin\svnserve.exe
#    --service 以服务方式启动 Subversion
#    -r 表示版本库根目录,可以指定单仓库多仓库,这里配置的是多仓库
# start= auto 表示自动启动
# depend= Tcpip    表示依赖 Tcpip 协议
# 特别注意:binpath、start、depend三个参数等号左边都没有空格,右边都有一个空格
sc create MySVNService binpath= "C:\install\Subversion\bin\svnserve.exe --service -r D:\svnDep" start= auto depend= Tcpip
 
在 Win7 及以上系统中,运行该命令需要管理员权限,解决的办法是以管理员身份运行 cmd 命令行窗口即可。
若在防火墙或电脑卫士提示阻止时,选择允许。
此时查看当前系统中的服务,可以看到我们刚刚创建的服务,但此时它还没有启动,如果创建失败,需检查 sc 命令是否正确。
 
停止服务:sc stop MySVNService
删除服务:sc delete MySVNService
 

Guess you like

Origin www.cnblogs.com/myitnews/p/11487697.html