1,环境centos72,安装svnyuminstallsubversion查看版本svnserve--version3,创建版本库先createdirectorymkdir/var/svncreateversionlibrarycd/var/svnsvnadmincreate/var/svn/svnreposcdsvnrepos会看到自动生成的repository文件:subversion目录说明:db目录:是所有版本控制数据存放文件。hooks目录:hook脚本文件所在的目录。locks目录:用于放置subversionseehardlock数据的目录,用于跟踪访问文件存储库的客户端。formatfile:文本文件,只包含一个整数,表示当前文件库配置的版本号。conf目录:是这个仓库的配置文件(仓库的用户访问账号,权限等)。进入conf目录(svn仓库配置文件)cdconf/authz文件为权限控制文件passwd为账号密码文件svnserve.confSVN服务配置文件setaccountpasswordvipasswd在[users]块中添加用户和密码,格式:account=password,例如:dennis=0454setpermissionsviauthz在末尾添加如下代码:[/]dennis=rw(r:read,w:write)修改svnserve.conf文件visvnserve.conf打开以下注意事项:anon-access=read#匿名用户可以读auth-access=write#授权用户可以写password-db=passwd#哪个文件作为账户文件authz-db=authz#哪个文件作为账户文件permissionfilerealm=/var/svn/svnrepos#认证空间名,版本库所在目录启动svn版本库svnserve-d-r/var/svn/svnrepos停止SVN命令killallsvnserve使用ps-ef|grepsvn查看服务是否开启关键是现在我的nginx运行文件(/usr/local/nginx/html)和svn的运行文件(/usr/bin/svn)不在一起,所以a应该写钩子来链接它们。在svn所在的hooks文件夹下新建一个post-commit文件,然后在文件中写入:#!/bin/shexportLANG=en_US.UTF-8SVN=/usr/bin/svnWEB=/usr/local/nginx/html$SVNupdate$WEB--usernamedennis--password0454写入后执行:chmod777/var/svn/svnrepos/hooks/post-commit关闭svnserve:killallsvnserve启动svnserve:svnserve-d-r/var/svn/svnrepos接下来在nginx所在的运行文件(/usr/local/nginx/html)中执行svncheckoutsvn://IP/svnupdate
