CentOS6.7安装gitlab

GitLab,是一个利用 Ruby on Rails 开发的开源应用程序,实现一个自托管的Git项目仓库,可通过Web界面进行访问公开的或者私人项目。

它拥有与Github类似的功能,能够浏览源代码,管理缺陷和注释。可以管理团队对仓库的访问,它非常易于浏览提交过的版本并提供一个文件历史库。团队成员可以利用内置的简单聊天程序(Wall)进行交流。它还提供一个代码片段收集功能可以轻松实现代码复用,便于日后有需要的时候进行查找。

前期规划:

1).操作系统Centos 6.7 Minimal

#Distribution      : CentOS 6.7 Minimal

#GitLab version    : 6.3.1

#GitLab-shell      : 1.8.0

#Ruby version      : ruby 2.0.0p353(2013-11-22 revision 43784) [x86_64-linux]

#Gem version       : 2.0.14

#Redis-server      : Redis server version2.4.10 (00000000:0)

#Web Server        : Nginx/1.0.15

#Database          : MariaDB 10.0.21

2).项目地址:https://github.com/gitlabhq/gitlabhq

参考文档:http://doc.gitlab.com/ce/install/installation.html#clone-the-source

https://github.com/lubia/gitlab-recipes/tree/master/install/centos

3).主机名称及IP地址(测试主机IP地址)

Moxiaokai     192.168.3.251

4).同步主机系统时间

#/usr/sbin/ntpdate -us stdtime.gov.hk ntp.sjtu.edu.cn;hwclock -w;

第一,配置yum源及安装依赖包:

1).安装epel源

#yum -y install epel-release -y

2.安装puias源

#vi /etc/yum.repos.d/puias-computational.repo
[PUIAS_6_computational]
name=PUIAScomputational Base $releasever - $basearch
mirrorlist=http://puias.math.ias.edu/data/puias/computational/$releasever/$basearch/mirrorlist
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-puias
#cd /etc/pki/rpm-gpg/
#wget -q http://springdale.math.ias.edu/data/puias/6/x86_64/os/RPM-GPG-KEY-puias
#rpm --import RPM-GPG-KEY-puias
#yum repolist

第二,安装依赖包:

1).基础依赖包

#yum -y install gdbm-devel glibc-devel tcl-devel openssl-devel curl-develexpat-devel db4-devel byacc libyaml libyaml-devel libffi libffi-devel libxml2libxml2-devel libxslt libxslt-devel libicu libicu-devel sudo wget patchlogwatch logrotate perl-Time-HiRes cmake libcom_err-devel.i686libcom_err-devel.x86_64 nodejs python-docutils

2).升级系统所有软件包到最新

#yum -y update

3).安装postfix邮件服务器

#yum install postfix

第三,安装git:

1).移除低版本git

#yum remove git -y

备注:默认centos的git版本是1.7.10,必须删除后,再下载源码进行安装

2).安装git的依赖包

#yum -y install zlib-devel perl-CPAN gettext curl-devel expat-devel gettext-developenssl-devel

3).编译安装git

#mkdir /tmp/git && cd /tmp/git
#curl  --progress https://www.kernel.org/pub/software/scm/git/git-2.5.1.tar.gz | tar xz
#cd  git-2.5.1/ && ./configure --prefix=/usr/local/git  && make && make install

4).配置换变量

#echo "export PATH=/usr/local/git/bin:\$PATH" >> /etc/profile
#source /etc/profile

5).验证程序

#which git
#git --version

第四,安装ruby

1).移除低版本ruby

ruby版本需要2.0+,所以先卸载系统已存在的

#yum remove ruby

#如果是源码安装的

cd(your-ruby-source-path) && make uninstall

2).编译安装ruby

#mkdir /tmp/ruby && cd /tmp/ruby
#curl --progress https://cache.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p353.tar.gz |tar xz
#cd ruby-2.0.0-p353 && ./configure --prefix=/usr/local/ruby--disable-install-rdoc && make && make install

3).配置换变量

#echo "export PATH=/usr/local/ruby/bin:\$PATH" >> /etc/profile
#source /etc/profile

4).验证程序

#which ruby
#ruby --version

5).安装bundler

删除官方源使用淘宝的镜像

#gem sources --add https://ruby.taobao.org/ --remove https://rubygems.org/
#gem sources -l

#gem install bundler --no-rdoc

# gem install charlock_holmes

第五,创建系统用户(git)

#adduser --system --shell /bin/bash--comment 'GitLab' --create-home --home-dir /home/git/ git

第六,配置MariaDB

创建数据库用户并授权

#mysql -u root -p
mysql> create database gitlabhq_production character set utf8;
mysql> grant all privileges on gitlabhq_production.*to git@localhost identified by '123456';
mysql> flushprivileges;

7,配置redis

1).安装redis

#yum install redis

验证redis版本:

    

2).修改redis.conf配置文件

(1).备份配置文件

