背后
书
20100601-平淡的面试和晚点的飞机
收集怪人

现在的位置: 首页经验心得>正文

Subversion安装记录
发表于:2006年09月08日  分类:经验心得  添加评论  13,855 views 

程序版本: Subversion:1.3.2(官方下载) SmartSVN:2.0.6(官方下载)本地下载:[file]/blog/attachment/200609/SmartSVN%202.0.6.rar[/file] SVNService:将Subversion注册为系统服务的东东。本地下载:[file]http://www.namipan.com/d/SmartSVN%202.0.6.rar/e45f97dcef14e35f8caac26f34c8aa893d0a279977462500[/file] TortoiseSVN:1.4.0 RC1(官方下载安装环境: Windows XP-SP2-en 安装过程: 1、安装Subversion。这个过程很简单,默认安装就可以了,没什么可说的。 2、创建Repository(可以理解为代码仓库,其实除了放代码,其他的也可以放的^_^): 通过CMD进入命令行模式,输入下列命令,在d:\SubversionWorkspace\pub这个目录下建立Repository: svnadmin create –fs-type fsfs d:\SubversionWorkspace\pub 注:之所以选择fsfs格式,参考下面的文档中的相关资料 相关文档资料: $ svnadmin create –fs-type fsfs /path/to/repos $ svnadmin create –fs-type bdb /path/to/other/repos Warning Do not create a Berkeley DB repository on a network share—it cannot exist on a remote filesystem such as NFS, AFS, or Windows SMB. Berkeley DB requires that the underlying filesystem implement strict POSIX locking semantics, and more importantly, the ability to map files directly into process memory. Almost no network filesystems provide these features. If you attempt to use Berkeley DB on a network share, the results are unpredictable—you may see mysterious errors right away, or it may be months before you discover that your repository database is subtly corrupted. If you need multiple computers to access the repository, you create an FSFS repository on the network share, not a Berkeley DB repository. Or better yet, set up a real server process (such as Apache or svnserve), store the repository on a local filesystem which the server can access, and make the repository available over a network. Chapter 6, Server Configuration covers this process in detail. 3、添加用户并设置权限。没有做详细研究,请直接参考下面的资料: 转自:http://www.dlog.cn/html/diary/showlog.vm?sid=2&log_id=2009 独立运行的Subversion权限设置很简单,首先打开snvserve.conf,去掉下面一行的注释 authz-db = authz 然后打开同一目录下的authz这个文件,这个文件便是整个权限控制的核心,先来看一个例子: [groups] dev-group = liudong,xfliang design-group = newidea [/] @dev-group = rw @design-group = r * = [/doc] @design-group = rw [/webapp] @design-group = rw 接下来我给大家解释一下这个文件,相信就可以明白Subversion如何来做权限控制的了。 首先我定义了两个组,一个开发组(dev-group),一个设计组(design-group),接下来我让dev-group对整个目录有读写的权限,而design-group只有读权限。但是接下来的两个子目录design-group就有读写权限,也就是说设计组可以读取整个项目,但只能修改doc以及webapp这两个子目录。 *= 这行表示其他人不能读写。当然也可以直接指定某个用户,例如我想让liudong这个用户可以读写webapp目录,那设置如下: [/webapp] @design-group = rw liudong = rw 另外有一点注意的是,修改这个文件不需要重新启动svn服务,这点太棒了。 下面是详细的说明Subversion自带的authz样例中的注释 ### This file is an example authorization file for svnserve. ### Its format is identical to that of mod_authz_svn authorization ### files. ### As shown below each section defines authorizations for the path and ### (optional) repository specified by the section name. ### The authorizations follow. An authorization line can refer to a ### single user, to a group of users defined in a special [groups] ### section, or to anyone using the '*' wildcard. Each definition can ### grant read ('r') access, read-write ('rw') access, or no access ### (''). 4、将Subversion注册为系统服务。将SVNService拷贝到Subversion的安装目录下的bin目录(我这里为:C:\Program Files\Subversion\bin)。然后在CMD中转到刚刚那个目录,运行下列命令: SVNService -install -d -r d:\SubversionWorkspace\ 注:以下是svnserve的命令选项 svnserve [选项] 有效选项: -d [–daemon] : 后台模式 –listen-port 参数 : 监听端口(后台模式) –listen-host 参数 : 监听主机名或IP地址(后台模式) –foreground : 在前台运行(调试时有用) -h [–help] : 显示这个帮助 –version : 显示版本信息 -i [–inetd] : inetd 模式 -r [–root] 参数 : 服务根目录 -R [–read-only] : force read only, overriding repository config file -t [–tunnel] : 隧道模式 –tunnel-user 参数 : 隧道用户名(模式是当前用户UID的名字) -X [–listen-once] : 监听一次(调试时有用) 5、用SmartSVN连接刚刚建好的服务器。根据个人喜好,也可以使用 TortoiseSVN,它更新较快,支持最新的Subversion 1.4.0。 ==

