Gitlab 是一个用Ruby on Rails开发的开源项目管理程序,可以通过WEB界面进行访问公开的或者私人项目。它和Github有类似的功能,能够浏览源代码,管理缺陷和注释。

git 一种版本控制系统,是一个命令,是一种工具
gitlib 一个用于实现git功能的开发库
github 一个基于git实现的在线代码托管仓库,包含一个网站界面,向互联网开放
gitlab 一个基于git实现的在线代码仓库托管软件,你可以用gitlab自己搭建一个类似于github一样的系统,一般用于在企业、学校等内部网络搭建git私服

 

Gitlab 官方下载: https://about.gitlab.com/downloads

Gitlab 官方源码: https://gitlab.com/gitlab-org/gitlab-ce/  (gitlab

Gitlab 官方安装:Omnibus package installation

 

Gitlab CE 与 EE

Gitlab 分为社区版(CE,Community Edition)和企业版(EE,Enterprise Edition)

Gitlab CE社区版是免费的,EE企业版是收费的

收费价格如下:https://about.gitlab.com/products

gitlab-build-your-own-private-github-01

Gitlab CE社区版,不支持数据库自定义配置为MySQL,不支持Jenkins,如下图:

gitlab-build-your-own-private-github-02

CE和EE的价格和功能的更多区别,查看官网:https://about.gitlab.com/products

 

 

CentOS 安装 GitLab

 Check if your server meets the hardware requirements

Download the Omnibus package and install everything

gitlab-ce.x86_64 9.1.2-ce.0.el6   或   gitlab-ee-9.1.2-ee.0.el6.x86_64.rpm

1. 搭建预装环境和软件

sudo yum install curl openssh-server openssh-clients 
sudo yum install postfix    // sendmail or exim is OK
sudo yum install cronie
sudo service postfix start
sudo chkconfig postfix on
sudo lokkit -s http -s ssh  // open firewall for HTTP and SSH
sudo rpm -i gitlab-7.5.1_omnibus.5.2.0.ci-1.el6.x86_64.rpm

 

2. 添加Gitlab安装包

Add the GitLab package server and install the package

curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash sudo yum install gitlab-ce

If you are not comfortable installing the repository through a piped script, you can find the entire script here and select and download the package manually and install using

curl -LJO https://packages.gitlab.com/gitlab/gitlab-ce/packages/el/6/gitlab-ce-XXX.rpm/download 
rpm -i gitlab-ce-XXX.rpm

实例下载安装 gitlab-ce-9.1.2-ce.0.el7.x86_64 中国区推荐下文的:RHEL/CentOS 用户 (CentOS 6.5 推荐)

curl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
wget https://packages-gitlab-com.s3-accelerate.amazonaws.com/7/8/ol/7/package_files/11912.rpm?AWSAccessKeyId=AKIAJ74R7IHMTQVGFCEA&Signature=urItpMcMBUsyJFr7sJKMC5VYZFo%3D&Expires=1494077797
sudo yum install gitlab-ce-9.1.2-ce.0.el7.x86_64

 

3. 配置Gitlab

Configure and start GitLab(配置并启动gitlab)

sudo gitlab-ctl reconfigure

 

4. 访问Gitlab

浏览器访问: http://localhosthttp://127.0.0.1http://ip

Username: root 
Password: 5iveL!fe

For troubleshooting and configuration options please see the Omnibus GitLab readme

 

自动化脚本安装小结

主配置文件:/etc/gitlab/gitlab.rb                    // 可自定义一些邮件服务等

日志地址:/var/log/gitlab/                             // 对应各服务的打印日志

服务地址:/var/opt/gitlab/                             // 对应各服务的主目录

仓库地址:/var/opt/gitlab/git-data                 // 记录项目仓库等提交信息

重置配置:gitlab-ctl reconfigure                      // 不要乱用,会重置为最原始的配置的

重启服务:gitlab-ctl  stop/start/restart/status  // 启动命令

默认安装:postgres、nginx、redis、unicorn ......

 

