在Debian系統上配置GitLab倉庫需要經過以下幾個步驟:
添加GitLab官方APT倉庫:
sudo curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
更新APT包列表:
sudo apt-get update
安裝GitLab Community Edition (CE):
sudo apt-get install gitlab-ce
啟動并啟用GitLab服務:
sudo systemctl start gitlab
sudo systemctl enable gitlab
訪問GitLab:
打開瀏覽器,訪問 http://<your_server_ip>
,按照提示完成初始設置。
如果你更喜歡使用Docker,可以按照以下步驟操作:
安裝Docker:
sudo apt-get update
sudo apt-get install docker.io
啟動Docker服務:
sudo systemctl start docker
sudo systemctl enable docker
添加GitLab Docker倉庫:
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
安裝GitLab容器:
sudo EXTERNAL_URL="http://<your_server_ip>" apt-get install gitlab-ce
啟動并啟用GitLab容器:
sudo gitlab-ctl start
sudo gitlab-ctl enable
訪問GitLab:
打開瀏覽器,訪問 http://<your_server_ip>
,按照提示完成初始設置。
登錄GitLab:
使用瀏覽器訪問 http://<your_server_ip>
,使用默認用戶名 root
和密碼(初始密碼可以在安裝完成后通過郵件獲?。┑卿?。
創建新項目:
點擊右上角的 New project
按鈕,填寫項目名稱、描述等信息,然后點擊 Create project
。
為了安全地訪問GitLab倉庫,建議配置SSH密鑰:
生成SSH密鑰(如果還沒有):
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
將SSH公鑰添加到GitLab:
cat ~/.ssh/id_rsa.pub
Settings
-> SSH Keys
。測試SSH連接:
ssh -T git@<your_server_ip>
git clone git@<your_server_ip>:<username>/<project_name>.git
cd <project_name>
git add .
git commit -m "Initial commit"
git push origin master
通過以上步驟,你就可以在Debian系統上成功配置并使用GitLab倉庫了。