Build a Subversion server in Windows
I. Preparations
1. Obtain the Subversion serverProgram
Download the latest server installer from the official website (http://subversion.tigris.org. Currently the latest version is 1.5, specific in: http://subversion.tigris.org/servlets/ProjectDocumentList? Folderid = 8100 & expandfolder = 8100 & folderid = 91
2. Obtain the tortoisesvn client program
Get the latest tortoisesvn from the official website http://tortoisesvn.net/downloads. Tortoisesvn is a client program used to communicate with the subvers server. Subversion comes with a client program svn.exe, but tortoisesvn provides better operations and improves efficiency.
Ii. Install the server and client
Install the subversion (SVN) server and client. The downloaded Server is a zip package, which can be decompressed directly. For example, I can decompress the package to E: \ subversion. The Client installation file is an EXE executable file. You can directly run the file and follow the prompts to install it. After the Client installation is complete, the system prompts you to restart.
3. Create a version Library (repository)
To run the Subversion server, you must first create a version Library (repository ). The version library can be seen as a place where data is centrally stored and managed on servers.
Create a version library. First, create an empty E: \ SVN folder as the root directory of all version libraries. Then, go to the command line and switch to the bin directory of subversion. Run the following command:
Svnadmin create E: \ SVN \ repos1
This command creates a version library repos1 under E: \ SVN. Some folders and files are automatically generated under repos1.
We can also use tortoisesvn to perform this step graphically:
First, create an empty directory e: \ SVN \ repos1. Note that it must be empty. In the repos1 folder, right-click and choose tortoisesvn> Create repository here... ", then you can select the version library mode. Here you can use the default fsfs, and then create a series of folders and files, which are the same as those created on the command line.
4. Run an independent server
At this time, the Subversion service has not started yet, but the version library has been created through its command. Enter the following in the Command window:
Svnserve.exe -- daemon
Svnserve will wait for the request on port 3690, and the -- daemon (two dashes) Option tells svnserve to run in daemon mode, so that it will not exit before manual termination. Do not close the command line window. Close the window will stop svnserve.
To verify that svnserve works properly, use tortoisesvn-> repo-browser to view the version library. In the pop-up URL dialog box, enter:
SVN: // localhost/SVN/repos1
Click "OK" to view the directory tree structure of the repos1 version library, but repos1 is an empty database.
You can also use the -- root option to set the root location to restrict the access directory of the server, so as to increase security and save time for inputting the svnserve URL:
Svnserve.exe -- daemon -- root drive: \ path \ To \ Repository
In the previous test, svnserve runs as follows:
Svnserve.exe -- daemon -- root E: \ SVN
Then the browser URL in tortoisesvn is reduced:
SVN: // localhost/repos1
5. Configure users and permissions
Open the E: \ SVN \ repos1 \ conf directory in the text editor and modify svnserve. conf:
Set:
# Password-DB = passwd
Changed:
Password-DB = passwd
Remove the # annotator. Note that there is no space before it.
Then modify the passwd file in the same directory and add an account:
Set:
[Users]
# Harry = harryssecret
# Sally = sallyssecret
Add an account:
[Users]
# Harry = harryssecret
# Sally = sallyssecret
Test = test
Vi. initialize Import
The following describes how to import our data (project) to this version library and manage our data in the future. Any of our changes are recorded by the version library. Even if we lose or correct the data, the version library can help us retrieve the data.
For example, I have a guestbook folder under D: \ wwwroot, which stores the message book program I wrote. In this folder, right-click "-> tortoisesvn-> Import..." And enter "SVN: // localhost/repos1/Guestbook" in "URL of repository" in the pop-up dialog box ". In "Import message", enter "import entire message book" as the comment.
After clicking OK, enter the account. Enter test in both the user name and password. After completion, all content in the guestbook is imported to SVN: // localhost/SVN/repos1/guestbook.
We can see that there is no change in E: \ SVN \ repos1, and even a guestbook folder is not created. The only change is that the capacity of E: \ SVN \ repos1 has increased. In fact, the content in the source guestbook has already been imported into the repos1 version library, and the source guestbook folder can be deleted.
Note that this step can be performed on another client with tortoisesvn installed. For example, if the IP address of the host running svnserve is 133.96.121.22, the content entered in the URL section is "SVN: // 133.96.121.22 ".
VII. Basic operation procedure
1. Check out)
Extract the version library to a working copy:
To any empty directory, such as creating an empty folder F: \ work in partition F. Right-click and choose SVN checkout ". In "URL of repository", enter "SVN: // localhost/SVN/repos1/Guestbook" to get a copy of the content in the guestbook.
2. Check in/commit)
Make changes in the work copy and submit:
In the copy of the guestbook job, open a file and modify it. Right-click and choose SVN commit ...". In this way, the modifications are submitted to the version library, which stores the submitted data as needed.
Right-click the modified file and choose tortoisesvn> show log to view all submissions to the file. Right-click different revision entries and choose "compare with working copy". We can compare the differences between the files that work copies and the selected revision version.