# cp /etc/redis.conf /etc/redis.conf.bak

(2).修改/tmp/redis.sock为/var/run/redis/redis.sock

(3).修改/var/var/run/redis/redis.sock的权限为755

  # chmod  -R 755 /var/run/redis/

3).配置redis自启动

#chkconfig --level 35 redis on

4).启动redis并验证

#/etc/init.d/redis restart
#/etc/init.d/redis status

5).附加git到redis组

#usermod -aG redis git

第八,安装gitlab

1).取gitlab源代码:

# su - git
$ git clonehttps://github.com/gitlabhq/gitlabhq.git gitlab

检查远程分支并切换到对应分支

$ cd gitlab
$ git branch -a ##查看远程分支
$ git checkout 6-3-stable

$ cat VERSION6.3.1

2).修改配置gitlab.yml

(1).修改18行(版本不同行数不同)的host为IP地址或者域名

$ cp config/gitlab.yml.example config/gitlab.yml
$ vi config/gitlab.yml

(2).修正184行(版本不同行数不同)的bin_path为正确的git命令位置

(3).检查创建目录及权限

$ mkdir -p /home/git/gitlab-satellites
$ cd /home/git/gitlab
$ mkdir -p tmp/pids
$ mkdir -p tmp/sockets
$ mkdir -p public/uploads

3).配置unicorn.rb文件

(1).修改配置

$ cp config/unicorn.rb.example config/unicorn.rb

#查看系统核心数

#nproc
2

$viconfig/unicorn.rb

注意config/unicorn.rb的内容:

working_directory"/home/git/gitlab"

listen"/home/git/gitlab/tmp/sockets/gitlab.socket"

pid"/home/git/gitlab/tmp/pids/unicorn.pid"

4).配置resque.yml文件,(redis文件)

$ cp config/resque.yml.example config/resque.yml

#连接redis配置,默认配置,最终修改结果如下

$ cat config/resque.yml

5).配置database.yml文件(MariaDB),只配置production环境

$ cp config/database.yml.mysql config/database.yml
$ vi config/database.yml

第九,安装gem

1).修改gemfile源为淘宝源

# su - git
$ cd /home/git/gitlab
$ vi Gemfile

修改文件Gemfile 的143行中gem"modernizr","2.6.2"为:gem"modernizr-rails","2.7.1"

修改文件Gemfile.lock 的279行modernizr(2.6.2)为modernizr-rails (2.7.1)

修改文件Gemfile.lock 的605行modernizr(= 2.6.2)为modernizr-rails (= 2.7.1)

2).执行gem安装

$ bundle install --deployment --without development test postgres aws

第十,安装gitlab-shell

1).安装gitlab-shell

$ su - git
$ git clone https://github.com/gitlabhq/gitlab-shell.git gitlab-shell
$ cd gitlab-shell
$ git checkout v1.8.0

2).配置config.yml

$ cp config.yml.example config.yml
$ vi config.yml

在正式环境中将gitlan_url换成gitbal访问域名

3).执行安装命令,创建对应目录和文件

$ ./bin/install

第十一,初始化数据库并激活高级功能

$ cd /home/git/gitlab
$ bundle exec rake gitlab:setup RAILS_ENV=production

这步完成后,会生一个默认的管理员账号:

root

5iveL!fe

十二,下载gitlab启动服务脚本

# wget -O /etc/init.d/gitlab https://gitlab.com/gitlab-org/gitlab-recipes/raw/master/init/sysvinit/centos/gitlab-unicorn

# chmod +x /etc/init.d/gitlab
# chkconfig --add gitlab
# chkconfig --level 35 gitlab on
# 设置logrotate(可选操作)
# cp /home/git/gitlab/lib/support/logrotate/gitlab /etc/logrotate.d/gitlab

十三,检测应用状态

1).检查基础环境

#su - git
$ cd gitlab
$ bundle exec rake gitlab:env:info RAILS_ENV=production

2).检查编译环境

$ bundle exec rake assets:precompile RAILS_ENV=production

3).查看应用详细信息

 $bundle exec rake gitlab:check RAILS_ENV=production

4).启动服务,并验证

#service gitlab start

如果报错:bash: bin/web: No such file or directory和bash:bin/background_jobs: No such file or directory

解决办法为:

# vi /etc/init.d/gitlab

修改/etc/init.d/gitlab中的 bin/web 路径为 script/web

修改/etc/init.d/gitlab中的 bin/background_jobs 路径为 script/background_jobs

十四,配置web服务

(1).编辑nginx.conf文件

修改/usr/local/nginx/conf/nginx.conf (编译安装的nginx)

1.在include        mine.types;这一行上添加:

passenger_root /usr/local/ruby/lib/ruby/gems/2.0.0/gems/passenger-5.0.23;

passenger_ruby /usr/local/ruby/bin/ruby;

2.修改##访问方式为:http://ip/目录名为:

server {

listen 80;

server_name localhost;

location / {

root   /home/git/gitlab/public/;

index  index.html index.htm;

passenger_enabled on;

}

}

(2).访问http://192.168.3.251/登录

用户名:root

密码:5iveL!fe

本文出自 “小陌成长之路” 博客,请务必保留此出处http://309173854.blog.51cto.com/7370240/1728390

GitLab完整搭建(版本6.3.1)相关推荐

  1. Gitlab完整搭建手册+排错

    GitLab,是一个利用 Ruby on Rails 开发的开源应用程序,实现一个自托管的Git项目仓库,可通过Web界面进行访问公开的或者私人项目. 它拥有与Github类似的功能,能够浏览源代码, ...

  2. Gitlab 服务器搭建,maven安装与jdk安装,linux下安装git

    Gitlab 服务器搭建 资源地址: 链接:https://pan.baidu.com/s/1SOLyixV7UkkLj0WWQqanDQ  提取码:fjcl 官网地址 首页:https://abou ...

  3. gitlab的搭建与汉化

    gitlab的搭建:内存最好2G以上 yum -y install curl unzip policycoreutils git wget         安装相关依赖包 所有gitlab rpm包的 ...

  4. GitLab私服搭建及使用实践

    GitLab私服搭建及使用实践 一 . 环境 CentOS 7 内存配置4G (官方要求2G , 但是2G 经常会出现502问题 ) 二. gitlab 私服搭建 安装依赖的openssh-serve ...

  5. java开发环境安装原理,java开发环境搭建 java开发环境的完整搭建过程

    想了解java开发环境的完整搭建过程的相关内容吗,Rosalh在本文为您仔细讲解java开发环境搭建的相关知识和一些Code实例,欢迎阅读和指正,我们先划重点:java开发环境搭建步骤,java开发环 ...

  6. GitLab - Ubuntu18搭建GitLab仓库服务器(转)

    GitLab - Ubuntu18搭建GitLab仓库服务器(转) 前期准备 sudo apt-get updatesudo apt-get install -y curl openssh-serve ...

  7. gitlab服务器搭建教程

    gitlab服务器搭建教程 ----2016年终总结 三 参考https://bbs.gitlab.cc/topic/35/gitlab-ce-8-7-%E6%BA%90%E7%A0%81%E5%AE ...

  8. Gitlab+Git实现版本控制系统

    Gitlab介绍 GitLab是一种类似github的服务,组织可以使用它来提供git存储库的内部管理. 它是一个自我托管的Git-repository管理系统,可以保持用户代码的私密性,并且可以轻松 ...

  9. NAO6机器人python环境完整搭建

    NAO6机器人Windows下python环境完整搭建 nao机器人随着机器人各种的比赛使用得越来越多,但是很多人对NAO机器人在Windows下的python环境搭建完全不知道如何下手.小编本人也是 ...

最新文章

  1. 曝出漏洞、企业禁用、紧急声明:Zoom 一周里经历了什么?
  2. spring源码分析之spring-core-env
  3. 计算机图形学基础考试题,计算机图形学基础复习题
  4. MATLAB 人脸定位
  5. python自动化测试脚本可以测php吗_请对比分析一下php的自动化测试与python的自动化测试...
  6. css3案例分析,CSS3动画/动画库以及案例分析(上)
  7. Mysql 里的约束
  8. tocmat linux搭建测试环境,Apache+Tomcat 环境搭建(JK部署过程)
  9. ionic使用ImagePicker插件中文显示
  10. 解决卡米,安心卸载MIUI预装软件。
  11. 最新AxureUX WEB端交互原型通用组件模板库 组件仍然是这套作品的核心内容,这套作品的组件由通用组件、数据录入、数据展示、信息反馈
  12. python MyQR制作动态二维码
  13. nofollow是什么意思,nofollow标签的作用是什么?
  14. java 拒绝访问_JAVA编译中拒绝访问的问题及解决方案
  15. 小程序接口加密时去除昵称数据含有的reshuffle表情(例如emoji)
  16. 殇城的伤感心情日志分享:青春容颜,我却一笔流伤
  17. Ninth season twentieth episode,Joey held a celebrities party but did not invited his friends!!!!!!
  18. MySQL数据库-更新表中的数据详解
  19. C++运算符重载——郭炜
  20. C#实现在企业微信内发送消息给指定人员帮助类

热门文章

  1. Halcon算子大全
  2. uniapp-获取省市区地址及内部高德sdk的使用
  3. 专业的网站流量分析和统计分析工具
  4. 如何分析用户复购行为?
  5. linux设计 实现一个模拟的文件系统,模拟Linux文件系统.doc
  6. 字符流的相关概念和相关方法的使用、IO异常的处理以及Properties属性集
  7. HTML图片打开新窗口
  8. qt登录界面简单制作,是真的保姆级别了!!!
  9. 全志平台通读写寄存器的方法
  10. CE-植物大战僵尸-僵尸-关卡-金币