如何在 Debian 11 上安裝 Gitlab


本教程將向您展示如何在 Debian 11 上安裝 Gitlab。對於不了解的人,GitLab 是一個基於 Web 的版本控制系統和基於 Git 的聯合軟件開發。它與 GitHub 非常相似,提供了一個 Git 存儲庫管理器,提供 wiki、問題跟踪、持續集成和部署。 GitLab 在許多 Linux 發行版上都可用。 GitLab 提供免費和付費計劃來幫助您的業務發展。

本文假設您至少具有 Linux 的基本知識,知道如何使用 shell,並且最重要的是,將您的網站託管在您的 VPS 上。安裝非常簡單,假設您在 root 帳戶下運行。如果沒有,您需要添加一個’。sudo‘獲取root權限的命令。 我將逐步解釋在Debian 11(Bullseye)上安裝Gitlab。

在 Debian 11 Bullseye 上安裝 Gitlab

步驟 1. 在安裝軟件之前,運行以下命令以確保您的系統是最新的。 apt 終端命令:

sudo apt update
sudo apt upgrade
sudo apt install curl ca-certificates apt-transport-https gnupg2

步驟 2. 在 Debian 11 上安裝 Gitlab。

Gitlab 默認在基於 Debian 11 的存儲庫中不可用。然後使用以下命令將 GitLab 存儲庫添加到您的系統:

curl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | bash

在編寫本教程時,GitLab 軟件包在 Debian 11 上不可用。 編輯 GitLab 源文件並將 Debian 11 代號替換為 Debian 10。

nano /etc/apt/sources.list.d/gitlab_gitlab-ce.list

找到下一行。

deb https://packages.gitlab.com/gitlab/gitlab-ce/debian/ bullseye main
deb-src https://packages.gitlab.com/gitlab/gitlab-ce/debian/ bullseye main

利用。 .. ..不包括:

deb https://packages.gitlab.com/gitlab/gitlab-ce/debian/ buster main
deb-src https://packages.gitlab.com/gitlab/gitlab-ce/debian/ buster main

保存並關閉它,然後使用以下命令安裝 GitLab:

sudo apt update
sudo apt install gitlab-ce

步驟 3. 配置 Gitlab。

需要編輯 gitlab.rb 找到文件 external_url 創建一個字符串並將其編輯為您的服務器的 IP 地址或域。

nano /etc/gitlab/gitlab.rb

更改以下行。

external_url 'https://gitlab.idroot.us'

然後更改以下行以啟用 SSL。

# Enable the Let's encrypt SSL
letsencrypt['enable'] = true

# This is optional to get SSL related alerts
letsencrypt['contact_emails'] = ['[email protected]']

# This example renews every 7th day at 02:00 AM
letsencrypt['auto_renew_hour'] = "5"
letsencrypt['auto_renew_minute'] = "0"
letsencrypt['auto_renew_day_of_month'] = "*/7"

保存並關閉文件。運行以下命令重新配置 Gitlab。

gitlab-ctl reconfigure

步驟 4. 配置您的防火牆。

防火牆用戶可以使用以下命令打開系統上所需的端口。

sudo firewall-cmd --permanent --zone=public --add-service=http 
sudo firewall-cmd --permanent --zone=public --add-service=https 
sudo firewall-cmd --reload

第 5 步:在 Debian 上訪問 Gitlab。

安裝成功後,使用 URL 訪問 GitLab 儀表板 https://gitlab.idroot.us.. 您將被重定向到可以更改 Gitlab 管理員密碼的頁面。

在 Debian 11 Bullseye 上安裝 Gitlab

恭喜! Gitlab 現在已成功安裝。感謝您使用本教程在 Debian 11 Bullseye 上安裝最新版本的 Gitlab。我們鼓勵您查看更多幫助和有用信息。 Gitlab官網..



Source link