centos7下搭建git和gitlab版本庫


  • 系統:centos7

  安裝依賴:

yum -y install curl-devel expat-devel gettext-devel openssl-devel zlib-devel perl-devel 
  • git安裝

  下載git安裝包:

wget https://www.kernel.org/pub/software/scm/git/git-2.9.0.tar.gz

  解壓安裝:

tar -zxvf git-2.9.0.tar.gz
cd git-2.9.0
make prefix=/usr/local all

  編譯時出現如下異常:

libgit.a(utf8.o): In function `reencode_string_iconv':
/root/git-2.9.0/utf8.c:463: undefined reference to `libiconv'
libgit.a(utf8.o): In function `reencode_string_len':
/root/git-2.9.0/utf8.c:502: undefined reference to `libiconv_open'
/root/git-2.9.0/utf8.c:521: undefined reference to `libiconv_close'
/root/git-2.9.0/utf8.c:515: undefined reference to `libiconv_open'
collect2: ld 返回 1
make: *** [git-credential-store] 錯誤 1

  下載並安裝libiconv

cd ..
wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
tar -zxvf libiconv-1.14.tar.gz
cd libiconv-1.14
./configure --prefix=/usr/local/libiconv  &&  make  && make install

  返回git在此編譯安裝

cd ../git-2.9.0
make clean
./configure --prefix=/usr/local --with-iconv=/usr/local/libiconv/
make install

  查看安裝是否正確及安裝的版本:

# git --version
git version 2.9.0

  此時說明git已經安裝成功

  • 安裝gitlab
 更新源,參考:https://mirror.tuna.tsinghua.edu.cn/help/gitlab-ce/

vi /etc/yum.repos.d/gitlab-ce.repo

  添加如下內容

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

  執行

sudo yum makecache
sudo yum install gitlab-ce

  安裝成功后修改配置文件,修改訪問url等

 編輯/etc/gitlab/gitlab.rb,將其修改為你的ip和url如:

external_url "http://你的ip/gitlab"

 修改后運行

sudo gitlab-ctl reconfigure
sudo gitlab-ctl restart

 參考:https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/doc/settings/configuration.md

 最后通過:http://你的ip/gitlab,看能否正常運行。初次運行時需要重置root用戶密碼。

 

 更多幫助信息見:https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md


免責聲明!

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



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