配置yum源

  1. cat> /etc/yum.repos.d/gitlab-ce.repo<< EOF
  2. [gitlab-ce]
  3. name=Gitlab CE Repository
  4. baseurl=https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/
  5. gpgcheck=0
  6. enabled=1
  7. EOF

重载yum缓存

  1. yum clean all
  2. yum makecache

安装依赖

  1. yum install curl policycoreutils-python openssh-server

安装gitlab

  1. sudo EXTERNAL_URL="gitlab.mrlapulga.com" yum install -y gitlab-ce-12.3.5

重载配置

修改配置文件时使用。

  1. /opt/gitlab/bin/gitlab-ctl reconfigure

启动服务

  1. /opt/gitlab/bin/gitlab-ctl start

浏览器访问

在浏览器输入:[http://gitlab.mrlapulga.com](http://gitlab.mrlapulga.com),设置root账号初始密码:

Gitlab安装 - 图1

登录:

Gitlab安装 - 图2

常用命令

  1. gitlab-ctl start # 启动所有 gitlab 组件;
  2. gitlab-ctl stop # 停止所有 gitlab 组件;
  3. gitlab-ctl restart # 重启所有 gitlab 组件;
  4. gitlab-ctl status # 查看服务状态;
  5. vim /etc/gitlab/gitlab.rb # 修改gitlab配置文件;
  6. gitlab-ctl reconfigure # 重新编译gitlab的配置;
  7. gitlab-rake gitlab:check SANITIZE=true --trace # 检查gitlab;
  8. gitlab-ctl tail # 查看日志;
  9. gitlab-ctl tail nginx/gitlab_access.log # 查看日志。