CentOS7下安裝gitlab、git

一、安裝gitlab

1、需要安裝包如下:(版本自行網上下載)

openssh-server-6.6.1p1-11.el7.x86_64.rpm

gitlab-ce-10.1.4-ce.0.el7.x86_64.rpm  

policycoreutils-python-2.2.5-15.el7.x86_64.rpm

將三個安裝包放到root根目錄下

[root@localhost ~]# ls
anaconda-ks.cfg                       openssh-server-6.6.1p1-11.el7.x86_64.rpm
gitlab-ce-10.1.4-ce.0.el7.x86_64.rpm  policycoreutils-python-2.2.5-15.el7.x86_64.rpm

2、按順序安裝下面的依賴,在安裝的過程中,也會自動升級很多其他依賴的,所以是在聯網情況下安裝的。

[root@localhost ~]# yum install -y curl
[root@localhost ~]# yum install -y policycoreutils-python
[root@localhost ~]# yum install -y openssh-server
[root@localhost ~]# yum install gitlab-ce-10.1.4-ce.0.el7.x86_64.rpm

3、安裝成功會出現gitlab圖標

  #################上面還有很多安裝信息,下面是部分截取,出現圖標即爲安裝成功
  正在安裝    : gitlab-ce-10.1.4-ce.0.el7.x86_64                                                                     1/1 
It looks like GitLab has not been configured yet; skipping the upgrade script.

       *.                  *.
      ***                 ***
     *****               *****
    .******             *******
    ********            ********
   ,,,,,,,,,***********,,,,,,,,,
  ,,,,,,,,,,,*********,,,,,,,,,,,
  .,,,,,,,,,,,*******,,,,,,,,,,,,
      ,,,,,,,,,*****,,,,,,,,,.
         ,,,,,,,****,,,,,,
            .,,,***,,,,
                ,*,.
  


     _______ __  __          __
    / ____(_) /_/ /   ____ _/ /_
   / / __/ / __/ /   / __ \`/ __ \
  / /_/ / / /_/ /___/ /_/ / /_/ /
  \____/_/\__/_____/\__,_/_.___/
  

Thank you for installing GitLab!
GitLab was unable to detect a valid hostname for your instance.
Please configure a URL for your GitLab instance by setting `external_url`
configuration in /etc/gitlab/gitlab.rb file.
Then, you can start your GitLab instance by running the following command:
  sudo gitlab-ctl reconfigure

For a comprehensive list of configuration options please see the Omnibus GitLab readme
https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md

  驗證中      : gitlab-ce-10.1.4-ce.0.el7.x86_64                                                                     1/1 

已安裝:
  gitlab-ce.x86_64 0:10.1.4-ce.0.el7                                                                                     

完畢!

4、配置gitlab,編輯 vi /etc/gitlab/gitlab.rb文件,將external_url 'http://gitlab.example.com'改爲:external_url 'http://192.168.190.147:11000'ip地址+端口號)保存退出。

5、重新配置並重啓gitlab,測試環境下可以將防火牆關閉,或者開放指定端口(開放的端口號和剛剛填寫的端口號需要一致)

[root@localhost ~]# gitlab-ctl reconfigure   ##重新配置gitlab

[root@localhost ~]# service firewalld stop  ##關閉防火牆

[root@localhost ~]# gitlab-ctl status  ##查看gitlab的運行狀態
run: gitaly: (pid 17094) 173s; run: log: (pid 16446) 258s
run: gitlab-monitor: (pid 17132) 172s; run: log: (pid 16795) 222s
run: gitlab-workhorse: (pid 17109) 173s; run: log: (pid 16550) 252s
run: logrotate: (pid 16672) 240s; run: log: (pid 16671) 240s
run: nginx: (pid 16612) 246s; run: log: (pid 16611) 246s
run: node-exporter: (pid 16745) 229s; run: log: (pid 16744) 229s
run: postgres-exporter: (pid 17187) 170s; run: log: (pid 16969) 204s
run: postgresql: (pid 16111) 311s; run: log: (pid 16110) 311s
run: prometheus: (pid 17141) 171s; run: log: (pid 16896) 210s
run: redis: (pid 15988) 317s; run: log: (pid 15987) 317s
run: redis-exporter: (pid 16837) 216s; run: log: (pid 16836) 216s
run: sidekiq: (pid 16385) 264s; run: log: (pid 16384) 264s
run: unicorn: (pid 16317) 270s; run: log: (pid 16316) 270s

10、打開瀏覽器,訪問剛剛配置的地址http://192.168.190.147:11000登錄gitlab,第一次登錄會讓你設置密碼的,密碼最少爲8爲,設置完成後即可登錄,用戶名爲root。

二、安裝git

1、首先需要安裝git的依賴包,並刪除已有git

[root@localhost ~]# yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker
[root@localhost ~]# yum remove git

2、切換到git的包文件存放目錄下,這裏我是放在了root目錄下,進入目錄:然後解壓安裝包

[root@localhost ~]# tar -zxvf git-2.8.3.tar.gz

3、安裝包解壓完成後,進入解壓後的Git文件下,配置安裝路徑,然後編譯並且安裝

[root@localhost ~]# cd git-2.8.3
[root@localhost ~]# ./configure prefix=/usr/local/git/   ##配置安裝路徑
[root@localhost ~]# make && make install   ##編譯並且安裝


4、將git的指令添加到bash中,運行vi /etc/profile進入編輯,在最後一行添加:

export PATH=$PATH:/usr/local/git/bin

最後運行source /etc/profile命令讓上述配置文件立即生效

最後運行git --version命令查看git的版本號

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章