First, installation
1. See if CVS is installed
Rpm-qa | grep subversion
2. Installation
Yum Install Subversion
3. Test whether the installation is successful
/usr/bin/svnserve--version
If you are prompted for the following, the installation is successful
--------------------------------------
Svnserve, Version 1.6.11 (r934486)
Compiled at Apr 11 2013,17:28:04
Copyright (C) 2000-2009 CollabNet.
Subversion is an open source software, see the http://subversion.tigris.org/site.
This product contains software developed by CollabNet (http://www.Collab.Net/).
The following repository back-end (FS) modules are available:
* Fs_base: The module can only operate the BDB repository.
* FS_FS: The module works with a text file (FSFS) repository.
Cyrus SASL certification is available.
--------------------------------------------------------------
Second, the configuration
1, create a new version of the warehouse (using Svnadmin creates the Directory warehouse path)
Svnadmin Create/web_data/svndata/project
2. Modify the SVN repository configuration file
Vi/web_data/svndata/project/conf/svnserve.conf
Modified in the following format, where the value of realm is the project name, in this case project.
[General]
Anon-access = None
auth-access = Write
Password-db =/opt/svndata/project/conf/passwd
Authz-db =/opt/svndata/project/conf/authz
Realm = Repos
Note: Changes to the user profile take effect immediately and do not have to restart SVN.
3. Add Users
vi/web_data/svndata/project/conf/passwd
To add SVN users is very simple, just add a "Username=password" entry in the/web_data/svn/project/conf/passwd file.
For testing, I added the following:
[Users]
# Harry = Harryssecret
# sally = Sallyssecret
PM = PM_PW
Server_group = SERVER_PW
Client_group = CLIENT_PW
Test_group = TEST_PW
4. Modify the user access policy
Vi/web_data/svndata/project/conf/authz
To record the user's access policy, the following is a reference:
[Groups]
project_p = PM
project_s = Server_group
Project_c = Client_group
project_t = Test_group
[project:/]
@project_p = RW
* =
[Project:/server]
@project_p = RW
@project_s = RW
* =
[Project:/client]
@project_p = RW
@project_c = RW
* =
[Project:/doc]
@project_p = RW
@project_s = RW
@project_c = RW
@project_t = RW
* =
The above information indicates that only PM has the root directory read and write rights, Server_group can access the server directory, Client_group can access the client directory, everyone can access the doc directory.
Of course, the above is more complex permissions control, if only testing, can be simpler. Set up a user group, put all the users into a user group, as follows:
[Groups]
admin = Pm,server_group,client_group,test_group
[/]
@admin = RW
Third, start SVN
First go to the SVN installation directory, for example, you are installed under/HOME/SVN.
Then go to the Bin directory, where you can see a file called Svnserve, we need to use this to start the SVN service.
Try Svnserve--help, see the Help group for this command, which has-D and-R, respectively, representing the background run and the Data Warehouse directory.
The Data Warehouse directory represents the place where you save the data, as you save the project's information under/home/svndata, and this svndata is your Data Warehouse directory.
You can start by figuring this out:
Enter the command:
Svnserve-d-r/home/svndata
The back one is going with your own data Warehouse directory.
So we started SVN, and SVN listens to 3690 by default.
Sometimes we need to change the listening port, then we need to set up a listening port, according to the following command:
Svnserve--listen-port 9999-d-r/opt/svndata
So we change the listening port to 9999, of course you can also change 9999 to the port you want to listen to-
Iv. Testing the SVN server
Go to the Web site root directory
Cd/www/web/repos/public_html
SVN co svn://127.0.0.1:3690/project/www/web/repos/public_html--username pm--password PM_PW
The following authentication prompts will appear
Save unencrypted password (yes/no)?
Enter "Yes", because the repository has not yet added any files, so check out the version is 0, as follows:
Remove version 0.
V. Configure POST-COMMIT to automate the synchronization of SVN repository files to the web directory
Add the SVN bin directory to the environment variable vi/etc/profile adding export path= "$PATH:/usr/bin/svn" Save exit and run Source/etc/profile Line Svnserve--version See if it takes effect
In order for the Web server to synchronize directly after the modified code has been submitted to the SVN server. You need to configure SVN hooks into the hooks directory,
Cd/web_data/svndata/project/hooks
Ls
You can see that there is a Post-commit.tmpl file, which is a template file that is copied and placed under this directory, named Post-commit
VI post-commit #!/bin/bash export lang= "ZH_CN. UTF-8 "svn update/web_data/ww/--username zmk--password xxx last chmod 777 Post-commit #别忘记了修改这个脚本的执行权限
Linux installation SVN server does not use Apache