Skip to content

Gitlab仓库管理工具

Centos7安装与配置Gitlab

# 解决依赖
yum install policycoreutils-python.x86_64 openssh-server.x86_64 -y

# 安装邮件服务
yum install postfix.x86_64 -y

# 添加社区版package
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | bash

# 安装社区版gitlab
yum install gitlab-ce.x86_64 -y

# 配置gitlab站点url,我这里使用ip替代
vim /etc/gitlab/gitlab.rb
# external_url "http://10.10.10.14"

# 启动gitlab
gitlab-ctl reconfigure

# 账号:root 密码:ADMIN@110

如果国外的源太慢可以使用清华大学的源:https://mirror.tuna.tsinghua.edu.cn/help/gitlab-ce/

踩坑记录

端口被占用

如果8080端口被占用,解决方案如下:

  • 修改配置文件:vim /etc/gitlab/gitlab.rb
unicorn['listen'] = 'localhost'
# unicorn['port'] = 8080
unicorn['port'] = 8082 
  • 修改监听文件:vim /var/opt/gitlab/gitlab-rails/etc/unicorn.rb
# listen "127.0.0.1:8080", :tcp_nopush => true
listen "127.0.0.1:8082", :tcp_nopush => true
  • 重启服务:gitlab-ctl restart

Centos7安装与配置Gitlab-Runner

# 添加package
curl -L https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.rpm.sh | bash

# 安装
yum install gitlab-runner.x86_64 -y

清华大学等源:https://mirror.tuna.tsinghua.edu.cn/help/gitlab-runner/

Gitlab-Runner使用

  • 注册runner:在gitlab项目的settings中找到CI/CD,打开Runner,找到Set up specific Runner manually

gitlab_runner_1

gitlab-runner register

gitlab_runner_2

gitlab_runner_3

参考资料

安装调试gitlab/gitlab-ce容器时遇到的502