1. Introduction to Subversion
Subversion (SVN) is a powerful open source version control tool that supports both Linux and Windows platforms.
SVN can have two access methods, one is a standalone server direct access, that is, the use of the Svnserve command to start the service, access and operation through the Svn://yourdomain.com/project. Another combination of Apache, using the HTTP protocol, through the Http://yourdomain.com/svn/project access and various operations. If the server needs to be shared on the Internet, generally choose the latter way.
This article takes the Windows platform as an example to describe the installation and use of SVN.
2. Subversion server-side configuration
Typically, if you choose SVN Server and Apache HTTP server to install separately, it can be cumbersome to configure.
For simplicity, I chose the collabnet Subversion installation package to build and configure the service. It integrates the functionality required by subversion into a single installation package to facilitate the deployment of subversion services, further extending subversion.
2.1. Download and install the CollabNet Subversion server side
On the collab.net website, download the collabnet Subversion server side, version 1.6.3.
After downloading, follow the prompts to install, the installation process needs to fill in the meta-Library address, in this case, d:/svn_repository.
2.2. Create and import a repository
Two ways: command line or use graphical management tool.
Command line mode:
1. Build the version library dev
Svnadmin Create D:/svn_repository/dev
2. Import the project to the repository
SVN import D:/dev file:///d:/svn_repository/dev/-M "Initial import"
3. Display Repository Contents
SVN list file:///d:/svn_repository/dev/
Using Graphical management tools
1. Download and install TortoiseSVN
TortoiseSVN is a free, open source client for the SVN version control system that integrates seamlessly with the right-click menu of Windows Explorer, making it easy to use.
(Note: The TORTOISESVN version needs to be consistent with the Subversion server version).
After installation, in the Explorer click the right mouse button, the following interface appears:
2. Under e:/svn_repository New Dev folder, select Create Repository here in the right-click menu, creating the management meta-Library.
3. Open Repo-browser, enter file:///D:/svn_repository/dev, and Add folders and files to the meta-Library that require version management. The Repo-browser interface looks like this:
2.3. Start the service to start the standalone service mode
Svnserve–d–r e:/svn_repository/
Access method: Svn://localhost/dev
Start Apache mode
CD D:/program files/collabnet Subversion server/httpd/bin
Httpd.exe
Access method: http://localhost/svn/dev/
2.4. User Rights control management Svnserve Independent service mode
In the new repository folder Dev, go to the Conf subfolder, which has three files configured below.
Master configuration file: svnserve.conf
Remove the comment keyword at the beginning of the following line of content in the file
#没通过验证, there is no permission
#anon-access = None
#通过验证, write permission is available for up to
#auth-access = Write
#验证文件的位置
#password-db = passwd
#权限配置文件的位置
#authz-db = Authz
Permission policy file: Authz
#进行权限分组和定义用户
[Groups]
Group_admin = Admin,root
Group_ Guest = Guest
[/]
@group_admin = RW
[/]
@group_ Guest = R
User password settings file passwd:
[Users]
Admin =123
root=345
guest=001
Apache HTTP Mode
Apache-based rights assignment is required due to the use of Apache's Permissions control module, which is no longer looking for SVN's svnserve.conf configuration information since Apache was started.
1. Create User (htpasswd–cm authfile username)
CD D:/program files/collabnet Subversion server/httpd/bin
HTPASSWD-CM "D:/svn_repository/passwords.auth" admin
After running the command, enter the Admin user password according to the prompt, the system will generate the Passwords.auth file under the d:/svn_repository/folder, and the user password can be stored in encrypted mode after hashing.
Since a file has been generated, we do not have to enter the-c switch when creating a second user.
2. Update Apache httpd.conf parameters
Opens the D:/program files/collabnet Subversion server/httpd/conf/httpd.conf file, found:
<Location/svn>
DAV SVN
Svnparentpath d:/svn_repository
</Location>
The changes are as follows:
<Location/svn>
DAV SVN
Svnparentpath d:/svn_repository
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile "D:/svn_repository/passwords.auth"
Require Valid-user
</Location>
To restart Apache Server, you will need to enter your user name and password to access http://localhost/svn/dev/again.
3. Enhanced transport security with SSL
Through the Apache network link, the repository of code and data can be transmitted over the Internet, in order to avoid the clear-text transmission of data, to achieve secure version control, data transmission can be encrypted. Apache provides SSL-based data transmission encryption module MOD_SSL, with it, the user can use the HTTPS protocol to access the Repository, so as to achieve the encrypted transmission of data. There is an introduction to the relevant content and methods in the Resources section.
3. Integration of Subclipse plug-in with eclipse
The Subclipse plugin is the client management plug-in for SVN under Eclipse, and thanks to its ease of integration in the eclipse environment, the Eclipse platform-based developer can no longer install other SVN client software.
Installation method: Under Eclipse 3.4 Workbench "Help>software Updates" menu, add site and install.
Site Address: http://subclipse.tigris.org/update_1.6.x
After installation, restart Eclipse, in the open perspective can switch to the SVN repository, check out and so on.
If you want to add a new management project, you need a new repository, then you can click a project in the Package Explorer, right-Team->share project ... Can be added into repository.
4. Accessing services over the Internet
Because we install the server is in the LAN, so not set up, the extranet users are not access to our server. To access the Apache service over the Internet, you can map Apache service 80 ports to a port on an extranet IP using router port mapping, and the technology used here is NAT (Network Address translation).
Because different routers set the port mapping method is different, so here is not described in detail, you can refer to the relevant information.
Because the router is set on the map to the intranet, so the intranet is unable to access the port address of the extranet IP to our Apache service, only through the intranet IP access, so it will bring some trouble to our debugging. You can entrust online QQ, MSN Friends to help you access the test, or through the online Proxy service website for access testing, here to provide a site such as: http://www.zqzj.net/.
After setting up, we can access our management Meta-Library through http://extranet ip/svn/dev/.
5. Bind fixed Domain access
If our network is dial-up via ADSL, then the IP will change after each dialing, which will cause trouble for the external network to access our server. So the problem to solve is to use the version control server in the intranet through the domain name binding, so that its external network through fixed domain name can also be accessed.
Peanut shell is a free dynamic domain name analysis software, if you apply for a ***.vicp.net (fictitious) free domain name, and run a peanut shell on your machine, then any person on the Internet can access your computer by ***.vicp.net this domain name! Client access is no longer required to know the real IP address.
See resources for the method of using peanut shells.
Once set up, we can access our management Meta-Library via http://***.vicp.net/svn/dev/.
Resources:
Build a secure version control environment with Apache and Subversion
Windows Subversion Configuration Administrator Guide
Build and configure Subversion server under Windows
Introduction to NAT principle, port mapping method of various ADSL modems and routers
Peanut shells let your computer have its own domain name
[Collected from]http://blog.csdn.net/wu_07/article/details/5058218
Subversion How[reprint]