安装环境:

操作系统:    Ubuntu 12.4 LTS 英文

数据库:        postgresql

webserver: nginx

能够说到7.x的时候,GitLab的文档已经相当完好了!此文作为翻译和部分FAQ.

1. 安装依赖包

(1) 设置默认文本编辑器

使用Vim作为默认文本编辑器

sudo apt-get install -y vim
sudo update-alternatives --set editor /usr/bin/vim.basic

(2) 安装依赖

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-docutils pkg-config cmake

(3) 安装Git

sudo apt-get install -y git-core

注意:

在12.4版本号中,默认的Git版本号为1.7.9.5



          所以,我们要手动安装Git。

I. 移除系统已有版本号的Git

sudo apt-get remove git-core

II. 安装Git依赖包

sudo apt-get install -y libcurl4-openssl-dev libexpat1-dev gettext libz-dev libssl-dev build-essential

III. 下载并安装

我们能够用浏览器看https://www.kernel.org/pub/software/scm/git以下的Git的版本号,选择最新的下载。

cd /tmp
curl -L --progress https://www.kernel.org/pub/software/scm/git/git-2.1.2.tar.gz | tar xz
cd git-2.1.2/
make prefix=/usr/local all

安装位置:/usr/local/(自己主动安装的安装位置为:/usr/bin/)

sudo make prefix=/usr/local install

文档中特别提到,在我们配置gitlab.yml时,一定要改动Git的路径问题!

安装Email工具

sudo apt-get install -y postfix

2. 安装Ruby

(1)移除V1.8

sudo apt-get remove ruby1.8

(2)下载并安装

mkdir /tmp/ruby && cd /tmp/ruby
curl -L --progress ftp://ftp.ruby-lang.org/pub/ruby/2.1/ruby-2.1.2.tar.gz | tar xz
cd ruby-2.1.2
./configure --disable-install-rdoc
make
sudo make install

(3)安装Gem

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

3. 添加GitLab用户

sudo adduser --disabled-login --gecos 'GitLab' git

此用户专用于Gitlab的,不用其它操作。

4. 设置数据库

(1) 安装Postgresql

sudo apt-get install -y postgresql postgresql-client libpq-dev

(2)建库和添加用户

sudo -u postgres psql -d template1
template1=# CREATE USER git CREATEDB;
template1=# CREATE DATABASE gitlabhq_production OWNER git;
template1=# \q

(3)測试用户

sudo -u git -H psql -d gitlabhq_production

5. 安装Redis

sudo apt-get install redis-server
sudo cp /etc/redis/redis.conf /etc/redis/redis.conf.orig
sed 's/^port .*/port 0/' /etc/redis/redis.conf.orig | sudo tee /etc/redis/redis.conf
echo 'unixsocket /var/run/redis/redis.sock' | sudo tee -a /etc/redis/redis.conf
sudo service redis-server restart
sudo usermod -aG redis git

6. 配置Gitlab

             进入git用户根文件夹
cd /home/git

(1)同步

sudo -u git -H git clone https://gitlab.com/gitlab-org/gitlab-ce.git -b 7-3-stable gitlab

(2)配置他

I. 文件操作

cd /home/git/gitlab
sudo -u git -H cp config/gitlab.yml.example config/gitlab.yml
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
sudo chmod u+rwx,g=rx,o-rwx /home/git/gitlab-satellites
sudo chmod -R u+rwX tmp/pids/
sudo chmod -R u+rwX tmp/sockets/
sudo chmod -R u+rwX public/uploads
sudo -u git -H cp config/unicorn.rb.example config/unicorn.rb
sudo -u git -H cp config/initializers/rack_attack.rb.example config/initializers/rack_attack.rb
sudo -u git -H cp config/resque.yml.example config/resque.yml

II. 配置Git路径

sudo -u git -H editor config/gitlab.yml

III. 配置Gitlab全局变量

sudo -u git -H git config --global user.name "GitLab"
sudo -u git -H git config --global user.email "example@example.com"
sudo -u git -H git config --global core.autocrlf input

(3)配置Gitlab使用的数据库

我们以Postgresql为例;

sudo -u git cp config/database.yml.postgresql config/database.yml

改动database.yml文件

sudo -u git -H editor config/database.yml

把production部分的user和passwor前面的“#”去掉。

仅git用户能够使用database.yml文件

sudo -u git -H chmod o-rwx config/database.yml

(4)安装Gems

我们以Postgresql为例;

sudo -u git -H bundle install --deployment --without development test mysql aws

注意:因为国内网络管制问题,我们须要不断的重试!出现的错误提示 - 无视之,然后重试(又一次运行上面命令)。

(5)安装GitLab Shell

sudo -u git -H bundle exec rake gitlab:shell:install[v2.0.1] REDIS_URL=unix:/var/run/redis/redis.sock RAILS_ENV=production

(6)初始化数据库

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

(7)开机启动

sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab
sudo cp lib/support/init.d/gitlab.default.example /etc/default/gitlab
sudo update-rc.d gitlab defaults 21

(8)设置Logrotate

sudo cp lib/support/logrotate/gitlab /etc/logrotate.d/gitlab

(9)检查应用程序状态

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

(10)编译Assets

sudo -u git -H bundle exec rake assets:precompile RAILS_ENV=production

(11)启动Gitlab

sudo service gitlab start

7. 配置Nginx

(1)安装Nginx

sudo apt-get install -y nginx

(2)配置site

I. 拷贝模板文件到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

II. 替换“YOUR_SERVER_FQDN”

sudo editor /etc/nginx/sites-available/gitlab

