金庸武功之“漫天花雨”--gitlab 之 rpm安裝方式

GitLab的兩種安裝方法:

  • 編譯安裝

    • 優點:可定製性強。數據庫既可以選擇MySQL,也可以選擇PostgreSQL;服務器既可以選擇Apache,也可以選擇Nginx。

    • 缺點:國外的源不穩定,被牆時,依賴軟件包難以下載。配置流程繁瑣、複雜,容易出現各種各樣的問題。依賴關係多,不容易管理,卸載GitLab相對麻煩。

  • 通過rpm包安裝

    • 優點:安裝過程簡單,安裝速度快。採用rpm包安裝方式,安裝的軟件包便於管理。

    • 缺點:數據庫默認採用PostgreSQL,服務器默認採用Nginx,不容易定製


一.選擇系統版本

       進入Gitlab官網選擇自己服務器系統(此處我的版本是centos7)

         http://www.shcsinfo.com/china/gitdownload.html

   wKioL1gRZgmw8navAACB-yReANA335.png-wh_50

spacer.gif

spacer.gif



二.環境準備

  

sudo yum install curl policycoreutils openssh-server openssh-clients
sudo systemctl enable sshd
sudo systemctl start sshd
sudo yum install postfix
sudo systemctl enable postfix
sudo systemctl start postfix
sudo firewall-cmd --permanent --add-service=http
sudo systemctl reload firewalld

其中防火牆要是沒裝就不用執行

sudo firewall-cmd --permanent --add-service=http
sudo systemctl reload firewalld


三.下載RPM包

這裏由於網絡影響因素,我們就不按照文檔上說的步驟走了,在下面有個清華的yum源


For configuration and troubleshooting options please see the Omnibus GitLab documentation 
 If you are located in China, try using 
https://mirror.tuna.tsinghua.edu.cn/help/gitlab-ce/


直接進入https://mirror.tuna.tsinghua.edu.cn/help/gitlab-ce/


CentOS/RHEL

新建 /etc/yum.repos.d/gitlab-ce.repo,內容爲

你的CentOS/RHEL版本:   CentOS 6  CentOS 7  RHEL 6  RHEL 7 


[gitlab-ce]
name=gitlab-ce
baseurl=http://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7
repo_gpgcheck=0
gpgcheck=0
enabled=1
gpgkey=https://packages.gitlab.com/gpg.key

再執行

sudo yum makecache
sudo yum install gitlab-ce


這裏需要注意的是,在時如果報錯


大致就是yum源的問題,就把/etc/yum.repos.d/CentOS-Base.repo 改個名字

如:mv CentOS-Base.repo 00

這樣再執行就OK了,


執行完

sudo yum makecache
sudo yum install gitlab-ce

再執行下

sudo gitlab-ctl reconfigure

就可以訪問Gitlab了

http://192.168.92.2



開啓gitlab的自動啓動

systemctl enable gitlab-runsvdir.service
systemctl start gitlab-runsvdir.service
gitlab-cmd start



漢化:

需要下載漢化包,我們這裏直接到去git一個。如果沒安裝git的請自行yum或apt-get 一個git。
比如我們現在到/usr/local/src,執行如下命令去git clone包:

      git clone https://gitlab.com/larryli/gitlab.git

其中如果在clone中報瞭如下的錯:


[root@localhost /]# git clone https://gitlab.com/larryli/gitlab.git

正克隆到 'gitlab'...

remote: Counting objects: 261883, done.

remote: Compressing objects: 100% (54254/54254), done.

error: RPC failed; result=18, HTTP code = 20013.00 KiB/s    

fatal: The remote end hung up unexpectedly

fatal: 過早的文件結束符(EOF)

fatal: index-pack failed


是curl的postBuffer 默認值較小的原因,配置下個這個值,就不會出現該錯誤了.


在git目錄下

git config --list

git config --global http.postBuffer 24288000

git config --list


再執行,就成功了


[root@localhost src]# git clone https://github.com/larryli/gitlabhq.git

正克隆到 'gitlabhq'...

remote: Counting objects: 261624, done.

remote: Compressing objects: 100% (23/23), done.

remote: Total 261624 (delta 1), reused 0 (delta 0), pack-reused 261601

接收對象中: 100% (261624/261624), 139.66 MiB | 34.00 KiB/s, done.

處理 delta 中: 100% (193704/193704), done.



新建新倉庫目錄

mkdir -p /mnt/application/gitlab/git-data


 修改配置文件 sudo vi /etc/gitlab/gitlab.rb 
 搜索:git_data_dir 修改成:git_data_dir "新目錄" 
 如: git_data_dir "/mnt/application/gitlab/git-data"
 保存 
 重新生成gitlab sudo gitlab-ctl reconfigure 


































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