日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) >

安装gitlab

發(fā)布時(shí)間:2025/7/25 34 豆豆
生活随笔 收集整理的這篇文章主要介紹了 安装gitlab 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
from:?http://my.oschina.net/u/1169607/blog/344142
摘要 本文介紹了gitlab的安裝,給出來(lái)安裝過(guò)程中出現(xiàn)的問(wèn)題和解決的方式,供大家參考。自動(dòng)安裝gitlab的方法見(jiàn)http://my.oschina.net/u/1169607/blog/345833。

Gitlab是一個(gè)用Ruby?on?Rails開(kāi)發(fā)的開(kāi)源項(xiàng)目管理程序,可以通過(guò)WEB界面進(jìn)行訪問(wèn)公開(kāi)的或者私人項(xiàng)目。它和Github有類似的功能,能夠?yàn)g覽源代碼,管理缺陷和注釋。

下面介紹如何手動(dòng)在Centos下搭建配置GitLab,自動(dòng)安裝gitlab的方法見(jiàn)http://my.oschina.net/u/1169607/blog/345833。

1?安裝依賴

1.1?修改yum

國(guó)內(nèi)比較快的有163源、sohu這里以CentOS6.5中修改yum源為例子

1.?cd?/etc/yum.repos.d

2.?mv?CentOS-Base.repo?CentOS-Base.repo.backup

3.?wget?http://mirrors.163.com/.help/CentOS6-Base-163.repo

4.?mv?CentOS6-Base-163.repo?CentOS-Base.repo

5.yum?clean?all

1.2?安裝epel源

Centos下官方倉(cāng)庫(kù)的軟件比較老舊,推薦先添加epelcentos6選65就選5

32位系統(tǒng)選擇:

rpm?-ivh?http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm

rpm?-ivh?http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm

64位系統(tǒng)選擇:

rpm?-ivh?http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

rpm?-ivh?http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm

導(dǎo)入key

rpm?--import?/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6

rpm?--import?/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-5

如果用比較新的軟件,用epel-test.repo這個(gè)文件就行了

另外還要安裝yum?install?yum-priorities

[root@localhost?yum.repos.d]#?ls?|grep?epel

epel.repo

epel-testing.repo

1.3?安裝依賴

sudo?yum?install?git?patch?gcc-c++?readline-devel?zlib-devel?libffi-devel?openssl-devel?make?autoconf?automake?libtool?bison?libxml2-devel?libxslt-devel?libyaml-devel?git?python?python-docutils?wget

2?安裝?Ruby?2.0

需要安裝Ruby2.0,軟件倉(cāng)庫(kù)中的Ruby?1.8不支持,安裝命令如下:

mkdir?/tmp/ruby?&&?cd?/tmp/ruby

curl?--progress?ftp://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p353.tar.gz?|?tar?xz

cd?ruby-2.0.0-p353

./configure?--disable-install-rdoc

make

sudo?make?install

安裝Bundler?Gem

sudo?gem?install?bundler?--no-ri?--no-rdoc

安裝過(guò)程中會(huì)出現(xiàn)下面的錯(cuò)誤:

[root@h77?ruby-2.0.0-p353]#?gem?install?bundler?--no-ri?--no-rdoc

ERROR:??Could?not?find?a?valid?gem?'bundler'?(>=?0),?here?is?why:?Unable?to?download?data?from?https://rubygems.org/?-?Errno::ETIMEDOUT:?Connection?timed?out?-?connect(2)?(https://rubygems.org/latest_specs.4.8.gz)

