GitLab5发布快一个月了,决定试用下,5.0最大的特性就是用GitLab-Shell取代了Gitolite,这大大降低了安装难度,不多本人在安装过程中还是越到了一些问题,所以记录下来供要安装GitLab5的朋友参考!

主要参考文档: https://github.com/gitlabhq/gitlabhq/blob/5-0-stable/doc/install/installation.md

安装步骤总览

  1. 安装依赖包
  2. 安装Ruby/RVM
  3. 创建Git用户
  4. 安装GitLab-Shell
  5. 配置数据库
  6. 安装GitLab
  7. 启动

安装依赖库

yum install libicu-devel mysql-devel pcre-devel

安装python,官方要求版本必须在2.5以上,而且不支持3.0,Fedora一般的版本都在2.7以上,因此直接安装源自带的即可

yum install python

安装完查看下版本

python --version

还要确保python2命令有效

python2 --version

如果提示 bash: python2: 未找到命令 ,那你需要link一下

sudo ln -s /usr/bin/python /usr/bin/python2

安装Ruby

  • 源码方式安装
mkdir /tmp/ruby && cd /tmp/ruby 
curl --progress http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p392.tar.gz | tar xz
cd ruby-1.9.3-p392
./configure
make
sudo make install
  • RVM方式
curl -#L https://get.rvm.io | bash -s stable --ruby

默然安装ruby2.0, GitLab推荐用1.9.3

rvm install ruby-1.9.3-p392

还要安装Bundler

sudo gem install bundler

添加系统Git用户

创建一个 git 用户供GitLab使用

adduser --comment 'GitLab' git

让git用户无密码登陆

sudo chmod 644 /etc/shadow vim /etc/shadow

去掉用户的叹号

git:!!:15814:0:99999:7::: 修改为 git::15814:0:99999:7:::

加入sudo组

chmod u+w /etc/sudoers 
vim /etc/sudoers ## Allow root to run any commands anywhere
root ALL=(ALL) ALL
git ALL=(ALL) ALL #加入这行

安装GitLab Shell

切换到git用户

su - git cd ~/

克隆GitLab Shell

git clone https://github.com/gitlabhq/gitlab-shell.git 
cd gitlab-shell

切换到最新的分支

git checkout v1.2.0 

生产配置文件

cp config.yml.example config.yml

更改配置信息,一般就改下你部署的域名地址gitlab_url

vim config.yml 
# Url to gitlab instance. Used for api calls. Should be ends with slash.
gitlab_url: "http://localhost/" #改成你的域名或者IP

安装

./bin/install

安装数据库

gitlab支持mysql和postgresql,这里以mysql为例,postgresql会比较麻烦!

切换回root用户

su - root

安装mysql及开发包

yum install -y mysql-server mysql mysql-devel

启动数据库

service mysqld start

初始化GitLab数据库

mysql -u root -p
Enter password:
Welcome to the MySQL monitor.
Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.5.30 MySQL Community Server (GPL)

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> CREATE USER 'gitlab'@'localhost' IDENTIFIED BY 'gitlab';
Query OK, 0 rows affected (0.01 sec)

