您的位置:首页 > 运维架构 > Linux

centos/debian配置gitlab 7.1x来搭建自建的git仓库.

2015-06-10 18:33 671 查看

centos/debian配置gitlab 7.1x来搭建自建的git仓库.

前言:因为公司的某些历史原因, 有大量的代码还在csv/svn上. 新来的项目不得不走这个,同时,github的enterprise 2500$/y/10p的价格对于多变的项目和人员也不合适. 也为了让某些不习惯使用linux的开发使用上git, 就放弃了之前的gitolite server, 进而采用gitlab来搭建.

www.gitlab.com 是gitlab的仓库, 以前的历史版本, 需要先配置gitolite, 然后配server端来支持web功能. 新的已经实现一键包了.

-下载

使用https://about.gitlab.com/downloads/ 来选择对应的版本

wget 后直接运行一键脚本就可以了.

这个官方的版本非常不友好, 一键装完, 什么都没配置. 配了半天, 发现repo的地址还是domain.com…

gitlab也支持分开安装, 你自己指定server, 数据库这些, 如果一个一个装, 7个流程走下来, 也太过繁琐. 所以我们换一个公司出的,bitnami出的一键包.

地址在https://bitnami.com/stack/gitlab/installer

可以根据系统来选择是32还是64bit的, 推荐用recommended的版本.

下载到服务器后, 先去检查下服务器的80端口是否给占用. 停掉nginx or apache/httpd

把它们转到808x. 我这里要用一个完整的域名来使用gitlab,

e.g:http://dev.domain.org

安装前, 删除掉已经有的git帐号, 和git的home目录. 保证系统干净.

[root@fca-vm-demo-opt]# wget https://downloads.bitnami.com/files/stacks/gitlab/7.11.4-0/bitnami-gitlab-7.11.4-0-linux-x64-installer.run --2015-06-09 19:31:19--  https://downloads.bitnami.com/files/stacks/gitlab/7.11.4-0/bitnami-gitlab-7.11.4-0-linux-x64-installer.run Resolving downloads.bitnami.com... 216.235.167.23
Connecting to downloads.bitnami.com|216.235.167.23|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 311542012 (297M) [application/x-makeself]
Saving to: “bitnami-gitlab-7.11.4-0-linux-x64-installer.run”

100%[===========================================================================================================================================================>] 311,542,012 2.06M/s   in 2m 40s  

2015-06-09 19:34:05 (1.86 MB/s) - “bitnami-gitlab-7.11.4-0-linux-x64-installer.run” saved [311542012/311542012]

[root@fca-vm-demo-opt]# chmod a+x bitnami-gitlab-7.11.4-0-linux-x64-installer.run 

[root@fca-vm-demo-opt]# ./bitnami-gitlab-7.11.4-0-linux-x64-installer.run 
The installer detects that exists a 'git' user in the system. This installer will change the configuration for this user. Do you want to continue the installation? [y/N]: y

The installer detects that exists a 'gitlab_ci' user in the system. This installer will change the configuration for this user. Do you want to continue the installation? [y/N]: y

----------------------------------------------------------------------------
Welcome to the Bitnami Gitlab Stack Setup Wizard.

----------------------------------------------------------------------------
Select the components you want to install; clear the components you do not want 
to install. Click Next when you are ready to continue.

PhpPgAdmin [Y/n] :Y 

GitLab : Y (Cannot be edited)

GitLab CI [Y/n] :Y

Is the selection above correct? [Y/n]: Y

----------------------------------------------------------------------------
Installation folder

Please, choose a folder to install Bitnami Gitlab Stack

Select a folder [/opt/gitlab-7.11.4-0]: /opt/bitnami

----------------------------------------------------------------------------
Create Admin account

Bitnami Gitlab Stack admin user creation

Email Address [user@example.com]: rainysia@gmail.com

Login [user]:  rainysia

Password :
Please confirm your password :

----------------------------------------------------------------------------
Hostname that will be used to create internal URLs. If this value is incorrect, 
you may be unable to access your Gitlab installation from other computers. It is 
advisable to use a Domain instead of an IP address for compatibility with 
different browsers.

Domain [127.0.0.1]:  dev.domain.org
Do you want to configure mail support? [y/N]: N

----------------------------------------------------------------------------
Setup is now ready to begin installing Bitnami Gitlab Stack on your computer.

Do you want to continue? [Y/n]: Y

----------------------------------------------------------------------------
Please wait while Setup installs Bitnami Gitlab Stack on your computer.

 Installing
 0% ______________ 50% ______________ 100%
 #########################################

----------------------------------------------------------------------------
Setup has finished installing Bitnami Gitlab Stack on your computer.

Info: To access the Bitnami Gitlab Stack, go to http://dev.domain.org:80 from your browser.
Press [Enter] to continue:


这样就装好了. 中间容易出问题的地方, git本来的帐号, 各个gitlab和git的home目录, 以及/var/opt下的gitlab目录, 我这里没有设置mail server

使用很简单了

有几个使用的说明,

gitlab不支持initial repo, 所以你需要先用一个https://的git仓库来导入.

配置ssh key后, 是在 /profile这里面的/profile/key e.g:http://dev.domain.org/profile/keys

保证你要使用仓库的用户的ssh key是id_ras.pub key

拉取的时候直接用 git@dev.domain.org:username/project_name.git ,如果是read, 可以走http.

因为这里为没有走其它端口或者2级,3级域名, 所以需要走其他端口的, 需要在域名那里重配. 整个gitlab都在/opt/下, 里面的apps是应用,ctlscript.sh是配置重置重启shell




内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: