环境:CentOS 6.5 x64 min

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

#配置安装EPEL及依赖环境

#更新包
yum update
yum -y install wget
#添加epel源
http://www.cnblogs.com/Irving/p/3729074.html
#安装所需依赖包
yum -y install readline readline-devel ncurses-devel gdbm-devel glibc-devel tcl-devel expat-devel db4-devel byacc sqlite-devel libyaml libyaml-devel libffi libffi-devel libxml2 libxml2-devel libxslt libxslt-devel libicu libicu-devel system-config-firewall-tui python-devel redis wget crontabs logwatch logrotate perl-Time-HiRes git gettext-devel libel openssl-devel zlib-devel gcc gcc-c++ make autoconf readline-devel expat-devel gettext-devel tk-devel  libxml2-devel libffi-devel libxslt-devel libicu-devel python-pip sqlite-devel  patch libyaml* pcre-devel
#安装bundle(需要添加rubygems的国内镜像)
gem sources --remove https://rubygems.org/
gem source -a http://ruby.taobao.org/
gem sources -l
gem install bundler --no-ri --no-rdoc
ln -s /usr/local/bin/gem /usr/bin/gem
ln -s /usr/local/bin/bundle /usr/bin/bundle

#安装Ruby

wget http://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.2.tar.gz
tar zfvx ruby-2.1.2.tar.gz
./configure --prefix=/usr/local/
make && make install
ln -s /usr/local/bin/ruby /usr/bin/ruby
ruby -v

#安装Git

http://www.cnblogs.com/Irving/p/3729064.html
#创建一个Git用户供GitLab使用
adduser --comment 'GitLab' git
passwd git
#为了方便添加git用户拥有root权限
vi /etc/sudoers
git  ALL=(ALL)    ALL
#强制保存
:wq!
#设置权限(重要)
sudo chmod o+x /home/git
vi /home/git/.bash_profile
export GIT_SSL_NO_VERIFY=1
source /home/git/.bash_profile
#不添加变量的话使用https链接会报如下错误
fatal: unable to access 'https://github.com/gitlabhq/grit.git/': Peer certificate cannot be authenticated with known CA certificates

#安装GitLab的Shell

su - git
git clone https://gitlab.com/gitlab-org/gitlab-shell.git -b v1.9.3
cd gitlab-shell/
cp config.yml.example config.yml
vi config.yml
#配置gitlab域名
gitlab_url: "http://git.test.com/"
#果gitlab是使用https访问
self_signed_cert:true
#安装
./bin/install
CREATE USER 'gitlab'@'localhost' IDENTIFIED BY '123456';

#安装MYSQL

su -
yum install -y mysql-server mysql-devel
chkconfig mysqld on
service mysqld start
#设置mysql root账号的密码
/usr/bin/mysql_secure_installation

