GitLab 是一个强大的基于 Web 的版本控制和协作平台。它提供了一个多合一的解决方案,用于管理您的软件开发项目,从源代码存储库到问题跟踪和持续集成。为了充分利用 GitLab 的潜力,正确安装它至关重要。
在 Debian 12 书虫上安装 Gitlab
第 1 步。在我们安装任何软件之前,通过在终端中运行以下命令来确保您的系统是最新的非常重要:apt
<span class="pln">sudo apt update sudo apt upgrade</span>
此命令将刷新存储库,允许您安装最新版本的软件包。
第 2 步。安装依赖项。
GitLab 需要特定的依赖项才能正常运行。让我们安装它们:
<span class="pln">sudo apt install curl openssh</span><span class="pun">-</span><span class="pln">server ca</span><span class="pun">-</span><span class="pln">certificates postfix</span>
现在,我们使用以下命令将 GitLab 存储库添加到您的系统中:
<span class="pln">curl https</span><span class="pun">:</span><span class="com">//packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.deb.sh | sudo bash</span>
然后,我使用以下命令停止 GitLab:
<span class="pln">sudo apt update sudo apt install gitlab</span><span class="pun">-</span><span class="pln">ce</span>
在安装过程中,系统可能会提示您配置外部 URL 和电子邮件设置。根据您的环境提供适当的值。
第 4 步。配置 GitLab。
安装完成后,就可以配置 GitLab。打开配置文件:
<span class="pln">sudo nano </span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">gitlab</span><span class="pun">/</span><span class="pln">gitlab</span><span class="pun">.</span><span class="pln">rb</span>
向下滚动到该部分并指定您的 GitLab URL,就像您在安装过程中所做的那样:external_url
<span class="pln">external_url </span><span class="str">'https://your-domain.com'</span>
现在,重新配置 GitLab 以应用更改:
<span class="pln">sudo gitlab</span><span class="pun">-</span><span class="pln">ctl reconfigure</span>
接下来,配置电子邮件设置。这对于接收来自 GitLab 的通知至关重要。打开配置文件:
<span class="pln">sudo nano </span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">gitlab</span><span class="pun">/</span><span class="pln">gitlab</span><span class="pun">.</span><span class="pln">rb</span>
取消注释该部分并提供电子邮件服务器的详细信息:smtp
<span class="pln">gitlab_rails</span><span class="pun">[</span><span class="str">'smtp_enable'</span><span class="pun">]</span> <span class="pun">=</span> <span class="kwd">true</span><span class="pln"> gitlab_rails</span><span class="pun">[</span><span class="str">'smtp_address'</span><span class="pun">]</span> <span class="pun">=</span> <span class="str">"smtp.your-email-provider.com"</span><span class="pln"> gitlab_rails</span><span class="pun">[</span><span class="str">'smtp_port'</span><span class="pun">]</span> <span class="pun">=</span> <span class="lit">587</span><span class="pln"> gitlab_rails</span><span class="pun">[</span><span class="str">'smtp_user_name'</span><span class="pun">]</span> <span class="pun">=</span> <span class="str">"your-email@example.com"</span><span class="pln"> gitlab_rails</span><span class="pun">[</span><span class="str">'smtp_password'</span><span class="pun">]</span> <span class="pun">=</span> <span class="str">"your-email-password"</span><span class="pln"> gitlab_rails</span><span class="pun">[</span><span class="str">'smtp_domain'</span><span class="pun">]</span> <span class="pun">=</span> <span class="str">"your-domain.com"</span><span class="pln"> gitlab_rails</span><span class="pun">[</span><span class="str">'smtp_authentication'</span><span class="pun">]</span> <span class="pun">=</span> <span class="str">"login"</span><span class="pln"> gitlab_rails</span><span class="pun">[</span><span class="str">'smtp_enable_starttls_auto'</span><span class="pun">]</span> <span class="pun">=</span> <span class="kwd">true</span><span class="pln"> gitlab_rails</span><span class="pun">[</span><span class="str">'smtp_tls'</span><span class="pun">]</span> <span class="pun">=</span> <span class="kwd">false</span>
将占位符替换为电子邮件服务器的详细信息。保存文件并再次重新配置 GitLab:
<span class="pln">sudo gitlab</span><span class="pun">-</span><span class="pln">ctl reconfigure</span>
最后,启动 GitLab 并确保它在启动时启动:
<span class="pln">sudo systemctl start gitlab sudo systemctl enable gitlab</span>
第5步。访问 GitLab Web 界面。
打开您的 Web 浏览器并导航到您的 GitLab URL(您之前设置的 URL)。您将看到 GitLab 登录页面。使用默认用户名和密码在安装过程中选择的密码。root
感谢您使用本教程在 Debian 12 书虫上安装最新版本的 Gitlab。有关其他帮助或有用信息,我们建议您查看 Gitlab 官方网站。