1. 下載rpm包
wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-10.8.4-ce.0.el7.x86_64.rpm
2. 安裝依賴
yum -y install policycoreutils openssh-server openssh-clients postfix policycoreutils-python
3. rpm安裝
rpm -ivh gitlab-ce-10.8.4-ce.0.el7.x86_64.rpm
4. 修改gitlab配置文件信息,指定服務ip和端口號
# [root@localhost ~]# vim /etc/gitlab/gitlab.rb
#末行模式執行 /external_url/## GitLab URL
##! URL on which GitLab will be reachable.
##! For more details on configuring external_url see:
##! https://docs.gitlab.com/omnibus/settings/configuration.html#configuring-the-external-url-for-gitlab
#external_url 'http://gitlab.example.com'
#將url修改ip和端口或者域名
external_url 'http://192.168.56.11:80'
5. 初始化配置
gitlab-ctl reconfigure
6. 重啟服務
gitlab-ctl restart
7. 直接訪問
http://192.168.56.11:80
8. 備份舊環境數據
# 命令備份 備份文件路徑 /var/opt/gitlab/backups/1700647561_2023_11_22_13.12.15_gitlab_backup.tar
gitlab-backup create
# 手動備份
/etc/gitlab/gitlab-secrets.json
/etc/gitlab/gitlab.rb
9. 修改新環境配置文件
修改備份數據恢復地址
修改備份數據存放地址
10. 重新加載配置文件
gitlab-ctl stop
gitlab-ctl reconfigure
gitlab-ctl start
11. 將備份數據上傳恢復地址
修改備份數據恢復地址
修改備份數據存放地址
12. 停服務
停止gitlab部分服務,保證恢復過程中有數據寫入
gitlab-ctl stop unicorn
gitlab-ctl stop sidekiq
13. 開始恢復
gitlab-rake gitlab:backup:restore BACKUP=1700647561_2023_11_22_13.12.15_gitlab_backup.tar