Windows Service Support for svnserve ==================================== svnserve can now be run as a native Windows service. This means that the service can be started at system boot, or at any other time, without the need for any wrapper code to start the service. The service can be managed like any other Windows service, using command-line tools ("net start", "net stop", or sc.exe) or GUI tools (the Services administrative tool). Installation ———— For now, no means is provided to install the service. Most Windows OSes derived from Windows NT (such as Windows XP, Windows 2000, Windows 2003 Server) provide a command-line tool for installing services, called SC.EXE for "Service Control". To create a service for svnserve, use SC.EXE: sc create binpath= "c:\svn\bin\svnserve.exe –service " displayname= "Subversion Repository" depend= Tcpip where is any service name you want, e.g. "svnserve", and are the arguments to svnserve, such as –root, –listen-port, etc. (All of this should be specified on a single line, of course.) In order for svnserve to run as a Windows service, you MUST specify the –service argument, and you must NOT specify any other run mode argument, such as –daemon, –tunnel, –inetd, or any of their short forms. There is no short form for –service. If the path to svnserve.exe contains spaces or other characters that must be escaped, then you must enclose the path to svnserve.exe with double-quotes, which themselves must be quoted using a backslash. Fortunately the syntax is similar to that on Unix platforms: sc create binpath= "\"c:\program files\subversion\bin\svnserve.exe\" …" SC has many options; use "sc /?". The most relevant are: sc create create a new service sc qc query config for a service sc query query status sc delete delete any service — BE CAREFUL! sc config … update service config; same args as sc create sc start start a service (does NOT wait for completion!) sc stop stop a service (does NOT wait for it to stop!) Note that the command-line syntax for SC is rather odd. Key/value pairs are specified as "key= value" (without the double-quotes). The "key=" part must not have any spaces, and
the "value" part MUST be separated from the "key=" by a space. If you want to be able to see the command shell, add these arguments to the "sc create" command-line: type= own type= interact This sets the "interactive" bit on the service, which allows it to interact with the local console session. You can create as many services as you need; there is no restriction on the number of services, or their names. I use a prefix, like "svn.foo", "svn.bar", etc. Each service runs in a separate process. As usual, it is your responsbility as an administrator to make sure that no two service instances use the same repository root path, or the same combination of –listen-port and –listen-host. Uninstalling ———— To uninstall a service, stop the service, then delete it, using "sc delete ". Be very careful with this command, since you can delete any system service, including essential Windows services, accidentally. Also, make sure that you stop the service before you delete it. If you delete the service before stopping it, the Service Control Manager will mark the service "deleted", but will intentionally not stop the service. The service will be deleted when the system reboots, or when the service finally exits. After all, you only asked to delete the service, not to stop it. That's all there is to it. Automatically Starting Service on System Boot ——————————————— By default, SC creates the service with the start mode set to "demand" (manual). If you want the service to start automatically when the system boots, add "start= auto" to the command line. You can change the start mode for an existing service using "sc config start= auto", or also by using the Windows GUI interface for managing services. (Start, All Programs, Administrative Tools, Services, or just run "services.msc" from Start/Run or from a command-line.) Note: In order for svnserve to start correctly on system boot, you must properly declare its startup dependencies. The Service Control Manager will start services as early as it can, and if you do not properly declare its startup dependencies, it can potentially start before the TCP/IP stack has been started. This is why you must provide specify 'depend= Tcpip' to SC.EXE when creating the service. Starting and Stopping the Service ——————————— You start and stop the service like any other Windows service. You can use the command-line "net start ", use the GUI Services interface. Debugging ——— Debugging a Windows service can be difficult, because the service runs in a very different context than a user who is logged in. By default, services run in a "null" desktop environment. They cannot interact with the user (desktop) in any way, and vice versa. Also, by default, services run as a special user, called LocalSystem. LocalSystem is not a "user" in the normal sense; it is an NT security ID (SID) that is sort of like root, but different. LocalSystem typically does NOT have access to any network shares, even if you use "net use" to connect to a remote file server. Again, this is because services run in a different login session. Depending on which OS you are running, you may have difficulty attaching a debugger to a running service process. Also, if you are having trouble *starting* a service, then you can't attach to the process early enough to debug it. So what's a developer to do? Well, there are several ways you can debug services. First, you'll want to enable "interactive" access for the service. This allows the service to interact with the local desktop — you'll be able to see the command shell that the service runs in, see console output, etc. To do this, you can either use the standard Windows Services tool (services.msc), or you can do it using sc.exe. * With the GUI tool, open the properties page for a service, and go to the "Log On" page. Select "Local System account", and make sure the "Allow service to interact with desktop" box is checked. * With SC.EXE, configure the service using the command: sc config type= own type= interact Yes, you must specify type= twice, and with exactly the spacing shown. In both cases, you'll need to restart the service. When you do, if the service started successfully, you'll see the console window of the service. By default, it doesn't print anything out. Next, you'll want to attach a debugger, or configure the service to start under a debugger. Attaching a debugger should be straightforward — just find the process ID. But if you need to debug something in the service startup path, you'll need to have a debugger attached from the very beginning. There are two ways to do this. In the first method, you alter the command-line of the service (called the "binary path"). To do this, use SC.EXE to set the binary path to whatever debugger you are going to use. I use the most recent version of WinDbg, which is excellent, and is available at: http://www.microsoft.com/whdc/devtools/debugging/installx86.mspx For example, this command would configure the service to start under a debugger: sc config binpath= "d:\dbg\windbg.exe -g -G d:\svn\bin\svnserve.exe –root d:\path\root –listen-port 9000" depend= Tcpip The entire command must be on a single line, of course, and the binary path must be in double-quotes. Also, the spacing MUST be: binpath= "…" Substitute whatever debugger you want, with whatever command-line you want, in place of windbg.exe. Then start the service (sc start ), and the Service Control Manager should execute the command-line you provided as the binary path. Then your debugger should start, and should launch the svnserve process. Known Issues ———— * No management tool (installer, etc.). For the first version, this is intentional; we just want to get the service functionality tested and committed before dealing with installation. * Right now, I don't know of a way to cleanly stop the svnserve process. Instead, the implementation closes the listen socket, which causes the main loop to exit. This isn't as bad as it sounds, and is a LOT better than other options (such as terminating a thread). To Do —– * The support for running svnserve as a Windows service is complete, but there is still more work to be done for installing and managing services. from:http://svn.collab.net/repos/svn/trunk/notes/windows-service.txt


评论暂缺

  • (Required)
  • (Required, will not be published)