当前位置: > Linux服务器 > Git >

gitlab 6 安装备忘录

时间:2016-05-14 00:42来源:linux.it.net.cn 作者:IT
gitlab 6.2-stable;Ubuntu 13.10;ruby 2.0.0

推荐使用PostgreSQL,MySQL不同版本可能碰到兼容性问题(www.oschina.net/question/82993_84763)

ruby安装推荐使用rvm(ruby-china.org/wiki/install_ruby_guide)

参考:www.sagestroll.com/node/202

gem,ruby,bundle install源推荐http://ruby.taobao.org/



或者使用http://bitnami.com的一键部署。它已更新到6.3(未测试).

http://bitnami.com/stack/gitlab/installer



碰到问题(按官方文档安装时):

1.//找不到ruby,gem命令或运行gem出现"/usr/bin/env: ruby: 没有那个文件或目录"

$rubyhome=ruby安装目录

sudo ln -s $rubyhome/ruby /usr/bin/ruby sudo ln -s $rubyhome/bin/gem /usr/bin/gem

2.//运行gem命令出错:<internal:gem_prelude>:1:in `require': cannot load such file -- rubygems.rb (LoadError)         from <internal:gem_prelude>:1:in `<compiled>'

找不到原因,后来用rvm安装ruby2.0.0时正确,方法见http://ruby-china.org/wiki/rvm-guide

3.// "usr/bin/env: ruby: 权限不够"

查看命令或执行的用户是否有进入ruby安装目录的权限

4.//clone github上的官方https://github.com/gitlabhq/gitlabhq.git慢

选用git@osc的镜像http://git.oschina.net/mirrors/gitlabhq

5.// sudo: bundle: command not found(已gem install bundler)

sudo ln -s /home/$username/.rvm/rubies/ruby-2.0.0-p247/bin/bundle /usr/bin/bundle

6.// /usr/bin/env: ruby_noexec_wrapper: 没有那个文件或目录

sudo ln -s /home/chenhao/.rvm/gems/ruby-2.0.0-p247/bin/ruby_noexec_wrapper /usr/bin/ruby_noexec_wrapper

7.//gem安装mysql2 出错

需要安装libmysqlclient-dev,但在用mariadb,所有会提示" libmysqlclient-dev : 依赖: libmysqlclient18 (= 5.5.32-0ubuntu0.13.04.1) 但是 5.5.32+maria-1~raring 正要被安装",所有需要安装libmariadbclient-dev

8.//rake aborted! (<unknown>): found character that cannot start any token while scanning for the next token

在database.yml使用'gitlab'@'localhost'作为username导致问题,应该使用gitlab(localhost只是mysql的host)

9.//不能找到 sidekiq.pid

试试sudo -u git -H bundle exec rake sidekiq:start RAILS_ENV=production

10//Could not locate Gemfile

切换工作目录到/home/git/gitlab

10.//git clone https方式成功 ssh失败 或者提示要求输入"git@your_gitlab_host"的密码

gitlab-shell/config里的web url与实际地址不符,在/etc/hosts添加"127.0.0.1 your_gitlab_host"

11.//GitLab Git push的时候提示需要密码

说明你的 key 没有被加入 authorizedkeys 里面,去检查一下 git账户的 ~/.ssh/authorizedKeys 列表.

12.//gitlab启用注册

取消gitlab.yml 中"signup_enabled: true"的注释

13.//smtp设置

这个暂时没有,请好心人提供一下(我按https://gist.github.com/xavierjurado/3138813这个试过,但不行).

错误:

1.//Retrieving rubygems- There is no checksum for 'http://production.cf.rubygems.org/rubygems/rubygems-.tgz' or 'rubygems-.tgz', it's not possible to validate it. If you wish to continue with unverified download add '--verify-downloads 1' after the command. There has been an error while trying to fetch the source.  Halting the installation.

使用"rvm install 2.0.0 --verify-downloads 1"(已验证)或"rvm get stable;rvm rubygems current"(未验证)

2.//bundle install 时Network error

修改一下国内的gem源尝试,打开项目的根目录下面的Gemfile,这里是/home/git/gitlab/Gemfile第一行修改为: source 'http://ruby.taobao.org/' 再次执行bundle install

3.Check GitLab API access: /home/git/gitlab-shell/lib/gitlab_net.rb:57:in `get': undefined method `request_uri' for #<URI::Generic:0x000000013cf770> (NoMethodError)         from /home/git/gitlab-shell/lib/gitlab_net.rb:29:in `check'         from /home/git/gitlab-shell/bin/check:11:in `<main>'

gitlab_url必须以"http://"开头

4.使用nginx做http server时,访问出现502 bad gateway,同时/var/log/nginx/gitlab_error.log显示upstream prematurely closed connection while reading response header from upstream

检查gitlab/log下的unicorn.stderr.log,一般会发现timeout (31s > 30s), killing.原因是第一次访问时,gitlab需要初始化,机器太次时初始化所需时间超过了gitlab/config/unicorn.rb中的timeout,只需调大timeout即可.

(责任编辑:IT)
------分隔线----------------------------