Apache Subversion(SVN)是一个开源版本控制系统,用于管理和跟踪对文件(如源代码,文档和图像)的更改。它允许多个用户同时处理相同的文件,并提供了一个中央存储库,用于存储和跟踪所有更改。
在 Ubuntu 22.04 LTS Jammy Jellyfish 上安装 Apache Subversion
第 1 步。首先,通过在终端中运行以下命令,确保所有系统软件包都是最新的。apt
<span class="pln">sudo apt update sudo apt upgrade</span>
第 2 步。安装阿帕奇。
Subversion 依赖于 Apache,所以首先,我们需要在服务器上安装 Apache。现在运行以下命令来安装 Apache Web 服务器:
<span class="pln">sudo apt install apache2</span>
默认情况下,在 Apache 安装成功完成后,该服务应已启动并运行。可以肯定的是,我们需要重新开始它:
<span class="pln">sudo systemctl enable apache2 sudo systemctl start apache2</span>
有关安装 Apache 的其他资源,请阅读下面的帖子:
- 如何在 Ubuntu Linux √ 上安装 Apache。
第 3 步。在 Ubuntu 22.04 上安装 Apache Subversion。
默认情况下,Subversion 在 Ubuntu 22.04 基础仓库中可用。现在运行以下命令,将最新版本的 Subversion 缓存安装到 Ubuntu 系统中:
<span class="pln">sudo apt install subversion subversion</span><span class="pun">-</span><span class="pln">tools libapache2</span><span class="pun">-</span><span class="pln">mod</span><span class="pun">-</span><span class="pln">svn</span>
之后,启用 Apache 模块并使用以下命令重新启动 Apache:
<span class="pln">sudo a2enmod dav sudo a2enmod dav_svn sudo systemctl restart apache2</span>
第 4 步。在 Ubuntu 22.04 上配置 SVN(Subversion)。
现在我们使用您喜欢的文本编辑器打开以下配置文件:
<span class="pln">nano </span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">apache2</span><span class="pun">/</span><span class="pln">mods</span><span class="pun">-</span><span class="pln">enabled</span><span class="pun">/</span><span class="pln">dav_svn</span><span class="pun">.</span><span class="pln">conf</span>
取消注释以下行:
<span class="tag"><Location</span> <span class="pun">/</span><span class="atn">svn</span><span class="tag">></span><span class="pln"> DAV svn SVNParentPath /var/lib/svn AuthType Basic AuthName "Subversion Repository" AuthUserFile /etc/apache2/dav_svn.passwd Require valid-user </span><span class="tag"></Location></span>
保存并关闭文件,然后重新启动 Apache 以应用更改:
<span class="pln">sudo systemctl restart apache2</span>
接下来,在 Ubuntu 22.04 上创建一个 SVN 存储库。在这里我们将其命名为.为此,您可以使用以下命令:idroot-repo
<span class="pln">sudo mkdir </span><span class="pun">-</span><span class="pln">p </span><span class="pun">/</span><span class="kwd">var</span><span class="pun">/</span><span class="pln">lib</span><span class="pun">/</span><span class="pln">svn</span><span class="pun">/</span><span class="pln"> sudo svnadmin create </span><span class="pun">/</span><span class="kwd">var</span><span class="pun">/</span><span class="pln">lib</span><span class="pun">/</span><span class="pln">svn</span><span class="pun">/</span><span class="pln">idroot</span><span class="pun">-</span><span class="pln">repo</span>
更改 SVN 存储库的所有权:
<span class="pln">sudo chown </span><span class="pun">-</span><span class="pln">R www</span><span class="pun">-</span><span class="pln">data</span><span class="pun">:</span><span class="pln">www</span><span class="pun">-</span><span class="pln">data </span><span class="pun">/</span><span class="kwd">var</span><span class="pun">/</span><span class="pln">lib</span><span class="pun">/</span><span class="pln">svn sudo chmod </span><span class="pun">-</span><span class="pln">R </span><span class="lit">775</span> <span class="pun">/</span><span class="kwd">var</span><span class="pun">/</span><span class="pln">lib</span><span class="pun">/</span><span class="pln">svn</span>
之后,在文件中创建一个SVN用户。这些用户将使用它来验证 svn 存储库:/etc/apache2/dav_svn.passwd
<span class="pln">sudo htpasswd </span><span class="pun">-</span><span class="pln">cm </span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">apache2</span><span class="pun">/</span><span class="pln">dav_svn</span><span class="pun">.</span><span class="pln">passwd admin</span>
要创建其他用户,您可以使用以下命令:
<span class="pln">sudo htpasswd </span><span class="pun">-</span><span class="pln">m </span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">apache2</span><span class="pun">/</span><span class="pln">dav_svn</span><span class="pun">.</span><span class="pln">passwd idroot_user</span>
第5步。访问 Apache Subversion。
成功设置 Subversion 后,现在打开 Web 浏览器并导航到 。http://your-IP-address/svn/idroot-repo/
感谢您使用本教程在 Ubuntu 22.04 LTS Jammy Jellyfish 系统上安装 Apache Subversion。有关其他帮助或有用信息,我们建议您查看 Apache 官方网站。
<code class=" prettyprinted"></code>