安裝GitLab沒必要像網上說的配置那么復雜,也不要自行編譯安裝,直接使用Omnibus版本即可,也就是綜合安裝包,注意如下幾點:
1、不需要替換Nginx,直接使用GitLab的原生集成,同時這種方式也方便以后的配置,對於網上的方法來說,這一步居然替換成其它的Nginx,不用原生自帶的,那么不是給以后配置造成吭嗎?!!!
2、對於SSL的配置統一不在GitLab配置,直接使用Nginx做反向代理做SSL。
3、在CentOS下配置postfix多半會錯,解決方法參考:https://www.cnblogs.com/EasonJim/p/9944495.html
4、網上居然要配置sshd的服務?厲害?
5、對於firewalld的配置,我建議不要這個服務,改成iptables。
6、運維安裝GitLab只要注意這幾點:域名訪問、倉庫目錄創建和遷移、郵件發送(后續講解)
7、很多時候網上說GitLab國外的網址被牆?我檢測了三大運營商的網絡基本沒什么問題,如果非要國內下載,可以參考這個網址配置:https://mirror.tuna.tsinghua.edu.cn/help/gitlab-ce/
8、GitLab官網的安裝教程是企業版本,只有有兩個關鍵字ce、ee,ce代表社區免費版,ee代表企業版。
9、GitLab默認賬號密碼:root/5iveL!fe,默認啟動端口是80。
下面是安裝腳本的思路,不一定每台機器可以使用,只提供一個思路:
# 安裝依賴 yum install -y curl policycoreutils-python yum install -y postfix systemctl enable postfix systemctl start postfix # fix postfix in centos bug sed -i 's/inet_interfaces = localhost/inet_interfaces = all' /etc/postfix/main.cf service postfix restart # 下載安裝 wget https://mirror.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-11.4.5-ce.0.el7.x86_64.rpm -O gitlab-ce-11.4.5-ce.0.el7.x86_64.rpm rpm -i gitlab-ce-11.4.5-ce.0.el7.x86_64.rpm # 修改配置 # 域名(可選) # sed -i 's/external_url \'http://gitlab.example.com\'/external_url \'http://gitlab.jsoft.com\'/g' /etc/gitlab/gitlab.rb # 遷移目錄 mv /var/opt/gitlab/git-data{,_bak} mkdir -p /data/service/gitlab/git-data chmod 775 /data chmod 775 /data/service chmod -R 775 /data/service/gitlab rsync -av /var/opt/gitlab/git-data/repositories /data/service/gitlab/git-data/ ls -n /data/service/gitlab/git-data /var/opt/gitlab/git-data # 啟動 gitlab-ctl reconfigure gitlab-ctl restart
(安裝可選)國外源安裝:
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
yum install -y gitlab-ce
(安裝可選)國內源安裝:
cat > /etc/yum.repos.d/gitlab-ce.repo << EOF [gitlab-ce] name=Gitlab CE Repository baseurl=https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el$releasever/ gpgcheck=0 enabled=1 EOF # 更新源緩存 yum makecache # 安裝CE版 yum install -y gitlab-ce
全自動腳本:https://github.com/easonjim/centos-shell/blob/master/gitlab/install-gitlab_11.4.5.sh
參考:
https://about.gitlab.com/install/#centos-7
https://cloud.tencent.com/developer/article/1010163
https://blog.csdn.net/huhuhuemail/article/details/80519433
https://my.oschina.net/gccr/blog/591410