1. 安裝Gitlab依賴包
yum install curl openssh-server openssh-clients postfix cronie polucyroreutils-python -y
2. 添加官方源
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh| sudo bash
3. 安裝Gitlab
yum install gitlab-ce -y
cd /opt/gitlab/etc/
4. 配置gitklab
cp gitlab.rb.template gitlab.rb
vim /opt/gitlab/etc/gitlab.rb
external_url 'http://10.4.7.100' #本機IP
5. 初始化Gitlab
gitlab-ctl reconfigure
6. 啟動Gitlab服務
gitlab-ctl start
gitlab-ctl restart
gitlab-ctl status
7. 登錄 IP --> 設置密碼 --> 修改中文界面
8.新建群組
9.新建項目
10.添加用戶
11 將用戶添加到組
12.添加ssh-key
13 去掉用戶注冊功能
14.gitlab的備份與恢復
1. 修改配置文件
vim gitlab.rb
gitlab_rails['manage_backup_path'] = true
gitlab_rails['backup_path'] = "/var/opt/gitlab/backups"
# 設置好后重啟 gitlab-ctl restart 或者gitlab-ctl reconfigure
2. 執行命令進行備份
/opt/gitlab/bin/gitlab-rake gitlab:backup:create
[root@k8s-node2 ~]# cd /var/opt/gitlab/backups/
[root@k8s-node2 backups]# ls
1614222462_2021_02_25_13.9.1_gitlab_backup.tar
3. 添加crontab定時備份
crontab -e
* * 2 * * /opt/gitlab/bin/gitlab-rake gitlab:backup:create
4. 設置備份保留時長
vim gitlab.rb
gitlab_rails['backup_keep_time'] = 604800
gitlab-ctl restart
5. 恢復備份-恢復前先停掉數據連接服務
gitlab-ctl stop unicore
gitlab-ctl stop sidekip
[root@k8s-node2 ~]# cd /var/opt/gitlab/backups/
[root@k8s-node2 backups]# ls
1614222462_2021_02_25_13.9.1_gitlab_backup.tar
gitlab-rake gitlab:backup:restore BACKUP=1614222462_2021_02_25_13.9.1
[root@git-server backups]# gitlab-ctl start unicore
[root@git-server backups]# gitlab-ctl start sidekip
[root@git-server backups]# gitlab-ctl restart