GitLab安装


  1. 从清华镜像站中下载GitLab社区版的rpm安装包

  2. 安装Gitlab

如果缺少policycoreutils-python依赖,则先安装该依赖:

  1. # 需要以root身份或者有sudo权限的用户
  2. sudo rpm -ivh gitlab-ce-10.8.7-ce.0.el7.x86_64.rpm
  1. yum install -y policycoreutils-python

  1. 安装完成后,会有以下提示信息: ``` It looks like GitLab has not been configured yet; skipping the upgrade script.

    1. *. *.


    .** *


    ,,,,,,,,,*,,,,,,,,, ,,,,,,,,,,,*,,,,,,,,,,, .,,,,,,,,,,,*,,,,,,,,,,,, ,,,,,,,,,*,,,,,,,,,.

    1. ,,,,,,,****,,,,,,
    2. .,,,***,,,,
    3. ,*,.
  1. _______ __ __ __
  2. / ____(_) /_/ / ____ _/ /_

/ / / / / / / `/ \ / // / / // // // / // / _//_/_/_,/.__/

Thank you for installing GitLab! GitLab was unable to detect a valid hostname for your instance. Please configure a URL for your GitLab instance by setting external_url configuration in /etc/gitlab/gitlab.rb file. Then, you can start your GitLab instance by running the following command: sudo gitlab-ctl reconfigure

For a comprehensive list of configuration options please see the Omnibus GitLab readme https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md

  1. 4. <br />根据提示信息,修改 /etc/gitlab/gitlab.rb 文件中的`external_url`

external_url ‘http://192.168.29.139

  1. 5. <br />根据提示,使用以下命令使得修改后配置文件生效<br />
  2. > 该命令会刷新所有非gitlab.rb的文件,然后自动启动Gitlab
  3. ```shell
  4. sudo gitlab-ctl reconfigure

  1. 在gitlab启动后,登陆:http://192.168.29.139

首次登录会让设置root用户的密码,密码最少需要8位,例如 12345678


  1. 然后便可使用 root/12345678 登录gitlab

  2. 可以注册一个普通用户,例如:gitlab/12345678

常用命令:

  1. # 重启
  2. gitlab-ctl restart
  3. # 启动
  4. gitlab-ctl start
  5. # 关闭
  6. gitlab-ctl stop

gitlab可能因为启动超时报错:HTTP 502: Whoops, GitLab is taking too much time to respond.

引起该错误的原因不止一种:端口被占用、连接超时等都会出现该错误 也可能是因为服务器配置较低,启动缓慢

先等待一段时间,如果等待一段时间后仍然报错,尝试以下操作:

需要在配置文件中配置一个长一些的超时时间: /etc/gitlab/gitlab.rb

  1. gitlab_rails['webhook_timeout'] = 90

然后重启gitlab服务即可