内部网:localhost

(3) 測试并重新启动Nginx

sudo nginx -t
sudo service nginx restart

8. 完毕

(1)再次測试应用状态

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

(2)初始的用户和password

root
5iveL!fe

FAQ:

1. 502问题

因为使用了老版本号Git,比方V1.7.9.5;所以在进行“安装Gems”步骤时,下载了老版本号的Rate,比方V10.1.0;

此文《Ubuntu 1204 装配 GitLab 出现 502》,攻克了这个问题。

sudo gem install rake -v '10.3.2' --source http://rubygems.org

sudo -u git -H bundle exec rake assets:precompile RAILS_ENV=production

在 Ubuntu 12.04 上安装 GitLab7.x的更多相关文章

  1. Ubuntu 12.04上安装R语言

    Ubuntu 12.04上安装R语言 作者:凯鲁嘎吉 - 博客园 http://www.cnblogs.com/kailugaji/ R的安装 sudo gedit /etc/apt/sources. ...

  2. Ubuntu 12.04上安装HBase并运行

    Ubuntu 12.04上安装HBase并运行 作者:凯鲁嘎吉 - 博客园 http://www.cnblogs.com/kailugaji/ 一.HBase的安装 在官网上下载HBase-1.1.2 ...

  3. Ubuntu 12.04上安装MySQL并运行

    Ubuntu 12.04上安装MySQL并运行 作者:凯鲁嘎吉 - 博客园 http://www.cnblogs.com/kailugaji/ 安装MySQL数据库 sudo apt-get upda ...

  4. Ubuntu 12.04上安装Hadoop并运行

    Ubuntu 12.04上安装Hadoop并运行 作者:凯鲁嘎吉 - 博客园 http://www.cnblogs.com/kailugaji/ 在官网上下载好四个文件 在Ubuntu的/home/w ...

  5. Ubuntu 12.04上安装 MongoDB并运行

    Ubuntu 12.04上安装 MongoDB并运行 作者:凯鲁嘎吉 - 博客园 http://www.cnblogs.com/kailugaji/ 在Terminal输入 sudo apt-key ...

  6. 在 Ubuntu 12.04 上安装 GitLab6.0

    安装环境: 操作系统:    Ubuntu 12.4 LTS 英文 数据库:        mysql5.5.32 web服务器: nginx1.4.1 首先, 添加git和nginx的ppa,并升级 ...

  7. ubuntu 12.04上安装QQ2013(转载)

    转自:http://www.cnblogs.com/wocn/p/linux_ubuntu_QQ_install.html 环境介绍: OS:Ubuntu12.04 64bit QQ:WineQQ20 ...

  8. ubuntu 12.04上安装OpenERP 7的一次记录

    登陆ssh, 先更新系统: sudo apt-get update && sudo apt-get dist-upgrade 接着再为openerp运行创建一个系统用户,用户名就叫op ...

  9. 在ubuntu 12.04上安装tomcat 7.40

    因为源上的版本问题,所以没有使用源上的自动安装包,老规矩,Tomcat 7.0.40 Core下载地址:http://mirror.bit.edu.cn/apache/tomcat/tomcat-7/ ...

随机推荐

  1. poj2528(线段树)

    题目连接:http://poj.org/problem?id=2528 题意:在墙上贴海报,海报可以互相覆盖,问最后可以看见几张海报 分析:离散化+线段树,这题因为每个数字其实表示的是一个单位长度,因 ...

  2. 中国科学院信息project研究所 第四研究室实习生/应届生招聘

    watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvU2hpWmhpeGlu/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA ...

  3. 22个值得收藏的android开源码-UI篇

    本文介绍了android开发人员中比較热门的开源码,这些代码绝大多数能够直接应用到项目中. FileBrowserView 一个强大的文件选择控件.界面比較美丽,使用也非常easy. 特点:能够自己定 ...

  4. JAVA邮件收发实现(待)

    http://blog.csdn.net/ycg01/article/details/1394465

  5. Difference between datacontract and messagecontract in wcf

    在WCF中有两种契约各自是DataContract和MessageContract,这篇博客来讲一下两者的差别.先看一下两者定义契约实体的方式有和不同. 1.数据契约 <span style=& ...

  6. async和await用法

    原文:async和await用法 要理解async和await的用法,首先要了解Task相关知识,这里不做说明,因为这不是本文的重点. 如果你已经对Task很了解,那么如何使用async和await, ...

  7. uva:10700 - Camel trading(贪婪)

    题目:10700 - Camel trading 题目大意:给出一些表达式,表达式由数字和加号乘号组成,数字范围[1,20].这些表达式可能缺少了括号,问这种表达式加上括号后能得到的最大值和最小值. ...

  8. linux下使用vi操作

    ESC : 进入命令模式 linux下使用vi后,怎样跳转到文件结尾 pagedown键连续按 虽然我也这么用,但还是太笨了.问了高手,方法是按shift+g,另外,到文件开头是gg.   linux ...

  9. python学习笔记之三:字典,当索引不好用时

    字典是python中唯一内建的映射类型.字典中的值并没有特殊的顺序,但是都存储在一个特定的键(key)里.键可以是数字,字符串甚至是元组. 1. 创建和使用字典 字典可以通过下面的方式创建: phon ...

  10. Why 使用TLS记录封装IP层VPN IS A Bad Idea

    一个很自然的想法,使用TLS套餐一IP数据报实现第三层VPN.这种想法必须经过深思熟虑的,但不幸的是,.这是一个错误的想法.有文章<Why TCP Over TCP Is A Bad Idea& ...