mysql> CREATE DATABASE IF NOT EXISTS `gitlabhq_production` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`;
Query OK, 1 row affected (0.00 sec)

mysql> GRANT SELECT, LOCK TABLES, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON `gitlabhq_production`.* TO 'gitlab'@'localhost';
Query OK, 0 rows affected (0.00 sec)

mysql> \q
Bye

测试gitlab用户连接mysql

sudo -u git -H mysql -u gitlab -p -D gitlabhq_production

安装GitLab

终于到GitLab的安装了,进入git用户

su - git
cd ~/

克隆GitLab

sudo -u git -H git clone https://github.com/gitlabhq/gitlabhq.git gitlab 
cd gitlab

切换到5.0稳定分支

sudo -u git -H git checkout 5-0-stable

配置

cd /home/git/gitlab 
# 用样例配置生成gitlab配置
sudo -u git -H cp config/gitlab.yml.example config/gitlab.yml

# 更改域名
sudo -u git -H vim config/gitlab.yml

# 确保gitlab对 log/ 和 tmp/ 目录有写权限
sudo chown -R git log/
sudo chown -R git tmp/
sudo chmod -R u+rwX log/
sudo chmod -R u+rwX tmp/

# 创建附属目录
sudo -u git -H mkdir /home/git/gitlab-satellites

# 创建pids目录并确保对gitlab可写
sudo -u git -H mkdir tmp/pids/
sudo chmod -R u+rwX tmp/pids/

# 生成Unicorn配置
sudo -u git -H cp config/unicorn.rb.example config/unicorn.rb

配置GitLab DB设置

# Mysql sudo -u git cp config/database.yml.mysql config/database.yml

安装Gems

cd /home/git/gitlab
sudo gem install charlock_holmes --version '0.6.9'
# For MySQL (note, the option says "without")
bundle install --deployment --without development test postgres

初始化数据并激活高级特性

首先编辑/home/git/gitlab/config/database.yml

#
# PRODUCTION
#
production:
adapter: mysql2
encoding: utf8
reconnect: false
database: gitlabhq_production
pool: 5
username: root
password: "secure password" #更改为你mysql的root用户密码
# host: localhost
# socket: /tmp/mysql.sock
#

执行rake

bundle exec rake gitlab:setup RAILS_ENV=production
报错了,提示 Error connecting to Redis on localhost:6379 (ECONNREFUSED)
解决办法:
切到root,安装Redis
bc(command). yum install redis*
service redis start #启动redis

重新执行rake

bundle exec rake gitlab:setup RAILS_ENV=production
如果你安装最新版可能会报 /home/git/repositories/root 目录找不到,手工建上即可!

如果你看到如下信息:

...
Administrator account created:
login.........admin@local.host
password......5iveL!fe

恭喜你!你已经成功安装GitLab了!别忘了记录输出的管理用户名和密码!

启动

Lab5.0安装全过程

GitLab5发布快一个月了,决定试用下,5.0最大的特性就是用GitLab-Shell取代了Gitolite,这大大降低了安装难度,不多本人在安装过程中还是越到了一些问题,所以记录下来供要安装GitLab5的朋友参考!

主要参考文档: https://github.com/gitlabhq/gitlabhq/blob/5-0-stable/doc/install/installation.md

安装步骤总览

  1. 安装依赖包
  2. 安装Ruby/RVM
  3. 创建Git用户
  4. 安装GitLab-Shell
  5. 配置数据库
  6. 安装GitLab
  7. 启动

安装依赖库

yum install libicu-devel mysql-devel pcre-devel

安装python,官方要求版本必须在2.5以上,而且不支持3.0,Fedora一般的版本都在2.7以上,因此直接安装源自带的即可

yum install python

安装完查看下版本

python --version

还要确保python2命令有效

python2 --version

如果提示 bash: python2: 未找到命令 ,那你需要link一下

sudo ln -s /usr/bin/python /usr/bin/python2

安装Ruby

  • 源码方式安装
mkdir /tmp/ruby && cd /tmp/ruby 
curl --progress http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p392.tar.gz | tar xz
cd ruby-1.9.3-p392
./configure
make
sudo make install
  • RVM方式
curl -#L https://get.rvm.io | bash -s stable --ruby

默然安装ruby2.0, GitLab推荐用1.9.3

rvm install ruby-1.9.3-p392

还要安装Bundler

sudo gem install bundler

添加系统Git用户

创建一个 git 用户供GitLab使用

adduser --comment 'GitLab' git

让git用户无密码登陆

sudo chmod 644 /etc/shadow vim /etc/shadow

去掉用户的叹号

git:!!:15814:0:99999:7::: 修改为 git::15814:0:99999:7:::

加入sudo组

chmod u+w /etc/sudoers 
vim /etc/sudoers ## Allow root to run any commands anywhere
root ALL=(ALL) ALL
git ALL=(ALL) ALL #加入这行

安装GitLab Shell

切换到git用户

su - git cd ~/

克隆GitLab Shell

git clone https://github.com/gitlabhq/gitlab-shell.git 
cd gitlab-shell

切换到最新的分支

git checkout v1.2.0 

生产配置文件

cp config.yml.example config.yml

更改配置信息,一般就改下你部署的域名地址gitlab_url

vim config.yml 
# Url to gitlab instance. Used for api calls. Should be ends with slash.
gitlab_url: "http://localhost/" #改成你的域名或者IP

安装

./bin/install

安装数据库

gitlab支持mysql和postgresql,这里以mysql为例,postgresql会比较麻烦!

切换回root用户

su - root

安装mysql及开发包

yum install -y mysql-server mysql mysql-devel

启动数据库

service mysqld start

初始化GitLab数据库

mysql -u root -p
Enter password:
Welcome to the MySQL monitor.
Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.5.30 MySQL Community Server (GPL)

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> CREATE USER 'gitlab'@'localhost' IDENTIFIED BY 'gitlab';
Query OK, 0 rows affected (0.01 sec)

mysql> CREATE DATABASE IF NOT EXISTS `gitlabhq_production` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`;
Query OK, 1 row affected (0.00 sec)

