1. 程式人生 > 其它 >雲伺服器CentOS7安裝gitlab

雲伺服器CentOS7安裝gitlab

1. 安裝4個相關依賴

yum -y install policycoreutils-python openssh-server openssh-clients postfix

檢視是否安裝成功

rpm -qa|grep openssh

rpm -qa|grep postfix

rpm -qa|grep policycoreutils-python

2. 啟動postfix,並設定開機自啟動

systemctl enable postfix

systemctl start postfix

啟動時如果報錯:Job for postfix.service failed because the control process exited with error code. See "systemctl status postfix.service" and "journalctl -xe" for details.

vim /etc/postfix/main.cf

修改配置如下圖

3. 配置ssh服務

systemctl enable sshd

systemctl start sshd

systemctl status sshd

防火牆的相關操作

systemctl status firewalld  檢視防火牆有沒有啟動,沒有就啟動

將http服務策略新增到防火牆

firewall-cmd --permanent --add-service=http

firewall-cmd --permanent --add-service=https

systemctl status postfix  檢視postfix有沒有啟動,沒有就啟動

 

4. 下載rpm包並安裝

https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/

 

wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-13.1.2-ce.0.el7.x86_64.rpm

rpm -i gitlab-ce-13.1.2-ce.0.el7.x86_64.rpm

 

出現這個說明安裝成功

5. 配置gitlab

vim /etc/gitlab/gitlab.rb

 

阿里雲記得開放埠,防火牆也要開放

firewall-cmd --zone=public --add-port=埠號/tcp --permanent

改完後重置並啟動gitlab

gitlab-ctl reconfigure

gitlab-ctl start

如果再次修改gitlab.rb配置,先停止  gitlab-ctl stop

並且修改後也要重置gitlab,gitlab-ctl reconfigure

再啟動

6. 頁面報錯502