- 安装依赖软件
yum -y install policycoreutils openssh-server openssh-clients postfix
- 开启postfix
systemctl enable postfix && systemctl start postfix
- 下载对应gitlab安装包
去开源官网找到对应包进行下载,找到连接后运行wget下载rpm包 - 运行rpm安装下载下来的包
rpm -i gitlab-ce-8.0.0-ce.0.el7.x86_64.rpm
当然可能会报某些依赖库缺失,按要求去搜索怎么安装就可了。
-
修改服务器的ip vim /etc/gitlab/gitlab.rb找到external_url
-
修改时区 gitlab_rails[‘time_zone’] = ‘Asia/Shanghai’
-
添加邮箱服务https://docs.gitlab.com.cn/omnibus/settings/smtp.html
-
测试邮箱设置
Notify.test_email('待测试邮箱', '测试','这是测试邮件发送').deliver_now
当出现错误时
这个时候只需要设置gitlab_rails[‘smtp_openssl_verify_mode’] = ‘none’
- 优化内存占用修改配置文件/etc/gitlab/gitlab.rb
1)减少 postgresql 数据库缓存postgresql[‘shared_buffers’] = “256MB”
2)减少sidekiq的并发数sidekiq[‘concurrency’] = 1
3)减少进程数unicorn[‘worker_processes’] = 2 - 重新加载配置gitlab-ctl reconfigure
- 重启服务gitlab-ctl restart
- 如果忘记密码强制修改密码修改密码
- gitlab备份,需要注意的时备份的恢复需要在同版本下进行
首先配置文件/etc/gitlab/gitlab.rb中有备份路径配置
gitlab_rails['backup_path'] = '/var/opt/gitlab/backups'
运行下面的命令进行备份
gitlab-rake gitlab:backup:create
在一系列的生成后,可能会出现下面的警告
不用担心,这些警告只是说gitlab.rb和gitlab-secrets.json文件中包含敏感数据,需要手动的在/etc/gitlab目录下备份
- 备份恢复
# 停止相关数据连接服务
gitlab-ctl stop unicorn
gitlab-ctl stop sidekiq
# 从1393513186编号备份中恢复
gitlab-rake gitlab:backup:restore BACKUP=1572242809_2019_10_28_12.3.5_gitlab_backup.tar
# 启动Gitlab
sudo gitlab-ctl start