mysql> GRANT SELECT, LOCK TABLES, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON `gitlabhq_production`.* TO 'gitlab'@'localhost';
Query OK, 0 rows affected (0.00 sec)

mysql> \q
Bye

测试gitlab用户连接mysql

sudo -u git -H mysql -u gitlab -p -D gitlabhq_production

安装GitLab

终于到GitLab的安装了,进入git用户

su - git
cd ~/

克隆GitLab

sudo -u git -H git clone https://github.com/gitlabhq/gitlabhq.git gitlab 
cd gitlab

切换到5.0稳定分支

sudo -u git -H git checkout 5-0-stable

配置

cd /home/git/gitlab 
# 用样例配置生成gitlab配置
sudo -u git -H cp config/gitlab.yml.example config/gitlab.yml

# 更改域名
sudo -u git -H vim config/gitlab.yml

# 确保gitlab对 log/ 和 tmp/ 目录有写权限
sudo chown -R git log/
sudo chown -R git tmp/
sudo chmod -R u+rwX log/
sudo chmod -R u+rwX tmp/

# 创建附属目录
sudo -u git -H mkdir /home/git/gitlab-satellites

# 创建pids目录并确保对gitlab可写
sudo -u git -H mkdir tmp/pids/
sudo chmod -R u+rwX tmp/pids/

# 生成Unicorn配置
sudo -u git -H cp config/unicorn.rb.example config/unicorn.rb

配置GitLab DB设置

# Mysql sudo -u git cp config/database.yml.mysql config/database.yml

安装Gems

cd /home/git/gitlab
sudo gem install charlock_holmes --version '0.6.9'
# For MySQL (note, the option says "without")
bundle install --deployment --without development test postgres

初始化数据并激活高级特性

首先编辑/home/git/gitlab/config/database.yml

#
# PRODUCTION
#
production:
adapter: mysql2
encoding: utf8
reconnect: false
database: gitlabhq_production
pool: 5
username: root
password: "secure password" #更改为你mysql的root用户密码
# host: localhost
# socket: /tmp/mysql.sock
#

执行rake

bundle exec rake gitlab:setup RAILS_ENV=production
报错了,提示 Error connecting to Redis on localhost:6379 (ECONNREFUSED)
解决办法:
切到root,安装Redis
bc(command). yum install redis*
service redis start #启动redis

重新执行rake

bundle exec rake gitlab:setup RAILS_ENV=production
如果你安装最新版可能会报 /home/git/repositories/root 目录找不到,手工建上即可!

如果你看到如下信息:

...
Administrator account created:
login.........admin@local.host
password......5iveL!fe

恭喜你!你已经成功安装GitLab了!别忘了记录输出的管理用户名和密码!

启动GitLab

bundle exec rails s -e production
=> Booting WEBrick
=> Rails 3.2.13 application starting in production on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2013-04-19 15:04:41] INFO WEBrick 1.3.1
[2013-04-19 15:04:41] INFO ruby 1.9.3 (2013-02-22)
[x86_64-linux] [2013-04-19 15:04:41] INFO WEBrick::HTTPServer#start: pid=11488 port=3000