是因?yàn)閲?guó)內(nèi)網(wǎng)絡(luò)導(dǎo)致rubygems.org存放在Amazon?S3上面的資源文件間歇性連接失敗,用國(guó)內(nèi)的RubyGems鏡像(參見(jiàn)http://ruby.taobao.org/)替換官方鏡像,方法如下:

[root@h77?ruby-2.0.0-p353]#?gem?sources?--remove?https://rubygems.org/

https://rubygems.org/?removed?from?sources

[root@h77?ruby-2.0.0-p353]#?gem?sources?-a?https://ruby.taobao.org/

https://ruby.taobao.org/?added?to?sources

[root@h77?ruby-2.0.0-p353]#?gem?sources?-l

***?CURRENT?SOURCES?***

?

https://ruby.taobao.org/

[root@h77?ruby-2.0.0-p353]#?gem?install?bundler?--no-ri?--no-rdoc

Fetching:?bundler-1.7.6.gem?(100%)

Successfully?installed?bundler-1.7.6

1?gem?installed

3?配置gitlab-shell

創(chuàng)建git用戶:

sudo?adduser?--system?--create-home?--comment?'GitLab'?git??

配置gitlab-shell

su?-?git?-c?"git?clone?https://github.com/gitlabhq/gitlab-shell.git"??

su?-?git?-c?"cd?gitlab-shell?&&?git?checkout?v1.3.0"??

su?-?git?-c?"cp?gitlab-shell/config.yml.example?gitlab-shell/config.yml"??

sed?-i?"s/localhost/{你自己的ip或主機(jī)名}/g"?/home/git/gitlab-shell/config.yml??

su?-?git?-c?"gitlab-shell/bin/install"

4?配置數(shù)據(jù)庫(kù)

Centos下使用如下命令:

sudo?yum?install?mysql-server?

sudo?chkconfig?mysqld?on

配置MySQL

sudo?echo?"CREATE?DATABASE?IF?NOT?EXISTS?gitlabhq_production?DEFAULT?CHARACTER?SET?'utf8'?COLLATE?'utf8_unicode_ci';"?|?mysql?-u?root?-p

5?安裝redis服務(wù)

切換到root用戶,安裝Redis,確保按照前面步驟正確安裝epel源,執(zhí)行下面語(yǔ)句:

yum?install?redis*??

安裝完成后,啟動(dòng)redis服務(wù),設(shè)置開(kāi)機(jī)啟動(dòng),語(yǔ)句如下:

service?redis?start?????#啟動(dòng)redis??

chkconfig?redis?on?????#設(shè)置開(kāi)機(jī)啟動(dòng) ?

6?安裝配置?gitlab

su?-?git?-c?"git?clone?https://github.com/gitlabhq/gitlabhq.git?gitlab"??

su?-?git?-c?"cd?gitlab;git?checkout?5-1-stable"??

su?-?git?-c?"cp?config/gitlab.yml.example?config/gitlab.yml"??

su?-?git?-c?"mkdir?/home/git/gitlab-satellites"??

su?-?git?-c?"mkdir?public/uploads"??

su?-?git?-c?"mkdir?-p?tmp/sockets/"??

su?-?git?-c?"mkdir?-p?tmp/pids/"??

sed?-i?"s/?host:?localhost/?host:?{你自己的ip或主機(jī)名}/g"?config/gitlab.yml??

sed?-i?"s/from:?gitlab@localhost/from:?gitlab@{你自己的ip或主機(jī)名}/g"?config/gitlab.yml??

su?-?git?-c?"cp?config/puma.rb.example?config/puma.rb"??

su?-?git?-c?'git?config?--global?user.name?"GitLab"'??

su?-?git?-c?'git?config?--global?user.email?"gitlab@{你自己的ip或主機(jī)名}"'

配置數(shù)據(jù)庫(kù)連接:

sudo?su?git?-c?"cp?config/database.yml.mysql?config/database.yml"

sudo?sed?-i?"s/secure?password/mysql的root密碼/g"?config/database.yml

安裝MySQL需要的Gems

sudo?-u?git?-H?bundle?install?--deployment?--without?development?test?postgres?puma?aws

該步驟問(wèn)題較多,具體如下所示:

1.?出現(xiàn)“sudo:?bundle:?command?not?found”的錯(cuò)誤,解決方式用“su?git”進(jìn)入git用戶,再執(zhí)行“bundle?install?--deployment?--without?development?test?postgres?aws”命令;

2.?出現(xiàn)“Could?not?locate?Gemfile”的錯(cuò)誤,解決方式執(zhí)行“bundle?install?--deployment?--without?development?test?postgres?aws”命令必須在“/home/git/gitlab”目錄下,所以“cd??/home/git/gitlab”進(jìn)入該目錄;

3.?出現(xiàn)“Fetching?source?index?from?https://rubygems.org/”長(zhǎng)時(shí)間沒(méi)有響應(yīng),因?yàn)?span style="font-family:Times New Roman">Gemfile中的源連接不上,更換源,將其中的"http://rubygems.org/"變成"http://ruby.taobao.org",具體如下:

source?"http://ruby.taobao.org"??#?舊?source?"https://rubygems.org/"?

4.?出現(xiàn)“Could?not?find?modernizr-2.6.2?in?any?of?the?sources”問(wèn)題,因?yàn)楣倬W(wǎng)和淘寶的ruby源都沒(méi)有這個(gè)包,解決辦法是先手動(dòng)去下載?然后root用戶安裝wget?http://rubygems.org/gems/modernizr-2.6.2.gem??&&?gem?install?modernizr,再將gitlab目錄下的Gemfile文件和Gemfile.lock文件中的“modernizr”全部換成“modernizr-rails”,版本“2.6.2”全部換成“2.7.1”;