Gitlab 服务构成

  • nginx : 静态Web服务器
  • gitlab-shell : 用于处理Git命令和修改authorized keys列表
  • gitlab-workhorse : 轻量级的反向代理服务器
  • logrotate : 日志文件管理工具
  • postgresql : 数据库,也可以是 MySQL
  • redis :缓存数据库
  • sidekiq :用于在后台执行队列任务(异步执行)
  • unicorn :An HTTP server for Rack applications,GitLab Rails应用是托管在这个服务器上面的。

 

Gitlab工作流程

gitlab-build-your-own-private-github-05

 

Gitlab 安装步骤

1. Debian/Ubuntu 用户

首先信任 GitLab 的 GPG 公钥:

curl https://packages.gitlab.com/gpg.key 2> /dev/null | sudo apt-key add - &>/dev/null

再选择你的 Debian/Ubuntu 版本,文本框中内容写进 

suod vim /etc/apt/sources.list.d/gitlab-ce.list

Ubuntu 12.04 LTS

deb http://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/debian jessie main

安装 gitlab-ce:

sudo apt-get update
sudo apt-get install gitlab-ce

 

2. RHEL/CentOS 用户 (CentOS 6.5 推荐)

新建repo文件

sudo vim /etc/yum.repos.d/gitlab-ce.repo

repo文件内容为

[gitlab-ce]
name=Gitlab CE Repository
baseurl=https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el$releasever/
gpgcheck=0
enabled=1

再执行

sudo yum makecache
sudo yum install gitlab-ce

 

Gitlab 配置外部访问 URL

vim /etc/gitlab/gitlab.rb

修改 external_url 'hostname' 为 external_url='http://gitlab.mimvp.com'

其中, 'http://gitlab.mimvp.com' 为服务器的对外IP地址

 

Configure and start GitLab

sudo gitlab-ctl reconfigure    // 更改配置文件后,重新加载使改动配置生效,并启动gitlab
sudo lokkit -s http -s ssh     // open firewall for HTTP and SSH

 

Gitlab 服务的开启、关闭、重启

sudo gitlab-ctl start
sudo gitlab-ctl stop
sudo gitlab-ctl restart
sudo gitlab-ctl uninstall

gitlab 查看状态

# sudo gitlab-ctl status
run: postgresql: (pid 18097) 3054s; run: log: (pid 16788) 4587s
run: redis: (pid 18105) 3053s; run: log: (pid 16768) 4589s

 

Browse to the hostname and login 

浏览器访问: http://localhosthttp://127.0.0.1http://ip

Username: root 
Password: 5iveL!fe

For troubleshooting and configuration options please see the Omnibus GitLab readme

Tweet about it!

 

gitlab-ctl 命令帮助

gitlab-ctl help

[root@ithomer ~]# gitlab-ctl help
/opt/gitlab/embedded/bin/omnibus-ctl: command (subcommand)
cleanse
  Delete *all* gitlab data, and start from scratch.
deploy-page
  Put up the deploy page
graceful-kill
  Attempt a graceful stop, then SIGKILL the entire process group.
help
  Print this help message.
hup
  Send the services a HUP.
int
  Send the services an INT.
kill
  Send the services a KILL.
once
  Start the services if they are down. Do not restart them if they stop.
reconfigure
  Reconfigure the application.
restart
  Stop the services if they are running, then start them again.
service-list
  List all the services (enabled services appear with a *.)
show-config
  Show the configuration that would be generated by reconfigure.
start
  Start services if they are down, and restart them if they stop.
status
  Show the status of all the services.
stop
  Stop the services, and do not restart them.
tail
  Watch the service logs of all enabled services.
term
  Send the services a TERM.
uninstall
  Kill all processes and uninstall the process supervisor (data will be preserved).

 

查看端口占用:

netstat -anpt | grep 80

