一、安装
Install the package
Install subversion from the official repositories.
Create a repository
Create your repository
mkdir /path/to/repos/ svnadmin create /path/to/repos/repo1
Your initial repository is empty, if you want to import files into it, use the following command.
svn import ~/code/project1 file:///path/to/repos/repo1 --message ‘Initial repository layout‘
Set access policies
Edit the file /path/to/repos/repo1/conf/svnserve.conf and uncomment or add the line under [general]
password-db = passwd
You might also want to change the default option for anonymous users.
anon-access = read
Replace "read" with "write" for a repository that anyone can commit to, or set it to "none" to disable all anonymous access.
Now edit the file /path/to/repos/repo1/conf/passwd
[users] harry = foopassword sally = barpassword
The above defines users harry and sally, with passwords foopassword and barpassword, change it as you like
Start the server daemon
Before you start the server, edit the configuration file:
/etc/conf.d/svnserve
SVNSERVE_ARGS="--root=/path/to/repos"
The --root=/path/to/repos
option set the root of repository tree. If you have multiple repositories use --root=/path-to/reposparent
. Then access independent repositories by passing in repository name in the URL: svn://host/repo1
. make sure that the user has read/write access to the repository files)
Optionally add a --listen-port
if you want a different port, or other options.
By default, the service runs as root. If you want to change that, add a drop-in:
/etc/systemd/system/svnserve.service.d/50-custom.conf
[Service] User=svn
Now start the svnserve.service daemon.
二、注意事项(大坑)
1、如果出现,这样的错误信息,“svnserve: 不能绑定服务器套接字: 地址已经被使用”那先把svnserve进程干掉。具体做法是$ ps -aux | grep svnserve
#查看进程,svnserve的pid为16663
$ kill -9 16663 #干掉svnserve
再次运行$ systemctl start svnserve
但是利用ps -aux查找进程时,没有找到进程。
最后的方式是,kill掉守护进程xinetd,然后重新拉起进程svnserve
2、报Option expected
- svn: E200002: error while parsing config file :/ home/..../svnserve.conf
- svn: E200002: line 19: Option expected
这是因为修改svnserve.conf时,打开注释时,配置的前面有空格,应该顶格写。
修改后即可。
3、ping不通
先看看有没有插网线。
参考:
https://wiki.archlinux.org/index.php/Subversion
http://blog.csdn.net/zxnlmj/article/details/40621279
http://www.mamicode.com/info-detail-1100667.html
http://blog.csdn.net/duguduchong/article/details/8819028