创建gitlab使用的数据库
mysql -u root -p
#创建用户
CREATE USER 'gitlab'@'localhost' IDENTIFIED BY 'gitlab登陆密码';
#创建数据库
CREATE DATABASE IF NOT EXISTS `gitlabhq_production` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`;
#设置权限
GRANT SELECT, LOCK TABLES, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON `gitlabhq_production`.* TO 'gitlab'@'localhost';
quit

#安装GitLab

su - git
git clone https://gitlab.com/gitlab-org/gitlab-ce.git -b 6-8-stable gitlab
cd gitlab
#复制配置文件
cp config/gitlab.yml.example config/gitlab.yml
#修改访问域名
vi config/gitlab.yml
## Web server settings
  host: git.test.com
  port: 80
  https: true
#配置权限
chown -R git log/
chown -R git tmp/
chmod -R u+rwX  log/
chmod -R u+rwX  tmp/
mkdir tmp/pids/
mkdir tmp/sockets/
chmod -R u+rwX  tmp/pids/
chmod -R u+rwX  tmp/sockets/
mkdir public/uploads
chmod -R u+rwX  public/uploads
cp config/unicorn.rb.example config/unicorn.rb
cp config/initializers/rack_attack.rb.example config/initializers/rack_attack.rb
#配置git的用户和邮件
git config --global user.name "GitLab"
git config --global user.email "gitlab@localhost"
git config --global core.autocrlf input

#配置gitlab数据库
cp config/database.yml.mysql config/database.yml
vi config/database.yml
production:
  adapter: mysql2
  encoding: utf8
  reconnect: false
  database: gitlabhq_production
  pool: 5
  username: gitlab
  password: "gitlab"
  # host: localhost
  # socket: /tmp/mysql.sock

#安装gems

su -
$ gem install charlock_holmes --version '0.6.9.4'
vi Gemfile
source "https://rubygems.org"改为source "http://rubygems.org"或改成
#安装
bundle install --deployment --without development test postgres puma aws

#启动redis服务

sudo /etc/init.d/redis start
sudo chkconfig redis on
#初始化数据库
bundle exec rake gitlab:setup RAILS_ENV=production
#默认账号和密码
Administrator account created:
login.........admin@local.host
password......5iveL!fe

#安装启动脚本

sudo wget https://raw.github.com/gitlabhq/gitlab-recipes/master/init/sysvinit/centos/gitlab-unicorn -P /etc/init.d/
sudo mv /etc/init.d/gitlab-unicorn /etc/init.d/gitlab
sudo chmod +x /etc/init.d/gitlab
sudo chkconfig --add gitlab
sudo chkconfig gitlab on
sudo /etc/init.d/gitlab start

#拉取GitLab静态文件

cd /home/git/gitlab
bundle exec rake assets:precompile RAILS_ENV=production

#检查应用程序状况
bundle exec rake gitlab:env:info RAILS_ENV=production

#安装Nginx

#安装
su -
yum -y install nginx
chkconfig nginx on

#拷贝gitlab配置
cp /home/git/gitlab/lib/support/nginx/gitlab /etc/nginx/conf.d/
#备份默认配置
mv /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf.back
#重盖默认配置(或者删除default.conf 默认配置,只用gitlab)
mv /etc/nginx/conf.d/gitlab /etc/nginx/conf.d/default.conf

#启动服务

#service gitlab start (restart)
#service nginx start  (restart)
#关闭防火墙 (重启后永久性生效)
service iptables stop
chkconfig iptables off
#访问服务
http://192.168.0.107/

基本查看网上的文章安装,还算比较顺利,我这边遇到如下问题:
1.ruby 最新源码编译很久不能通过,换到低一个版本
2.502错误,因为Nginx默认配置了502错误,查看Nginx日志 /var/log/nginx/gitlab_error.log
"/home/git/gitlab/public/favicon.ico.html" failed (13: Permission denied), client: 33.33.33.1, server: gitlab.web.lo, request: "GET /favicon.ico HTTP/1.1"
开始以为是Socet服务有问题,后发现是权限问题。
解决方法:chmod o+x /home/git

Refer:
用Gitlab来工作
http://feiyang.me/2013/03/work-with-gitlab/
Puma 替换 Unicorn 跑 Gitlab
http://icyleaf.com/2014/01/moving-unicorn-to-puma-on-gitlab/
GitLab 启用HTTPS
http://blog.csdn.net/csfreebird/article/details/8579488
Ubuntu
http://my.oschina.net/guol/blog/165409
http://rfyiamcool.blog.51cto.com/1030776/1365521/
Redhat
http://my.oschina.net/xiaokaceng/blog/187573
CentOS
http://my.oschina.net/wzlee/blog/262181
http://hypocritical.blog.51cto.com/3388028/1405574

CentOS 6.5 安装和使用Gitlab的更多相关文章

  1. centos 6.5安装GitLab全过程和问题记录

    GitLab,是一个使用 Ruby on Rails 开发的开源应用程序,与Github类似,能够浏览源代码,管理缺陷和注释,非常适合在团队内部使用. 官方只提供了Debian/Ubuntu系统下的安 ...

  2. centos 7.4 安装gitlab

    centos 7.4 安装gitlab #curl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/scrip ...

  3. Centos 6 搭建安装 Gitlab

    官方安装教程 gitlab / gitlab-ce 官网下载:https://www.gitlab.cc/downloads 官网安装说明:https://doc.gitlab.cc/ce/insta ...

  4. centos 8.3安装 一键安装部署gitlab

    安装和配置gitlab必须的依赖包 [root@gitlabdev ~]#dnf install -y curl policycoreutils openssh-server perl 设置开机自启s ...

  5. Ubuntu 简单安装和配置 GitLab

    使用的 Ubuntu Server 16.04 LTS 版本,服务器托管在 Azure 上,用的 1 元试用 1 个月服务器订阅(1500 元额度). 安装命令(推荐使用): curl -sS htt ...

  6. Centos7安装部署搭建gitlab平台、汉化

    Centos7安装部署搭建gitlab平台.汉化 安装环境要求:内存不要小于4G,否则后期web界面可能会报错 一.准备工作 1.1 查看系统版本 首先查询系统版本,下载Gitlab的对应版本 [ro ...

  7. Gitlab(2)- centos7.x 下安装社区版 Gitlab 以及它的配置管理

    前置准备:虚拟机安装以及配置相关 包含安装 centos7.8 虚拟机.设置静态 ip 等 https://www.cnblogs.com/poloyy/category/1703784.html 注 ...

  8. MonoDevelop 4.2.2/Mono 3.4.0 in CentOS 6.5 安装笔记

    MonoDevelop 4.2.2/Mono 3.4.0 in CentOS 6.5 安装笔记 说明 以root账户登录Linux操作系统,注意:本文中的所有命令行前面的 #> 表示命令行提示符 ...

  9. Centos、Ubuntu 安装 Mono、Jexus

    Mono是.NET的跨平台实现 在众多关于语言的争论中,.NET一直被以不能跨平台而诟病,Mono改变了这一现状. 有人当心Mono会涉及版权啥的问题.高深的偶不懂,不过我觉得Unity3D都能用,为 ...

随机推荐

  1. python输出显示颜色

    显示颜色格式:\033[显示方式;字体色;背景色m......[\033[0m] ------------------------------------------- --------------- ...

  2. 适配android和iOS上position:absolute和input问题

    //适配android上absolute和input的问题var oHeight = $(document).height(); //屏幕当前的高度$(window).resize(function( ...

  3. Java类、超类、包

    定义和实例化与C#相同   特殊变量     super当前对象的父类,用于调用父类的变量和方法     this当前类对象                存取限制有3个     没有C#的inter ...

  4. 【repost】 原生JS执行环境与作用域深入理解

    首先,我们要知道执行环境和作用域是两个完全不同的概念. 函数的每次调用都有与之紧密相关的作用域和执行环境.从根本上来说,作用域是基于函数的,而执行环境是基于对象的(例如:全局执行环境即window对象 ...

  5. (最大上升子序列)Monkey and Banana -- hdu -- 1069

    http://acm.hdu.edu.cn/showproblem.php?pid=1069      Monkey and Banana Time Limit:1000MS     Memory L ...

  6. java基础-day6

    第06天 java基础语法 今日内容介绍 u Eclipse断点调试 u 基础语法的练习 第1章   Eclipse断点调试 1.1      Eclipse断点调试概述 Eclipse的断点调试可以 ...

  7. W-TinyLFU——设计一个现代的缓存

    缓存设计是个基础架构领域里的重要话题,本号之前也有谈论过相关话题,点击原文可以看之前的介绍. 近日,HighScalability网站刊登了一篇文章,由前Google工程师发明的W-TinyLFU—— ...

  8. 基于FPGA的I2C读写EEPROM

    I2C在芯片的配置中应用还是很多的,比如摄像头.VGA转HDMI转换芯片,之前博主分享过一篇I2C协议的基础学习IIC协议学习笔记,这篇就使用Verilog来实现EEPROM的读写,进行一个简单的I2 ...

  9. hdu 1695 GCD 【莫比乌斯函数】

    题目大意:给你 a , b , c , d , k 五个值 (题目说明了 你可以认为 a=c=1)  x 属于 [1,b] ,y属于[1,d]  让你求有多少对这样的 (x,y)满足gcd(x,y)= ...

  10. hdu 5089 使做对k-1题最大概率的选题方案

    http://acm.hdu.edu.cn/showproblem.php?pid=5089 给出N道难度递增的题目,难度用可能做出的百分比表示,选出K道题目使得做出K-1道题目的概率最大. 选k题的 ...