Gitlab安装及配置
友情提醒(2020-07-02):
gitlab在使用gitlab-rake gitlab:backup:create做数据备份时,迁移不支持跨版本号,小版本号也不可以,CE、EE版本相同也不可,希望能给首次安装的用户一个提醒,后续迁移数据有个心理准备。
1、安装常用依赖包
yum -y install curl policycoreutils-python openssh-server net-tools
2、安装gitlab源
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.rpm.sh | sudo bash
3、通过yum安装gitlab
EXTERNAL_URL="http://192.168.110.9" yum install -y gitlab-ee
4、初始化配置
执行前4步操作后,如不需要特殊配置的话gitlab就可以直接运行对外提供服务了。有时我们需要做一些特殊设置,如改变仓库存储位置,配置邮件等操作,可以参考下述方法完成。
#改变默认存储位置 mkdir -p /data/git/git-data echo 'from_file "/etc/gitlab/external.rb"' >> /etc/gitlab/gitlab.rb echo 'git_data_dirs({ "default" => { "path" => "/data/git/git-data" } })' >> /etc/gitlab/external.rb #邮件发送配置(下面以腾讯企业邮箱为例,请根据实际情况修改邮箱信息) gitlab_rails['smtp_enable'] = true gitlab_rails['smtp_address'] = "smtp.exmail.qq.com" gitlab_rails['smtp_port'] = 465 gitlab_rails['smtp_user_name'] = "gitmaster@git.com" gitlab_rails['smtp_password'] = "password" gitlab_rails['smtp_domain'] = "smtp.exmail.qq.com" gitlab_rails['smtp_authentication'] = "login" gitlab_rails['smtp_enable_starttls_auto'] = true gitlab_rails['smtp_tls'] = true gitlab_rails['smtp_openssl_verify_mode'] = 'none' gitlab_rails['gitlab_email_enabled'] = true gitlab_rails['gitlab_email_from'] = 'gitmaster@git.com' gitlab_rails['gitlab_email_display_name'] = 'gitmaster' gitlab_rails['gitlab_email_reply_to'] = 'gitmaster@git.com' #修改gitlab对外服务URL sed -i "s@external_url 'gitlab.example.com'@external_url 'http://git.test.com'@g" /etc/gitlab/gitlab.rb #上述配置修改都需要执行: gitlab-ctl reconfigure #gitlab启动、停止 gitlab-ctl start gitlab-ctl stop #gitlab头像相关配置修改需执行: gitlab-ctl reconfigure gitlab-rake cache:clear RAILS_ENV=production #禁用Gravatar头像 Settings->General->Account and limit->Expand->取消“Gravatar enabled”前复选框选择->Save changes
更多精彩