Ok,你现在可以访问GitLab了,默认端口是 @3000@, 访问 http://你的域名或IP:3000
第一访问会比较慢,因为要编译很多js和css.

哈哈!看到登陆页面了吧!

输入管理用户名和密码!开始享受GitLab吧!

2013-04-19
bundle exec rails s -e production
=> Booting WEBrick
=> Rails 3.2.13 application starting in production on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2013-04-19 15:04:41] INFO WEBrick 1.3.1
[2013-04-19 15:04:41] INFO ruby 1.9.3 (2013-02-22)
[x86_64-linux] [2013-04-19 15:04:41] INFO WEBrick::HTTPServer#start: pid=11488 port=3000

Ok,你现在可以访问GitLab了,默认端口是 @3000@, 访问 http://你的域名或IP:3000
第一访问会比较慢,因为要编译很多js和css.

哈哈!看到登陆页面了吧!

输入管理用户名和密码!开始享受GitLab吧!

2013-04-19

GitLab5的更多相关文章

  1. Kubernetes – Ingress

    用户在 Kubernetes 上部署的服务一般运行于私有网络,Pod和Service 提供了 hostPort,NodePort等参数用于暴露这些服务端口到K8S节点上,供使用者访问.这样的方法有明显 ...

随机推荐

  1. 服务器端-W3Chool:服务器脚本教程

    ylbtech-服务器端-W3Chool:服务器脚本教程 1.返回顶部 1. 服务器脚本教程 从左侧的菜单选择你需要的教程! SQL SQL 是用于访问和处理数据库的标准的计算机语言. 在本教程中,您 ...

  2. 分布式任务队列 Celery —— 详解工作流

    目录 目录 前文列表 前言 任务签名 signature 偏函数 回调函数 Celery 工作流 group 任务组 chain 任务链 chord 复合任务 chunks 任务块 mapstarma ...

  3. Linux_NetworkManager_RHEL7

    目录 目录 前言 网卡命名 RHEL7 的网卡命名规则 在RHEL7中修改回RHEL6的网卡命名规则方法 RHEL7的Network管理工具nmcli指令 nmcli指令 设置主机名 临时修改Host ...

  4. 测开之路一百五十五:jquery-validation前台数据验证

    前面做的wtform验证是服务器端的验证,需要把数据传输到服务器,服务器验证后再吧结果传输到前端,网络慢的时候,用户体验不好,所以需要前端验证,且后端验证不能少 传统的js或者jquery如果要验证信 ...

  5. 【css】子元素浮动到了父元素外,父元素没有随子元素自适应高度,如何解决?

    正常情况 如果子元素没有设置浮动(float),父元素的高度会随着子元素高度的改变而改变的. 设置浮动以后 父元素的高度不会随着子元素的高度而变化. 例如:在一个ul中定义若干个li,并设置float ...

  6. MVC中的cshtml与ASPX的区别

    在MVC3中,即可以使用cshtml,也可以使用aspx, 这两者到底有什么区别呢? 越详细越好,如果是用来正式开发,用哪种比较好. --------------------------------- ...

  7. Maximum Depth of Binary Tree(二叉树最大深度)

    来源:https://leetcode.com/problems/maximum-depth-of-binary-tree Given a binary tree, find its maximum ...

  8. 第9周总结&实验报告7

    完成火车站售票程序的模拟. 要求:(1)总票数1000张:(2)10个窗口同时开始卖票:(3)卖票过程延时1秒钟:(4)不能出现一票多卖或卖出负数号票的情况.一:实验代码 package first; ...

  9. ubuntu 虚拟机安装

    ubuntu16.04.5 LTS 安装   1.下载ubuntu镜像 打开ubuntu官网镜像地址https://launchpad.net/ubuntu/+cdmirrors 在上面中搜索chin ...

  10. 18: vue-element-admin使用

    1.1 vue-element-admin使用 1.使用参考网站 1)官方演示环境: https://panjiachen.github.io/vue-element-admin/#/dashboar ...