1、安装:
更新本地yum缓存
# yum makecache
安装GitLab社区版
# yum install gitlab-ce -y #自动安装最新版
【使用外部nginx代理gitlab】
修改配置:/etc/gitlab/gitlab.rb
#定义访问域名
external_url 'http://172.21.0.2:8081'
#禁用内部 nginx
nginx['enable'] = false
web_server['external_users'] = ['nginx']
gitlab_workhorse['listen_network'] = "tcp"
gitlab_workhorse['listen_addr'] = "172.21.0.2:8081"
gitlab_rails['webhook_timeout'] = 90
gitlab_rails['git_timeout']=90
GitLab默认生成的nginx配置文件位置:/var/opt/gitlab/nginx/conf
查询unicorn是否启动成功:# gitlab-ctl tail unicorn
2、卸载:
删除gitlab文件:
# find / -name *gitlab*|xargs rm -rf 删除所有包含gitlab的文件及目录
# find / -name gitlab |xargs rm -rf
3、登录及管理员密码修改:
管理员密码修改:
# gitlab-rails console production
user = User.where(id:1).first
user.password='你的密码'
user.save!
4、邮箱通知配置:
# vim /etc/gitlab/gitlab.rb
#配置下面,需要配置smtp_tls
#注意gitlab_rails['smtp_tls'] 这个是设定为true
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.126.com"
gitlab_rails['smtp_port'] = 465
gitlab_rails['smtp_user_name'] = "xxx@126.com"
gitlab_rails['smtp_password'] = "邮箱密码"
gitlab_rails['smtp_domain'] = "126.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'] = 'xxx@126.com'
gitlab_rails['gitlab_email_reply_to']= 'noreply@126.com'
gitlab_rails['gitlab_email_display_name'] = 'Gitlab'
重新配置服务后生效:# gitlab-ctl reconfigure
测试邮件生效:# gitlab-rails console
#进入控制台,然后发送邮件
Notify.test_email('xxx@126.com', 'gitlab邮件测试', '邮件正文').deliver_now
5、代码库迁移:
# rsync -av /var/opt/gitlab/git-data/repositories /home/gitlab-data/
# gitlab-rake gitlab:import:repos['/opt/gitlab/git-data/repositories/']