溫馨提示×

GitLab在Linux上如何配置

小樊
70
2025-03-12 14:46:12
欄目: 智能運維

在Linux上配置GitLab可以通過以下步驟完成:

  1. 安裝依賴包: 對于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
    
  2. 下載并安裝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
    
  3. 配置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
    
  4. 啟動和啟用GitLab服務: 啟動GitLab服務:

    sudo gitlab-ctl start
    

    設置GitLab開機自啟:

    sudo systemctl enable gitlab
    
  5. 訪問GitLab: 在瀏覽器中訪問服務器的IP地址或域名,即可看到GitLab的登錄界面,使用管理員賬號和密碼進行登錄。

希望這些步驟能幫助你成功在Linux上配置GitLab。如果有任何問題,請參考GitLab官方文檔或相關教程。

0
亚洲午夜精品一区二区_中文无码日韩欧免_久久香蕉精品视频_欧美主播一区二区三区美女