[Linux] GitLab 安裝示範

主機環境

筆者在 GitLab 官網的安裝要求說明頁面上只有看到每秒 20 個 API 請求、兩個網頁請求、2 個 Git Pull 、 1 個 Git Push 、總共 1,000 個使用者的情況下需要 8 CPU, 16 GB RAM 。不過筆者在安裝的環境是非常小氣,只有給予 2 CPU, 4 GB RAM, 50 GB 儲存空間的 Linux , 使用作業系統是 Ubuntu 24.04 的 Server 版(minimized)。 更新套件清單:
    
sudo apt-get update
    

安裝必要依賴套件:
    
sudo apt-get install -y curl openssh-server ca-certificates tzdata perl
    

使用 GitLab 官方腳本安裝 GitLab 套件依賴、將 GitLab 套件加入套件清單中
    
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.deb.sh | sudo bash
    

指定 IP 並安裝 GitLab
註:需要替換 IP,如果使用 https + domain ,例如 https://mydomain.com ,則會自動使用 Let's Encrypt 服務建立憑證:
    
sudo EXTERNAL_URL="http://192.168.0.42" apt-get install gitlab-ee
    

可以在以下路徑中找到 root 的密碼:
註: 該檔案只會存在 24 小時
    
cat /etc/gitlab/initial_root_password
    

範例輸出:
    
sudo cat /etc/gitlab/initial_root_password
[sudo] password for ruyut:
# WARNING: This value is valid only in the following conditions
#          1. If provided manually (either via `GITLAB_ROOT_PASSWORD` environment variable or via `gitlab_rails['initial_root_password']` setting in `gitlab.rb`, it was provided before database was seeded for the first time (usually, the first reconfigure run).
#          2. Password hasn't been changed manually, either via UI or via command line.
#
#          If the password shown here doesn't work, you must reset the admin password following https://docs.gitlab.com/ee/security/reset_user_password.html#reset-your-root-password.

Password: umOz4TnOcRUYUTpCOMpGITpLABpTESTpPWDkuuEKWc8=

# NOTE: This file will be automatically deleted in the first reconfigure run after 24 hours.
    

密碼就是 umOz4TnOcRUYUTpCOMpGITpLABpTESTpPWDkuuEKWc8=

使用瀏覽器開啟剛剛設定的 EXTERNAL_URL ,例如:
    
http://192.168.0.42
    

就會看到 GitLab 登入的畫面:
預設帳號為 root



參考資料:
GitLab - Reference architectures
GitLab - Reference architecture: Up to 20 RPS or 1,000 users
GitLab - Install GitLab with the Linux package
GitLab - Install self-managed GitLab

留言