1. 程式人生 > >ubuntu18.04安裝gitlab-ee11.4.6及簡單學習(一)

ubuntu18.04安裝gitlab-ee11.4.6及簡單學習(一)

參考:https://www.gitlab.com.cn/installation/#ubuntu

今天是2018年11月22日

Gitlab-ee最新版本是11.4.6

採用ubuntu18.04安裝gitlab-ee

官方說了,如果不確定裝gitlab-ce還是gitlab-ee,那就裝gitlab-ee吧

https://www.gitlab.com.cn/installation/ce-or-ee/?distro=ubuntu

一、更新系統

[email protected]:~# apt update && apt upgrade –y

二、手動迅雷下載軟體包(官方太慢)

直接使用deb安裝

https://mirrors.tuna.tsinghua.edu.cn/gitlab-ee/ubuntu/pool/bionic/main/g/gitlab-ee/gitlab-ee_11.4.6-ee.0_amd64.deb

安裝流程參考:https://www.gitlab.com.cn/installation/#ubuntu

三、安裝依賴關係

[email protected]:~# apt-get install -y curl openssh-server ca-certificates

四、由於使用騰訊企業郵箱,不會使用到Postfix,所以不安裝Postfix,這一步直接安裝gitlab

[email protected]:~# EXTERNAL_URL="http://10.0.0.130" dpkg -i gitlab-ee_11.4.6-ee.0_amd64.deb

裝完之後就是很炫酷的介面:

五、訪問http://10.0.0.130,設定密碼

登陸:

進去之後:

六、設定裡面將語言改為中文

七、配置郵件服務

參考:https://docs.gitlab.com/omnibus/settings/smtp.html

修改:/etc/gitlab/gitlab.rb

騰訊企業郵箱:

個人QQ郵箱:

參考:https://www.viphper.com/1448.html

重啟:

[email protected]:~# gitlab-ctl reconfigure

測試:

[email protected]:~# gitlab-rails console進入控制檯

按下面格式傳送郵件:

irb(main):002:0* Notify.test_email('[email protected]','hello','helloworld').deliver_now

檢視郵件,成功

八、註冊賬戶

直接就進去了:

九、管理員檢視所有使用者資訊:

十、關閉gitlab註冊功能,僅管理員能建立使用者

然後發現就只能登陸了

 

十一、關於gitlab的白名單

參考:https://docs.gitlab.com/ee/security/rack_attack.html

Gitlab預設有rack_attack這個機制,防止惡意使用者破解密碼

但看官方文件是從11.x版本開始已經預設關閉了

如果要設定:

先修改/etc/gitlab/gitlab.rb,新增,如下

然後重新配置gitlab

[email protected]:~# gitlab-ctl reconfigure

十二、通過redis從Rack Attack中刪除阻止的IP

參考: https://docs.gitlab.com/ee/security/rack_attack.html

十三、gitlab的備份恢復

參考:https://blog.csdn.net/ouyang_peng/article/details/77070977

一條命令:

[email protected]:~# gitlab-rake gitlab:backup:create

備份的檔案位置:

/var/opt/gitlab/backups/

修改備份路徑也很容易,修改/etc/gitlab/gitlab.rb中的gitlab_rails['backup_path']即可,修改完記得gitlab-ctl reconfigure

定時備份:

0 2 * * * root /opt/gitlab/bin/gitlab-rake gitlab:backup:create CRON=1

CRON=1表示如果沒有任何錯誤發生時,抑制備份指令碼的所有進度輸出。

設定備份過期時間:

修改/etc/gitlab/gitlab.rb中的gitlab_rails['backup_keep_time']

恢復另寫一篇文章吧