在Linux和Windows系统上部署SVN服务器的全攻略
<div id="navCategory"><h5 class="catalogue">目录</h5><ul class="first_class_ul"><li>前言</li><li>Linux系统SVN服务器部署<ul class="second_class_ul"><li>1. 安装SVN服务</li><li>2. 创建版本库</li><li>3. 关键配置文件详解</li><li>4. 启动SVN服务</li><li>5. 防火墙配置</li></ul></li><li>Windows系统SVN服务器部署<ul class="second_class_ul"><li>1. 安装VisualSVN Server</li><li>2. 创建版本库</li><li>3. 用户权限管理</li></ul></li><li>多仓库权限控制技巧<ul class="second_class_ul"></ul></li><li>TortoiseSVN客户端配置<ul class="second_class_ul"><li>1. 安装与汉化</li><li>2. 常用操作</li><li>3.清除账户信息</li></ul></li><li>常见问题解决<ul class="second_class_ul"></ul></li><li>结语<ul class="second_class_ul"></ul></li></ul></div><p class="maodian"></p><h2>前言</h2><p>在团队协作开发中,版本控制系统是必不可少的工具。Subversion(SVN)作为一款集中式版本控制系统,因其简单易用、稳定性高而广受欢迎。本文将详细介绍如何在Linux和Windows系统上部署SVN服务器,并配置多仓库权限管理。</p>
<p class="maodian"></p><h2>Linux系统SVN服务器部署</h2>
<p class="maodian"></p><h3>1. 安装SVN服务</h3>
<p>在CentOS/RHEL系统上安装SVN非常简单:</p>
<div class="dxycode"><pre class="brush:bash;">yum install subversion -y
svn --version
# 验证安装</pre></div>
<p style="text-align:center"><img style="max-width:100%!important;height:auto!important;"alt="" height="379" src="https://zhuji.jb51.net/uploads/allimg/20251010/2-251010120221V7.png" width="554" /></p>
<p class="maodian"></p><p class="maodian"></p><h3>2. 创建版本库</h3>
<div class="dxycode"><pre class="brush:bash;">mkdir -p /usr/svn/repositories
svnadmin create /usr/svn/repositories/myproject
chmod -R 755 /usr/svn/repositories</pre></div>
<p class="maodian"></p><h3>3. 关键配置文件详解</h3>
<p>SVN有三个核心配置文件需要修改:</p>
<p>svnserve.conf</p>
<div class="dxycode"><pre class="brush:plain;">
anon-access = none
auth-access = write
password-db = passwd
authz-db = authz</pre></div>
<p>passwd<strong>添加用户</strong></p>
<div class="dxycode"><pre class="brush:plain;">
admin = admin123
dev1 = dev1123</pre></div>
<p style="text-align:center"><img style="max-width:100%!important;height:auto!important;"alt="" height="368" src="https://zhuji.jb51.net/uploads/allimg/20251010/2-251010120221F3.png" width="554" /></p>
<p>authz权限配置文件</p>
<div class="dxycode"><pre class="brush:plain;">[/]
admin = rw
dev1 = r</pre></div>
<p style="text-align:center"><img style="max-width:100%!important;height:auto!important;"alt="" height="501" src="https://zhuji.jb51.net/uploads/allimg/20251010/2-2510101202211a.png" width="554" /></p>
<p class="maodian"></p><h3>4. 启动SVN服务</h3>
<div class="dxycode"><pre class="brush:bash;">svnserve -d -r /usr/svn/repositories</pre></div>
<p class="maodian"></p><h3>5. 防火墙配置</h3>
<p><strong>服务端</strong>确保3690端口开放:</p>
<div class="dxycode"><pre class="brush:plain;">firewall-cmd --zone=public --add-port=3690/tcp --permanent
firewall-cmd --reload</pre></div>
<p><strong>客户端</strong>确保网络、端口通畅</p>
<div class="dxycode"><pre class="brush:bash;">#Telenet IP PORT 替换为自己的服务器IP
Telnet 192.168.1.1 3690</pre></div>
<p>如果是防火墙导致的不同,Linux 防火墙开放端</p>
<p style="text-align:center"><img style="max-width:100%!important;height:auto!important;"alt="" height="305" src="https://zhuji.jb51.net/uploads/allimg/20251010/2-251010120221A2.png" width="554" /></p>
<p class="maodian"></p><h2>Windows系统SVN服务器部署</h2>
<p class="maodian"></p><h3>1. 安装VisualSVN Server</h3>
<p>从https://www.visualsvn.com/server/download/下载安装包</p>
<p>运行安装程序,选择安装目录和仓库位置:Location:为安装目录;Repositories:为版本库目录</p>
<p>完成安装后启动VisualSVN Server Manager</p>
<p style="text-align:center"><img style="max-width:100%!important;height:auto!important;"alt="" height="425" src="https://zhuji.jb51.net/uploads/allimg/20251010/2-251010120223321.png" width="554" /></p>
<p class="maodian"></p><p class="maodian"></p><h3>2. 创建版本库</h3>
<p>右键"Repositories" → "Create New Repository"</p>
<p>输入仓库名称(如myproject)</p>
<p>选择仓库类型(建议选择FSFS)</p>
<p class="maodian"></p><h3>3. 用户权限管理</h3>
<p>右键"Users" → "Create User"</p>
<p>输入用户名和密码</p>
<p>右键仓库 → "Properties" → "Security"添加用户权限</p>
<p class="maodian"></p><h2>多仓库权限控制技巧</h2>
<p>对于需要管理多个仓库的场景,建议:</p>
<p>将所有仓库放在同一父目录下</p>
<p>使用统一的passwd和authz文件</p>
<p>在authz中按仓库路径设置权限:</p>
<div class="dxycode"><pre class="brush:plain;">
admin = rw
dev1 = r
dev2 = rw</pre></div>
<p class="maodian"></p><h2>TortoiseSVN客户端配置</h2>
<p class="maodian"></p><h3>1. 安装与汉化</h3>
<p>从https://tortoisesvn.net/downloads.html下载安装包</p>
<p>下载对应版本的中文包https://tortoisesvn.net/downloads.html</p>
<p style="text-align:center"><img style="max-width:100%!important;height:auto!important;"alt="" height="302" src="https://zhuji.jb51.net/uploads/allimg/20251010/2-251010120223L6.png" width="553" /></p>
<p>安装后右键 → TortoiseSVN → Settings → Language选择中文</p>
<p style="text-align:center"><img style="max-width:100%!important;height:auto!important;"alt="" height="625" src="https://zhuji.jb51.net/uploads/allimg/20251010/2-251010120223647.png" width="554" /></p>
<p style="text-align:center"><img style="max-width:100%!important;height:auto!important;"alt="" height="384" src="https://zhuji.jb51.net/uploads/allimg/20251010/2-251010120224b2.png" width="554" /></p>
<p class="maodian"></p><h3>2. 常用操作</h3>
<p>检出仓库:右键 → SVN检出</p>
<p>提交更改:右键 → SVN提交</p>
<p>更新代码:右键 → SVN更新</p>
<p class="maodian"></p><h3>3.清除账户信息</h3>
<p style="text-align:center"><img style="max-width:100%!important;height:auto!important;"alt="" height="497" src="https://zhuji.jb51.net/uploads/allimg/20251010/2-251010120225406.png" width="554" /></p>
<p class="maodian"></p><h2>常见问题解决</h2>
<p><strong>连接被拒绝</strong>:检查防火墙和svnserve是否运行</p>
<p><strong>认证失败</strong>:确认passwd文件中的用户名密码正确</p>
<p><strong>权限不足</strong>:检查authz文件中的权限设置</p>
<p class="maodian"></p><h2>结语</h2>
<p>通过本文的指导,您应该已经成功在Linux或Windows系统上部署了SVN服务器,并配置了多仓库权限管理。SVN作为成熟的版本控制系统,能够很好地满足中小团队的版本管理需求。如需更高级的功能,可以考虑结合CI/CD工具实现自动化部署。</p>
<p><strong>提示</strong>:定期备份您的SVN仓库数据,可以使用<code>svnadmin dump</code>命令导出仓库内容。</p>
<p>以上就是Linux/Windows SVN服务器部署全攻略:从安装到多仓库权限管理的详细内容,更多相关资料请阅读琼殿技术社区其它文章!</p>
頁:
[1]