5.?出現(xiàn)“An?error?occurred?while?installing?charlock_holmes?(0.6.9),?and?Bundler?cannot?continue.”問(wèn)題,因?yàn)?span style="font-family:Times New Roman">charlock_holmes沒(méi)有安裝,用root用戶執(zhí)行下面命令:gem?install?charlock_holmes?-v?'0.6.9'

6.?出現(xiàn)“Error?installing?charlock_holmes:?ERROR:?Failed?to?build?gem?native?

extension.”問(wèn)題,因?yàn)槿鄙倌承┮蕾嚢?#xff0c;執(zhí)行下列語(yǔ)句:yum?install?libicu-devel?mysql-devel?pcre-devel?postfix

7.?出現(xiàn)“Error?connecting?to?Redis?on?localhost:6379?(ECONNREFUSED)”問(wèn)題,因?yàn)?span style="font-family:Times New Roman">redis服務(wù)沒(méi)有安裝,安裝見(jiàn)之前步驟介紹。

接下來(lái)執(zhí)行初始化操作:

sudo?-u?git?-H?bundle?exec?rake?gitlab:setup?RAILS_ENV=production

如果看到如下信息:

Administrator?account?created:

?

login.........admin@local.host

password......5iveL!fe

表示已經(jīng)成功安裝gitLab了,記下管理員的用戶名和密碼。

7?啟動(dòng)?gitlab

接下來(lái)執(zhí)行下列命令啟動(dòng)gitlab

[git@h79?gitlab]$?bundle?exec?rails?s?-e?production

=>?Booting?WEBrick

=>?Rails?3.2.13?application?starting?in?production?on?http://0.0.0.0:3000

=>?Call?with?-d?to?detach

=>?Ctrl-C?to?shutdown?server

[2014-11-13?21:15:30]?INFO??WEBrick?1.3.1

[2014-11-13?21:15:30]?INFO??ruby?2.0.0?(2013-11-22)?[x86_64-linux]

[2014-11-13?21:15:30]?INFO??WEBrick::HTTPServer#start:?pid=20972?port=3000

表示gitlab啟動(dòng)成功,可以通過(guò)http://{gitlab的域名或IP}:3000訪問(wèn)gitlab。第一訪問(wèn)會(huì)比較慢,因?yàn)橐幾g很多jscss

另外3000端口可能受防火墻影響,關(guān)閉防火墻?chkconfig?iptables?off(重啟后永久性生效)service?iptables?stop(及時(shí)生效,重啟后失效)。

登陸頁(yè)面如下所示:

輸入管理用戶名和密碼后,登錄進(jìn)去的頁(yè)面如下所示:





? 著作權(quán)歸作者所有
  • 分類:gitlab
  • 字?jǐn)?shù):1576
  • 標(biāo)簽: gitlab安裝 gitlab部署
  • 收藏 (26)
xuesong13
  • 粉絲: 5 博客數(shù): 40 共碼了 34979 字
評(píng)論(3) chaun 1樓 2015/07/01 17:18 必須要加精,這么好的帖...... 稻谷 2樓 2015/08/05 16:46 mark polly 3樓 2015/09/25 18:20 好麻煩,先收藏吧,還是gitbucket懶人用著省事。 登錄后評(píng)論 微信分享 頂部 開(kāi)源中國(guó)手機(jī)客戶端:AndroidiPhoneWP7 ? 開(kāi)源中國(guó)(OSChina.NET) | 關(guān)于我們 | 廣告聯(lián)系 | @新浪微博 | 開(kāi)源中國(guó)手機(jī)版 | 粵ICP備12009483號(hào)-3 開(kāi)源中國(guó)社區(qū)(OSChina.net)是工信部 開(kāi)源軟件推進(jìn)聯(lián)盟 指定的官方社區(qū) 《新程序員》:云原生和全面數(shù)字化實(shí)踐50位技術(shù)專家共同創(chuàng)作,文字、視頻、音頻交互閱讀

總結(jié)

以上是生活随笔為你收集整理的安装gitlab的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。