- 安裝依賴軟件
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