Subversion 快速入门指南


安装 Subversion



如果读者还不熟悉版本控制,以及在Subversion和CVS中使用的“拷贝-修改-合并”模型这些基础的概念,那么建议在进一步学习之前,首先阅读第 1 章 基本概念

安装 Subversion

Subversion是基于APR构建的。APR全称为Apache Portable Runtime library,是一个移植性很好的程序库。APR库提供了全部与操作系统相关的操作接口,如磁盘访问、内存管理等等,这使得Subversion自身能够在不加修改的情况下运行于不同的操作系统之上。Subversion对APR的依赖并不意味着必须使用Apache作为它的网络服务器程序,相反,Apache只是Subversion支持的网络服务器程序之一。APR是一个独立的程序库,任何应用程序都可以使用它(Apache也是基于它开发的)。这就是说,Subversion能够在所有可运行Apache服务器的操作系统上运转,如Windows、Linux、各种BSD、Mac OS X、Netware等等。

The easiest way to get Subversion is to download a binary package built for your operating system. Subversion's web site ( often has these packages available for download, posted by volunteers. The site usually contains graphical installer packages for users of Microsoft operating systems. If you run a Unix-like operating system, you can use your system's native package distribution system (RPMs, DEBs, the ports tree, etc.) to get Subversion.

Alternately, you can build Subversion directly from source code, though it's not always an easy task. (If you're not experienced at building open source software packages, you're probably better off downloading a binary distribution instead!) From the Subversion web site, download the latest source-code release. After unpacking it, follow the instructions in the INSTALL file to build it. Note that a released source package may not contain everything you need to build a command-line client capable of talking to a remote repository. Starting with Subversion 1.4 and later, the libraries Subversion depends on (apr, apr-util, and neon) are distributed in a separate source package suffixed with -deps. These libraries are now common enough that they may already be installed on your system. If not, you'll need to unpack the dependency package into the same directory where you unpacked the main Subversion source. Regardless, it's possible that you may want to fetch other optional dependencies such as Berkeley DB and possibly Apache httpd. If you want to do a complete build, make sure you have all of the packages documented in the INSTALL file.


$ svn checkout subversion
A    subversion/HACKING
A    subversion/INSTALL
A    subversion/README
A    subversion/
A    subversion/build.conf

The preceding command will create a working copy of the latest (unreleased) Subversion source code into a subdirectory named subversion in your current working directory. You can adjust that last argument as you see fit. Regardless of what you call the new working copy directory, though, after this operation completes, you will now have the Subversion source code. Of course, you will still need to fetch a few helper libraries (apr, apr-util, etc.)—see the INSTALL file in the top level of the working copy for details.

[57] Note that the URL checked out in the example ends not with svn, but with a subdirectory thereof called trunk. See our discussion of Subversion's branching and tagging model for the reasoning behind this.