Set up SVN server
1. Download svn installation package
[root@localhost veris]#yum install subversion
[root@localhost veris]# svnserve --version
svnserve, version 1.6.11 (r934486)
compiled Mar 6 2014, 10:33:29
2. To create a repository:
-
Create a directory for the repository by running the following command:
mkdir -p REPOS_PATH
In this command,
REPOS_PATH
is the absolute path to the local file system.For example:
mkdir –p /svn/svnrepo
-
Create a repository on a given path by running the following command:
svnadmin create REPOS_PATH
In this command
REPOS_PATH
is the absolute path to the local file system.For example:
svnadmin create /svn/svnrepo
Start:
$/etc/init.d/svnserve start
Starting svnserve: [ OK ]
Check:
$ ps -aux | grep svnserve
root 2303 0.0 0.1 8740 824 ? Ss 19:49 0:00 /usr/bin/svnserve --daemon --pid-file=/var/run/svnserve.pid
root 2306 0.0 0.1 4356 740 pts/0 S+ 19:49 0:00 grep svnserve
Stop:
$/etc/init.d/svnserve stop
Stopping svnserve: [ OK ]
OR
Start: $svnserve -d -r /svn/svnrepo (About /svn/svnrepo problem, sometime you can use the path without repository name.like/svn ,sometimes, you should input with repository name, like /svn/svnrepo )
Check: $ps -aux | grep svnserve
root 2865 0.0 0.1 8740 660 ? Ss 21:56 0:00 svnserve -d -r /svn/svnrepo
root 2867 0.0 0.1 4356 744 pts/0 S+ 21:56 0:00 grep svnserve
Stop: $kill -9 2865
4. Until now, the SVN server has been installed, you can verify it on the local computer. I use TortoiseSVN as svn client.
1. Create a folder under your work folder, for example, E:/work/svnrepo(the folder name can be different with the repository)
2. Move the mouse pointer above this folder, and right-click , press "SVN Checkout" -- "SVN Checkout" can download the repository for server.
3. Input the svn://192.168.0.33/svn/svnrepo and Press OK . (you can use your ip to replace this ip).
Note: If you can access the svn server, please check your server firewall and close it.
$/etc/init.d/iptables stop
Until now, you have connected your SVN successfully, but you can't add file or folder because you haven't configure your SVN server. You should add user into SVN sever and grant these user different privilege to modify files.
Configure the SVN Server
Authentication Configuration:
1. Add user
$vim /svn/svnrepo/conf/passwd
and insert "username = passwd" ,like:
admin = 123456 #Admin user who can read and write all directory and files
prodadm = 123456 # Product admin user who can read and write all directory and files under products files
docsadm = 123456 #Document admin user who can read and write all directory and files under documents files.
2. Edit the privilege management file:
$vim /svn/svnrepo/conf/authz ,edit it,like:
[groups] ## Create the user_group
docadm_group = admin,docadm
[/] ## Repository admin have privilege under "/" .Notes: Here, I just grant a user
admin = rw
* = r
[/Documents] ## Documents admin have privilege under the current path. Notes: Here, I grant a group "@groupname"
@docadm_group = rw
* = r
@prodadm_group = rw
* = ## Notes. other people can't access this directory.
Active Authentication Configuration:
Edit svnserve.conf
$vim /svn/svnrepo/conf/svnserve.conf
[general]
anon-access = none
auth-access = write
password-db = /svn/svnrepo/conf/passwd
authz-db = /svn/svnrepo/conf/authz
PS:
After you change the configuration files, the configuration file are available instantly.It is not necessary to restart your svn server.
When we uncomment parameters in svnserve.conf
during
svn server configuration , it leaves a whitespace character before the parameter. Just remove the whitespace character from the parameters you uncommented in svnserve.conf
anon-access = read
auth-access = write
This should resolve the issue.
SVN是基於關係數據庫的(BerkleyDB)或一系列二進制文件的(FS_FS)。一方面這解決了許多問題 (例如,並行讀寫共享文件)以及添加了許多新功能(例如運行時的事務特性。)。然而另一方面,數據存儲由此變得不透明。
基於以上所以你在服務上是找不到你提交的原始文件,因爲svn每次提交做的都是原子提交,所以你在服務器上能找到的都是一些碎片文件.