Installing Subversion
Yum Install Subversion
After installation, the main use of three commands, SVN: This is the SVN client, SVNSERVE:SVN Server, after the start of the SVN command to obtain and modify the source file, SVNADMIN:SVN Server management tools
Create a warehouse
Mkdir-p/var/svn/repos
#创建文件夹
Svnadmin Create/var/svn/repos
#创建svn仓库
After creation, the following files will be generated under/var/svn/repos
Conf db format Hooks Locks README.txt
Conf is where the SVN configuration is stored
DB is the source of storage, if you go to find the source code, here is not found, because SVN is using its own file system, although the source is placed here, but we do not see it (think of it as a database, like database files we can not directly read), these two are more important, Others are interested to know.
Another thing to note is that SVN can create multiple warehouses, and you can create a warehouse svnadmin Create/var/svn/repos2
Configure users
vi/var/svn/repos/conf/passwd
Open the file with VI, you will see the following, the format is ' user = password ', the password is clear (#在linux中是代表注释)
[Users]
# Harry = Harryssecret
# sally = Sallyssecret
Add a user, for example
[Users]
# Harry = Harryssecret
# sally = Sallyssecret
Jan = jan123
Configure user authentication
Vi/var/svn/repos/conf/authz
Add user group, add a line in [groups], format is ' user group = user 1, User 2 '
[Groups]
admin = Jan
dev = Jan
Increase Permissions Configuration
[/]
@admin = RW
* = R
User group Admin user to the root directory and subdirectories have read (r) write (w) permissions, other users have Read permission, ' @ ' matches the meaning of the user group
[/] represents the root directory, which refers to the repository's root directory, which is the repos
Server-side configuration
Vi/var/svn/repos/conf/svnserve.conf
Find these lines and remove the comments
# anon-access = Read
# auth-access = Write
# password-db = passwd
# authz-db = Authz
# realm = My First Repository
If anon-access = read, it means that there is no need to login and Read permission, the Open source project on the Internet generally do not need us to log in we can checkout it out, that is, set this; can also be changed to Anon-access = None, indicating that no login does not have permission, So you have to log in to checkout
Password-db = passwd The user profile used, which means that the user file (/VAR/SVN/REPOS/CONF/PASSWD) We just edited can also be set to another
Authz-db = Authz used by the authentication file (/var/svn/repos/conf/authz), can also be set to other
Realm =/var/svn/repos, which is the directory of the warehouses we created
Start SVN service
Svnserve-d-r/var/svn/
-D represents running as daemon
-R Specify Base directory
Svn://localhost/repos so it can be accessed, but our warehouse is still empty, so you won't see anything
-R relates to the SVN address of the writing, this should pay special attention, if not written, checkout will prompt the address does not exist
Svnserve-d
Corresponding address is Svn://localhost/var/svn/repos
Svnserve-d-r/var/
Corresponding address is Svn://localhost/svn/repos
Svnserve-d-r/var/svn/
Corresponding address is Svn://localhost/repos
Svnserve-d-r/var/svn/repos
Corresponding address is svn://localhost/
If the machine can be checkout, other machines cannot, it is probably a firewall problem, svn default port is 3690, modify the firewall configuration file
Vi/etc/sysconfig/iptables
Add the following line
-A rh-firewall-1-input-m state--state new-m tcp-p TCP--dport 3690-j accep
Restarting the firewall
Service Iptables Restart
Importing project files
[Email protected] svn]# mkdir-p TMP/PROJS/P1
[Email protected] svn]# mkdir-p tmp/projs/p1/trunk
[Email protected] svn]# mkdir-p tmp/projs/p1/branches
[Email protected] svn]# mkdir-p tmp/projs/p1/tags
[Email protected] svn]# mkdir-p tmp/projs/p2/trunk
[Email protected] svn]# mkdir-p tmp/projs/p2/branches
[Email protected] svn]# mkdir-p tmp/projs/p2/tags
[[Email protected] svn]# svn import/var/svn/tmp/projs svn://localhost/repos-m ' first import '
After importing, you will have the following project structure
Svn://192.168.1.103/repos
Svn://192.168.1.103/repos/p1
Svn://192.168.1.103/repos/p1/trunk
Svn://192.168.1.103/repos/p1/branches
Svn://192.168.1.103/repos/p1/tags
Svn://192.168.1.103/repos/p2
Svn://192.168.1.103/repos/p2/trunk
Svn://192.168.1.103/repos/p2/branches
Svn://192.168.1.103/repos/p2/tags
Multi-Warehouse Support
SVN can support multi-warehouse
Svnadmin Create/var/svn/repos
Svnadmin Create/var/svn/repos2
If there are multiple warehouses, the directory that the svnserve-r refers to should contain all the warehouses, or some warehouses will not start
Svnserve-d-r/var/svn/repos
If this is initiated, then REPOS2 will not access
Svnserve-d-r/var/svn/
That way, two warehouses can be activated.
Since each warehouse has its own configuration file, it can be cumbersome to manage, preferably by extracting the Conf directory into the/VAR/SVN directory, allowing both REPOS1 and REPOS2 to use a unified configuration file
This article is from the "All the Way North" blog, please be sure to keep this source http://janan.blog.51cto.com/7466674/1569412
Linux Subversion Service Configuration