[root@ithomer ~]# netstat -anpt | grep 80
tcp        0      0 0.0.0.0:80                  0.0.0.0:*                   LISTEN      22589/httpd         
tcp        0      0 0.0.0.0:8080                0.0.0.0:*                   LISTEN      1874/java           
tcp        0      0 0.0.0.0:6080                0.0.0.0:*                   LISTEN      25882/nginx         
tcp        0      0 127.0.0.1:8005              0.0.0.0:*                   LISTEN      1874/java           
tcp        0      0 0.0.0.0:7080                0.0.0.0:*                   LISTEN      26235/nginx         
tcp        0      0 115.29.237.28:49169         115.29.237.28:80            TIME_WAIT   -                   
tcp        0      0 115.29.237.28:7080          218.30.180.179:36651        TIME_WAIT   -                   
tcp        0      0 115.29.237.28:49178         115.29.237.28:80            TIME_WAIT   -                   
tcp        0      0 115.29.237.28:80            221.237.112.103:51404       FIN_WAIT2   -               

 

 

问题1:Shutting down postfix:   [FAILED]

[root@ithomer ~]# service postfix restart
Shutting down postfix:                                     [FAILED]

原因: 可能是与 sendmail 想冲突,由于 postfix 是基于 sendmail 的

解决: 

[root@ithomer gitlab-ce.git]# service sendmail stop
Shutting down sm-client:                                   [  OK  ]
Shutting down sendmail:                                    [  OK  ]
[root@ithomer gitlab-ce.git]#
service postfix start
Starting postfix:                                          [  OK  ]

 

问题2: FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)

[root@ithomer ~]# sudo gitlab-ctl reconfigure
Starting Chef Client, version 11.12.2
Compiling Cookbooks...
Recipe: gitlab::default
  * directory[/etc/gitlab] action create (up to date)

...........

[2014-11-26T17:50:59+08:00] ERROR: Exception handlers complete
[2014-11-26T17:50:59+08:00] FATAL: Stacktrace dumped to /opt/gitlab/embedded/cookbooks/cache/chef-stacktrace.out
Chef Client failed. 0 resources updated in 7.198200313 seconds
[2014-11-26T17:50:59+08:00] ERROR: Cannot allocate memory - fork(2)
[2014-11-26T17:51:00+08:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)

解决:

vim /etc/gitlab/gitlab.rb

修改 external_url 'hostname' 为 external_url='115.29.237.28'

其中, '115.29.237.28' 为服务器的对外IP地址

 

问题3: 为了避免nginx 80端口与其它服务(httpd,tomcat)冲突,修改80端口为8080

解决: 

vim /var/opt/gitlab/nginx/conf/gitlab-http.conf

