騰訊雲Centos安裝gitlab


參考了網上很多人寫的安裝教程,結果並不好,最后閱讀了官方的英文api,才安裝成功,這里記錄下來,方便以后使用。我的安裝環境為騰訊雲主機Centos7.3 64bit

gitlab官方api地址點我試試~

  1. 開啟HTTP和SSH訪問

       yum install -y curl policycoreutils-python openssh-server
      systemctl enable sshd
      systemctl start sshd
      firewall-cmd --permanent --add-service=http
      systemctl reload firewalld
    
  2. 安裝並啟用郵件服務

     yum install postfix
     systemctl enable postfix
     systemctl start postfix
    
  3. 下載並安裝gitlab

     #這里我選擇的是清華大學的鏡像,下載起來比較快一點,我選擇的是最新的版本  
     #https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/
     
     cd /usr/locale/src/
     
     wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-10.0.0-ce.0.el7.x86_64.rpm
     
     rpm -ivh gitlab-ce-10.0.0-ce.0.el7.x86_64.rpm 
    

安裝好之后,會顯示gitlab的圖案,並提示設置外網訪問地址(external_url)

  1. 配置gitlab

     #打開配置文件 gitlab.rb
     [root@VM_177_101_centos gitlab]# vim /etc/gitlab/gitlab.rb
     
     #修改外網訪問地址 13行
     #ip為主機的ip地址,端口默認是8080,這里為了避免出現占用,也進行修改一下,我的配置為9999
     external_url = 'http://ip:prot'
     
     
     
     #修改nginx監聽
     #gitlab默認使用了nginx進行反向代理,這里我重新配置了一下 579行~580行
     unicorn['listen'] = '127.0.0.1'
     unicorn['port'] = 8082
     
     #重新配置nginx 800行
     nginx['enable'] = true
     nginx['listen_addresses'] = ['*']
     nginx['listen_port'] = 82
     
     #退出並保存
    
  2. 重新加載配置並重啟gitlab

     gitlab-ctl reconfigure
     gitlab-ctl restart
     #出現如下提示說明重啟成功
     ok: run: gitaly: (pid 18536) 0s
     ok: run: gitlab-monitor: (pid 18556) 1s
     ok: run: gitlab-workhorse: (pid 18561) 0s
     ok: run: logrotate: (pid 18610) 1s
     ok: run: nginx: (pid 18616) 0s
     ok: run: node-exporter: (pid 18623) 0s
     ok: run: postgres-exporter: (pid 18634) 1s
     ok: run: postgresql: (pid 18660) 0s
     ok: run: prometheus: (pid 18722) 0s
     ok: run: redis: (pid 18732) 0s
     ok: run: redis-exporter: (pid 18737) 0s
     ok: run: sidekiq: (pid 18758) 0s
     ok: run: unicorn: (pid 18767) 1s
    

6.訪問gitlab

    #由於我沒有域名,直接綁定的是ip地址
    #在瀏覽器中輸入ip:82此時即可訪問
    #登錄后界面如下圖所示,看上去是不是非常的棒!
    #接下來盡情的去體驗屬於你的代碼服務器吧~~~~


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM