在Linux上配置GitLab可以通過以下步驟完成:
安裝依賴包: 對于Ubuntu/Debian系統,使用以下命令安裝依賴包:
sudo apt-get update
sudo apt-get install -y curl openssh-server ca-certificates postfix
對于CentOS/RHEL系統,使用以下命令安裝依賴包:
sudo yum install -y curl policycoreutils-python openssh-server postfix
下載并安裝GitLab: 使用以下命令下載GitLab安裝腳本:
curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
或者對于CentOS/RHEL系統:
curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
安裝GitLab:
sudo apt-get install gitlab-ce # 對于Ubuntu/Debian
或者
sudo yum install gitlab-ce # 對于CentOS/RHEL
配置GitLab: 設置外部URL以指定GitLab訪問的地址:
sudo gitlab-ctl reconfigure
例如:
external_url 'http://your-server-ip:port'
修改默認管理員密碼:
sudo gitlab-rails console production
User.where(id: 1).first.password = 'new_password'
User.where(id: 1).first.password_confirmation = 'new_password'
User.where(id: 1).first.save!
exit
啟動和啟用GitLab服務: 啟動GitLab服務:
sudo gitlab-ctl start
設置GitLab開機自啟:
sudo systemctl enable gitlab
訪問GitLab: 在瀏覽器中訪問服務器的IP地址或域名,即可看到GitLab的登錄界面,使用管理員賬號和密碼進行登錄。
希望這些步驟能幫助你成功在Linux上配置GitLab。如果有任何問題,請參考GitLab官方文檔或相關教程。