安装
sudo wget https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh
sudo os=el dist=8 bash ./script.rpm.sh
sudo EXTERNAL_URL="http://192.168.1.19:7070" yum install -y gitlab-ce
访问验证
curl http://192.168.1.19:7070
配置邮箱
nano /etc/gitlab/gitlab.rb
阿里云邮件访问配置
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.qiye.aliyun.com"
gitlab_rails['smtp_port'] = 465
gitlab_rails['smtp_user_name'] = "test@link.com"
gitlab_rails['smtp_password'] = "test123456"
gitlab_rails['smtp_domain'] = "smtp.qiye.aliyun.com"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = false
gitlab_rails['smtp_tls'] = true
gitlab_rails['smtp_pool'] = false
// 开启配置
gitlab_rails['gitlab_email_enabled'] = true
gitlab_rails['gitlab_email_from'] = 'test@link.com'
gitlab_rails['gitlab_email_display_name'] = '我的gitlab显示名称'
测试邮件发送是否正常
gitlab-rails console
# 等待一会输入测试
Notify.test_email('leeguangxing@foxmail.com', 'email title', 'This is a long long content. Otherwise, it probably would be intercepted by foxmail.').deliver_now
重新加载配置
gitlab-ctl reconfigure
重新启动
gitlab-ctl restart
初始密码位置
cat /etc/gitlab/initial_root_password
安装gitlab-runner
curl -LJO "https://s3.dualstack.us-east-1.amazonaws.com/gitlab-runner-downloads/latest/rpm/gitlab-runner_amd64.rpm"
dnf clean all
dnf makecache
rpm -i gitlab-runner_amd64.rpm
gitlab-runner
gitlab-runner --version
# 在gitlab流水线配置上获取token
gitlab-runner register --url http://192.168.1.19:7070 --token glrt-7S5bM5Asr9fdrmB_pomv
gitlab-runner list
usermod -aG docker gitlab-runner
gitlab-runner restart
- 配置文件
/etc/gitlab-runner/config.toml
问题解决
- gitlab-runner 执行任务时 /usr/bin/bash: line 139: docker: command not found,解决办法:我通过使用shell方式就可以了
- 权限问题
[runners.docker]
image = "golang:1.20"
[runners.docker.options]
# 使用指定的用户运行容器
user = "gitlab-runner"