CentOS6.4 安装gitlab
前端之家收集整理的这篇文章主要介绍了
CentOS6.4 安装gitlab,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
简单安装
Omnibus 包安装 GitLab
http://www.21yunwei.com/archives/4351
http://peiqiang.net/2014/07/30/install-gitlab.html
http://blog.csdn.net/hustpzb/article/details/8230454/
源码安装
一、环境
gitlab的安装说明https://github.com/lubia/gitlab-recipes/tree/master/install/centos
系统:CentOS6.4最小化安装
IP:192.168.1.113
gitlab 5.2.0
centos64
Redis 2.6.13
nginx-1.4.1
mysql-
git version 2.1.3
一.GitLab使用介绍
gitlab中文使用指南:GitLab使用介绍
二。增添源 先解决这个问题在接着走
首先我们选择比较快的yum源,不然安装速度会非常的慢的.这里使用中国科技大学的yum源http://lug.ustc.edu.cn/wiki/mirrors/help/centos更换yum源方法参考:http://blog.haohtml.com/archives/5669,
三。默认安装的git版本可能会低一些,需要升级到最新版本才可以.
1. Packages / Dependencies
yum -y
install
readline-devel gdbm-devel ncurses-devel openssl-devel zlib-devel
gcc
gcc
-c++
make
autoconf curl-devel expat-devel gettext-devel tk-devel libxml2-devel libffi-devel libxslt-devel libicu-devel git-all python-devel vim
sudo
[root@gitlab~]
[root@gitlab~]
[root@gitlab~]
[root@gitlab~]
[root@gitlab~]
[root@gitlabgit-2.1.3]
[root@gitlabgit-2.1.3]
[root@gitlabgit-2.1.3]
[root@gitlabgit-2.1.3]
gitversion2.1.3
五、安装ruby环境
删除系统
自带的ruby环境,确保ruby是2.0以上的版本
[root@gitlab~]
[root@gitlab~]
[root@gitlab~]
[root@gitlab~]
[root@gitlabruby-2.1.2]
[root@gitlabruby-2.1.2]
[root@gitlabruby-2.1.2]
七、安装
MysqL
http://blog.csdn.net/ssdfsfdf/article/details/44425785
查看MysqL安装结果
@H_
404_273@
1
2
|
[root@gitlab~]
MysqLVer14.14Distrib5.5.37,
for
Linux(x86_64)usingEditLinewrapper
|
@H_418_301@
创建数据库并授权
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
[root@gitlab~]
Enterpassword:
WelcometotheMysqLmonitor.Commandsendwith;or\g.
YourMysqLconnection
id
is6
Serverversion:5.5.37Sourcedistribution
Copyright(c)2000,2014,Oracleand
/or
itsaffiliates.Allrightsreserved.
OracleisaregisteredtrademarkofOracleCorporationand
/or
its
affiliates.Othernamesmaybetrademarksoftheirrespective
owners.
Type
'help;'
or
'\h'
for
help.Type
'\c'
to
clear
thecurrentinputstatement.
MysqL>CREATEDATABASEIFNOTEXISTS`gitlabhq_production`DEFAULTCHARACTERSET`utf8`COLLATE`utf8_unicode_ci`;
QueryOK,1rowaffected(0.00sec)
MysqL>GRANTSELECT,LOCKTABLES,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX,ALTERON`gitlabhq_production`.*TO
'git'
@
'localhost'
IDENTIFIEDBY
'gitpasswd'
;
QueryOK,0rowsaffected(0.00sec)
QueryOK,0rowsaffected(0.01sec)
+------+-----------+-------------------------------------------+
|user|host|password|
+------+-----------+-------------------------------------------+
|root|localhost|*B181A5BCA7C882221F5B8F6F9657AE71FF67EDDB|
|root|127.0.0.1|*B181A5BCA7C882221F5B8F6F9657AE71FF67EDDB|
|git|localhost|*6EA0EDE421A05E610ADBFC5D47B93B6E06C6216F|
+------+-----------+-------------------------------------------+
3rows
in
set
(0.00sec)
|
@H_418_301@
测试新建的用户能否登陆MysqL
[root@gitlab~]
Enterpassword:
WelcometotheMysqLmonitor.Commandsendwith;or\g.
YourMysqLconnection
id
is8
Serverversion:5.5.37Sourcedistribution
Copyright(c)2000,Oracleand
/or
itsaffiliates.Allrightsreserved.
OracleisaregisteredtrademarkofOracleCorporationand
/or
its
affiliates.Othernamesmaybetrademarksoftheirrespective
owners.
Type
'help;'
or
'\h'
for
help.Type
'\c'
to
clear
thecurrentinputstatement.
+---------------------+
|Database|
+---------------------+
|information_schema|
|gitlabhq_production|
|
test
|
+---------------------+
3rows
in
set
(0.00sec)
安装redis 及 配置redis
安装redis
[root@gitlab~]
[root@gitlab~]
Startingredis-server:[OK]
[root@gitlab~]
tcp00127.0.0.1:63790.0.0.0:*LISTEN8755
/redi
九、安装gitlab
[root@gitlab~]
[root@gitlabgit]
Cloninginto
'gitlab'
...
remote:Countingobjects:127971,
done
.
remote:Compressingobjects:100%(32073
/32073
),
done
.
remote:Total127971(delta97845),reused123442(delta94050)
Receivingobjects:100%(127971
/127971
),81.35MiB|1.63MiB
/s
,
done
.
Resolvingdeltas:100%(97845
/97845
),
done
.
Checkingconnectivity...
done
.
[root@gitlabgit]
[root@gitlabgitlab]
[root@gitlabgitlab]
gitlab:
host:www.gitlab.com
port:80
https:
false
[root@gitlabgitlab]
[root@gitlabgitlab]
[root@gitlabgitlab]
[root@gitlabgitlab]
[root@gitlabgitlab]
[root@gitlabgitlab]
[root@gitlabgitlab]
[root@gitlabgitlab]
[root@gitlabgitlab]
[root@gitlabgitlab]
[root@gitlabgitlab]
1
[root@gitlabgitlab]
worker_processes1
[root@gitlabgitlab]
[root@gitlabgitlab]
[root@gitlabgitlab]
[root@gitlabgitlab]
[root@gitlabgitlab]
[root@gitlabgitlab]
development:redis:
//localhost
:6379
test
:redis:
//localhost
:6379
production:unix:
/var/run/redis/redis
.sock
十、编辑gitlab数据库文件
[root@gitlabgitlab]
[root@gitlabgitlab]
production:
encoding:utf8
collation:utf8_general_ci
reconnect:
false
database:gitlabhq_production
pool:10
username:git
password:
"gitpasswd"
[root@gitlabgitlab]
[root@gitlabgitlab]
source
"https://ruby.taobao.org"
[root@gitlabgitlab]
[root@gitlabgitlab]
[root@gitlabgitlab]
Gem files will remain installed in /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/charlock_holmes-0.6.9.4 for inspection.
Results logged to
/home/git/gitlab/vendor/bundle/ruby/2.1.0/extensions/x86_64-linux/2.1.0-static/charlock_holmes-0.6.9.4/gem_make.out
An error occurred while installing charlock_holmes (0.6.9.4),and Bundler cannot continue.
Make sure that `gem install charlock_holmes -v '0.6.9.4'` succeeds before bundling.
解决 错误
gem list
看看 是不是已经装了 版本不一样
charlock_holmes-0.6.9.4
卸载到 gem uninstall charlock_holmes
安装
sudo gem install charlock_holmes -v '0.6.9.4'
Gem files will remain installed in /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/MysqL2-0.3.16 for inspection.
Results logged to /home/git/gitlab/vendor/bundle/ruby/2.1.0/extensions/x86_64-linux/2.1.0-static/MysqL2-0.3.16/gem_make.out
An error occurred while installing MysqL2 (0.3.16),and Bundler cannot continue.
Make sure that `gem install MysqL2 -v '0.3.16'` succeeds before bundling.
MysqL2
错误
An error occurred while installing
MysqL2 (0.3.16),and Bundler cannot continue.
Make sure that `gem install MysqL2 -v '0.3.16'` succeeds before bundling.
解决
gem install MysqL2 -v '0.3.16'`
yum install MysqL-devel
十二、安装gitlab-shell
[root@gitlabgitlab]
[root@gitlabgitlab]
gitclone
'https://gitlab.com/gitlab-org/gitlab-shell.git'
'/home/git/gitlab-shell/'
Cloninginto
'/home/git/gitlab-shell'
...
remote:Countingobjects:2118,
done
.
remote:Compressingobjects:100%(1639
/1639
),
done
.
remote:Total2118(delta1301),reused710(delta400)
Receivingobjects:100%(2118
/2118
),306.39KiB|177.00KiB
/s
,
done
.
Resolvingdeltas:100%(1301
/1301
),
done
.
Checkingconnectivity...
done
.
gitreset--hard$(gitdescribev2.0.1||gitdescribeorigin
/v2
.0.1)||gitfetchorigin&&gitreset--hard$(gitdescribev2.0.1||gitdescribeorigin
/v2
.0.1)
HEADisnowata3b5445Fixbugwhenchangestopost-receiveworkerwasnotdumpedproperly
HEADisnowata3b5445Fixbugwhenchangestopost-receiveworkerwasnotdumpedproperly
bin
/install
mkdir
-p
/home/git/repositories/
:OK
mkdir
-p
/home/git/
.
ssh
:OK
chmod
700
/home/git/
.
ssh
:OK
touch
/home/git/
.
ssh
/authorized_keys
:OK
chmod
600
/home/git/
.
ssh
/authorized_keys
:OK
chmod
-Rug+rwX,o-rwx
/home/git/repositories/
:OK
find
/home/git/repositories/
-
type
d-
exec
chmod
g+s{};:OK
[root@gitlabgitlab]
---
user:git
gitlab_url:https:
//localhost/
http_settings:
self_signed_cert:
true
repos_path:
"/home/git/repositories/"
auth_file:
"/home/git/.ssh/authorized_keys"
redis:
bin:
"/usr/bin/redis-cli"
namespace:resque:gitlab
socket:
"/var/run/redis/redis.sock"
log_level:INFO
audit_usernames:
false
十三、初始化数据库
[root@gitlabgitlab]
Thiswillcreatethenecessarydatabasetablesandseedthedatabase.
YouwillloseanyprevIoUsdatastored
in
thedatabase.
Doyouwantto
continue
(
yes
/no
)?
yes
[root@gitlabgitlab]
[root@gitlabgitlab]
[root@gitlabgitlab]
[root@gitlabgitlab]
[root@gitlabgitlab]
[root@gitlabgitlab]
Systeminformation
System:
CurrentUser: git
UsingRVM: no
RubyVersion: 2.1.2p95
GemVersion: 2.2.2
BundlerVersion:1.9.7
RakeVersion: 10.3.2
SidekiqVersion:2.17.0
GitLabinformation
Version: 7.4.5
Revision: 19d572e
Directory:
/home/git/gitlab
URL: http:
//localhost
HTTPCloneURL: http:
//localhost/some-project
.git
SSHCloneURL: git@localhost:some-project.git
UsingLDAP: no
UsingOmniauth: no
GitLabShell
Version: 2.0.1
Repositories:
/home/git/repositories/
Hooks:
/home/git/gitlab-shell/hooks/
Git:
/usr/bin/git
[root@gitlabgitlab]
[root@gitlabgitlab]
Startingunicorn:[OK]
Startingsidekiq:[OK]
十五、安装Nginx服务,并下载gitlab的站点配置文件
这里的Nginx使用yum进行安装
[root@gitlabgitlab]
[root@gitlabgitlab]
[root@gitlabgitlab]
将
Nginx用户添加到git组
[root@gitlabgitlab]
[root@gitlabgitlab]
[root@gitlabgitlab]
server_name www.gitlab.com
配置SSL证书
[root@gitlabgitlab]
[root@gitlabgitlab]
十六、Gitlab配置SMTP
邮件
cd
/home/git/gitlab
[root@gitgitlab]
[root@gitgitlab]
if
Rails.
env
.production?
Rails.application.config.action_mailer.delivery_method=:smtp
ActionMailer::Base.delivery_method=:smtp
ActionMailer::Base.smtp_settings={
address:
"smtp.163.com"
,
port:25,
user_name:
"xxx"
,
password:
"xxxx"
,
domain:
"163.com"
,
authentication::login,
enable_starttls_auto:
true
,
}
end
[root@gitgitlab]
config.action_mailer.delivery_method=:smtp