修改:

 server {
  listen *:80;
  server_name ithomer;

为:

server {
  listen *:
8080;
  server_name
118.29.237.28;

重启 gitlab 内嵌的 nginx

/opt/gitlab/embedded/sbin/nginx -p /var/opt/gitlab/nginx

注: 系统单独安装的nginx启动方法

service nginx restart

service nginx start

service nginx stop

 

问题4: gem install rugged -v '0.25.1.1'

Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=/usr/local/bin/$(RUBY_BASE_NAME)
        --use-system-libraries

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /home/git/gitlab/vendor/bundle/ruby/2.4.0/extensions/x86_64-linux/2.4.0-static/rugged-0.25.1.1/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /home/git/gitlab/vendor/bundle/ruby/2.4.0/gems/rugged-0.25.1.1 for inspection.
Results logged to
/home/git/gitlab/vendor/bundle/ruby/2.4.0/extensions/x86_64-linux/2.4.0-static/rugged-0.25.1.1/gem_make.out

An error occurred while installing rugged (0.25.1.1), and Bundler cannot continue.
Make sure that `gem install rugged -v '0.25.1.1'` succeeds before bundling.

原因:缺少安装环境,cmake编译命令

解决sudo yum install cmake gmake python-devel libicu-devel zlib-devel

 

问题5: gem install mysql2 -v '0.3.20'

Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=/usr/local/bin/$(RUBY_BASE_NAME)
        --with-mysql-dir
        --without-mysql-dir
        --with-mysql-include
        --without-mysql-include=${mysql-dir}/include
        --with-mysql-lib
        --without-mysql-lib=${mysql-dir}/lib
        --with-mysql-config
        --without-mysql-config

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /home/git/gitlab/vendor/bundle/ruby/2.4.0/extensions/x86_64-linux/2.4.0-static/mysql2-0.3.20/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /home/git/gitlab/vendor/bundle/ruby/2.4.0/gems/mysql2-0.3.20 for inspection.
Results logged to /home/git/gitlab/vendor/bundle/ruby/2.4.0/extensions/x86_64-linux/2.4.0-static/mysql2-0.3.20/gem_make.out

An error occurred while installing mysql2 (0.3.20), and Bundler cannot continue.
Make sure that `gem install mysql2 -v '0.3.20'` succeeds before bundling.

原因:缺少ruby的mysql驱动包

解决

1. CentOS 安装 mysql-devel

sudo yum -y install mysql-devel

2. Debian/Ubuntu 安装

sudo apt-get -y install libmysql-ruby libmysqlclient-dev

# gem install mysql2 -v '0.3.20' -- --ruby=/usr/local/bin/ruby --with-mysql-dir=/usr/bin/mysql --with-mysql-config=/usr/bin/mysql_config  

 

错误6: ExecJS::RuntimeUnavailable: Could not find a JavaScript runtime.

See https://github.com/rails/execjs for a list of available runtimes.

解决:

1、ubuntu

sudo apt-get -y install nodejs

2、centos/redhat

sudo yum -y install nodejs

3、vim Gemfile

添加:

gem 'execjs'
gem 'therubyracer'

安装:

bundle install

 

错误7:Couldn't drop gitlabhq_production
#<Mysql2::Error: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (111 "Connection refused")>

Couldn't drop gitlabhq_production
#<Mysql2::Error: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (111 "Connection refused")>
Couldn't create database for {"adapter"=>"mysql2", "encoding"=>"utf8", "collation"=>"utf8_general_ci", "reconnect"=>false, "database"=>"gitlabhq_production", "pool"=>10, "username"=>"gitlab", "password"=>"123456", "host"=>"localhost", "socket"=>"/tmp/mysql.sock"}, {:charset=>"utf8", :collation=>"utf8_general_ci"}
(If you set the charset manually, make sure you have a matching collation)
-- enable_extension("plpgsql")
rake aborted!
Mysql2::Error: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (111 "Connection refused")

原因: /tmp/mysql.sock 找不到,无法连接MySQL

解决: 查询启动的 MySQL,然后软连接到 /tmp/mysql.sock

[root@mimvp script]# ps -ef | grep mysql
root      9198     1  0 10:31 pts/1    00:00:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --socket=/var/lib/mysql/mysql.sock --pid-file=/var/run/mysqld/mysqld.pid --basedir=/usr --user=mysql
[root@mimvp script]# ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock

 

-------------

 

安装方法二:手动编译源码安装不推荐

手动安装教程: gitlab manual installation官方安装文档

下面介绍如何在 Debian/Ubuntu 和 Centos 下搭建配置 Gitlab。

1. 安装依赖

1. Debian/Ubuntu:

sudo apt-get install -y build-essential zlib1g-dev libyaml-dev libssl-dev libgdbm-dev libreadline-dev libncurses5-dev libffi-dev curl openssh-server redis-server checkinstall libxml2-dev libxslt-dev libcurl4-openssl-dev libicu-dev logrotate

安装python (注意需要2.5以上版本  python --version):

sudo apt-get install -y python python-docutils

安装git注意需要1.7.10以上版本 git --version):

sudo apt-get install -y git-core

 

2. CentOS

官方仓库的软件比较老旧,推荐先添加epel源:

安装epel,centos6选6,5就选5

32位系统选择:

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位系统选择:

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

导入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这个文件就行了

然后再安装依赖(一定要安装,重点安装 cmake python-devel libicu-devel zlib-devel):

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

 

2. 安装 Ruby 2.0

需要安装Ruby2.0 (ruby --version),软件仓库中的Ruby 1.8不支持:

Ruby 官方下载: https://www.ruby-lang.org/en/downloads/

Ruby 最新版本:ruby-2.4.1.tar.gz

mkdir /tmp/ruby && cd /tmp/ruby
wget https://cache.ruby-lang.org/pub/ruby/2.4/ruby-2.4.1.tar.gz 
tar zxvf ruby-2.4.1.tar.gz
mv ruby-2.4.1 /opt/
cd /opt/ruby-2.4.1/
./configure --disable-install-rdoc
make
sudo make install

安装Bundler Gem:

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

:gem是Ruby环境中的包管理器,好比于Python中的pip与JavaScript本地Node.js的npm

Bundler使用Ruby语言写的,通过跟踪和安装运行Ruby项目所需要的确切的gem和版本,为Ruby项目提供了完整的可运行环境。Bundler跳出了复杂的环境依赖,并且确保下载你在development, staging, and productionBundler这三个阶段所需要的gem源。

开始一个项目的工作只需要一个简单的命令:bundle install

Bundler是一种有用的工具,它能使你更方便地跟踪某个应用程序所依赖的gem(以及这些gem的版本)。它通过安装应用程序的Gemfile中的所有gem来做到这一点。

Bundler 安装:gem install bundler

Bundler 升级:gem update bundler

 

3. 配置 gitlab-shell

创建git用户:

sudo adduser --system --create-home --comment 'GitLab' git  
cd /home/git/

配置gitlab-shell

cd /home/git/
su - git -c "git clone https://gitlab.com/gitlab-org/gitlab-workhorse.git"
su - git -c "yum -y install go && cd /home/git/gitlab-workhorse/ && make install"
su - git -c "git clone https://github.com/gitlabhq/gitlab-shell.git"  
su - git -c "cd gitlab-shell && git checkout v5.0.0"  // 需要修改版本号
su - git -c "cp gitlab-shell/config.yml.example gitlab-shell/config.yml"  
sed -i "s/localhost:8080/115.29.238.18:8080/g" /home/git/gitlab-shell/config.yml  // 修改外部域名
su - git -c "gitlab-shell/bin/install"  
chmod 600 /home/git/.ssh/authorized_keys  
chmod 700 /home/git/.ssh

注意:如果修改 gitlab_url: "http://localhost:8080/" 为 gitlab_url: "http://115.29.238.18:8080/"   // 修改外部域名

命令 su - git -c "gitlab-shell/bin/install"  执行结果:

# su - git -c "gitlab-shell/bin/install" 
mkdir -p /home/git/repositories: true
mkdir -p /home/git/.ssh: true
chmod 700 /home/git/.ssh: true
touch /home/git/.ssh/authorized_keys: true
chmod 600 /home/git/.ssh/authorized_keys: true
chmod -R ug+rwX,o-rwx /home/git/repositories: true
find /home/git/repositories -type d -print0 | xargs -0 chmod g+s: true

 

4. 安装数据库

GitLab支持 MySQL 和 PostgreSQL 数据库,下面以 MySQL为例,介绍安装方法:

1. Debian/Ubuntu 下命令安装MySQL:

sudo apt-get install -y mysql-server mysql-client libmysqlclient-dev

2. CentOS 下命令安装MySQL:

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 -uroot -p
sudo echo "UPDATE mysql.user SET Password=PASSWORD('123456') WHERE User='gitlab'; FLUSH PRIVILEGES;" | mysql -uroot -p

注意,第一句创建生产数据库 gitlabhq_production,第二句新增用户 gitlab,其密码为123456

更多MySQL命令见官网: Database MySQL

 

5. 安装配置 gitlab

cd /home/git/
su - git -c "git clone https://github.com/gitlabhq/gitlabhq.git gitlab"  
su - git -c "cd gitlab;git checkout 9-1-stable"    // 需要修改版本号
​cd /home/git/gitlab/
su git -c "cp config/gitlab.yml.example config/gitlab.yml"  
su git -c "mkdir /home/git/gitlab-satellites"  
cd /home/git/gitlab/
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: gitlab.mimvp.com/g" gitlab/config/gitlab.yml  // 修改外部域名
sed -i "s/from: gitlab@localhost/from: gitlab@gmimvp.com/g" gitlab/config/gitlab.yml  
su git -c "cp config/puma.rb.example config/puma.rb"   // 没有此配置文件
su git -c 'git config --global user.name "gitlab-mimvp"'  
su git -c 'git config --global user.email "gitlab@mimvp.com"'
su git -c 'git config -l'

注意将 gitlab-mimvp 和gitlab.mimvp.com替换为你自己的内容。

 

6. 配置 MySQL

启用MySQL,复制mysql配置文件为gitlab默认的配置文件,并修改mysql配置文件密码,如下:

cd /home/git/gitlab/
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

# For PostgreSQL (note, the option says "without ... mysql")
sudo -u git -H bundle install --deployment --without development test mysql aws kerberos

# Or if you use MySQL (note, the option says "without ... postgres")
cd /home/git/gitlab/
sudo -u git -H bundle install --deployment --without development test postgres aws kerberos
 

cd /home/git/gitlab/
bundle install --deployment --without development test postgres aws   # root权限执行
或者
sudo -u git -H bundle install --deployment --without development test postgres aws

初始化:

cd /home/git/gitlab/
sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production
sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab
sudo chmod +x /etc/init.d/gitlab
sudo cp lib/support/init.d/gitlab.default.example /etc/default/gitlab
sudo update-rc.d gitlab defaults 21        // ubuntu

执行命令 bundle exec rake gitlab:setup RAILS_ENV=production,输入创建的MySQL数据库表如下:

MariaDB [gitlabhq_production]> show tables;
+--------------------------------------+
| Tables_in_gitlabhq_production        |
+--------------------------------------+
| abuse_reports                        |
| appearances                          |
.........
| users                                |
| users_star_projects                  |
| web_hooks                            |
+--------------------------------------+
82 rows in set (0.00 sec)

 

查看是否配置妥当:

sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production

 

7. 配置 Redis

vim /home/git/gitlab/config/resque.yml

development: redis://:password@localhost:6379/数据库(可选)
test: redis://:password@localhost:6379/数据库(可选)
production: redis://:password@localhost:6379/数据库(必选

 

重启GitLab:

sudo service gitlab start

启动后的运行结果:

[git@mimvp gitlab]# /etc/init.d/gitlab status
The GitLab Unicorn web server with pid 16803 is running.
The GitLab Sidekiq job dispatcher with pid 17881 is running.
The GitLab Workhorse with pid 17830 is running.
GitLab and all its components are up and running.

 

 

8. 配置 Nginx

Debian/Ubuntu下:

sudo apt-get install -y nginx

CentOS下:

Nginx 官方地址: http://nginx.org ,最新版本: nginx-1.7.7.tar.gz

sudo yum install nginx

下载配置文件样例:

sudo cp lib/support/nginx/gitlab /etc/nginx/sites-available/gitlab
sudo ln -s /etc/nginx/sites-available/gitlab /etc/nginx/sites-enabled/gitlab

修改 /etc/nginx/sites-available/gitlab,特别留意将 YOUR_SERVER_FQDN 改成自己的。

重启nginx:

sudo service nginx restart

好了,你可以登录GitLab了,默认安装后的用户名:admin@local.host,密码5iveL!fe

 

 

参考推荐:

CentOS 6.5上搭建gitlab服务器 (脚本安装)

CentOS 6.5 安装 gitlab (源码安装)

GitLab 安装与版本管理

GitLab CE Download Archives(官方)

gitlab manual installation官方安装文档

CentOS 6.5安装GitLab全过程和问题记录

CentOS 6下安装gitlab,使用apache作为WebServer

Gitlab + Jenkins 搭建持续集成(CI)环境 (推荐

CentOS 6.5 + Jira 6.3.6 + MySQL 破解汉化安装 (推荐