1.安装依赖
yum -y install curl policycoreutils openssh-server openssh-clients postfix
yum install -y policycoreutils-python
2.下载rpm包(或是使用yum)
wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-12.4.2-ce.0.el7.x86_64.rpm
可访问为此地址查看所需版本
https://mirror.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/
配置yum源
vim /etc/yum.repos.d/gitlab-ce.repo
[gitlab-ce]
name=Gitlab CE Repository
baseurl=https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el$releasever/
gpgcheck=0
enabled=1
yum makecache
yum install gitlab-ce
3.安装
rpm -i gitlab-ce-12.4.2-ce.0.el7.x86_64.rpm
4.修改文件,修改为本机ip
vim /etc/gitlab/gitlab.rb(此为访问git的地址或是域名)
修改git项目地址
vim /opt/gitlab/embedded/service/gitlab-rails/config/gitlab.yml
5.安装
gitlab-ctl reconfigure
查看版本
cat /opt/gitlab/embedded/service/gitlab-rails/VERSION
6.汉化
停止gitlab
gitlab-ctl stop
下载汉化包(需要选择对应版本)
7.解压
8.替换,可能出现一直提示确认,可执行unalias cp
cp -rf gitlab-10-6-stable-zh/* /opt/gitlab/embedded/service/gitlab-rails/
9.完成
10.迁移
备份原GIT服务器数据
gitlab-rake gitlab:backup:create RAILS_ENV=production
注:默认备份后文件一般位于/var/opt/gitlab/backups/,文件名:1573719393_2019_11_14_12.4.2_gitlab_backup.tar
.新服务安装与旧服务器版本一致的gitlab
cat /opt/gitlab/embedded/service/gitlab-rails/VERSION
将旧服务器备份文件拷贝至新服务器/var/opt/gitlab/backups中
scp /var/opt/gitlab/backups/1573719393_2019_11_14_12.4.2_gitlab_backup.tar root@192.168.2.244:/var/opt/gitlab/backups/
新gitlab服务数据恢复(新旧服务器gitlab版本必须一致,包括汉化包)可以cp迁移前服务器的汉化包 (cd /opt/gitlab/embedded/service/gitlab-rails、tar -czvf gitlab-rails.tar.gz gitlab-rails/)
gitlab-rake gitlab:backup:restore RAILS_ENV=production gitlab-rake gitlab:backup:restore RAILS_ENV=production BACKUP=1573719393_2019_11_14_12.4.2
重启gitlab服务并检查恢复数据情况
gitlab-ctl restart
gitlab-rake gitlab:check SANITIZE=true
11.备份
写入crontab任务计划
设置备份过期时间
vim /etc/gitlab/gitlab.rb
修改上传大小限制
git config --global http.postBuffer 524288000
git config --global https.postBuffer 524288000
在gitlab.rb中修改nginx配置
nginx['enable'] = true
nginx['client_max_body_size'] = '1024m'
nginx['redirect_http_to_https'] = false
nginx['redirect_http_to_https_port'] = 80
重载配置文件并重启gitlab
gitlab-ctl reconfigure
gitlab-ctl restart