安裝CentOS7的鏡像文件地址:https://mirrors4.tuna.tsinghua.edu.cn/centos/7/isos/x86_64/CentOS-7-x86_64-Everything-1908.iso
說明:鏡像文件可能一直在更新,下載最新的即可。
安裝的GitLab的安裝地址:https://packages.gitlab.com/gitlab/gitlab-ce/packages/el/7/gitlab-ce-12.5.0-ce.0.el7.x86_64.rpm/
說明:rpm文件一直在更新,下載最新的即可
安裝前注意查詢下官方網站的按照說明(不排除有新的安裝步驟):https://about.gitlab.com/install/#centos-7
安裝注意事項:安裝虛擬機後,需要設置好網絡(包括設置好ip地址),保證虛擬機能夠聯網同時本機操作系統可以訪問到虛擬機。
將下載的rmp文件通過SecureFX工具上傳到虛擬機的/opt目錄下。
使用root用戶登錄,運行以下命令:
sudo rpm -ivh /opt/gitlab-ce-12.5.0-ce.0.el7.x86_64.rpm
sudo yum install -y curl policycoreutils-python openssh-server
sudo systemctl enable sshd
sudo systemctl start sshd
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
sudo systemctl reload firewalld
sudo yum install postfix
sudo systemctl enable postfix
sudo systemctl start postfix
curl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
sudo EXTERNAL_URL="http://gitlab.example.com" yum -y install gitlab-ce
建議:將上述命令拷貝到shell腳本文件中(比如install.sh)中,運行shell腳本,等安裝完成。
按照完成後重啓虛擬機。
重啓虛擬機後,初始化配置gitlab,用root用戶輸入以下命令:
gitlab-ctl reconfigure
配置完成後,啓動gitlab服務,用root用戶輸入以下命令:
gitlab-ctl start
如果要關閉gitlab服務,可以輸入以下命令:
gitlab-ctl stop
啓動完成後,瀏覽器中直接輸入虛擬機的本地ip地址,即可訪問gitlab(本人配置的是192.168.2.23),如圖,大功告成,初次登陸需要設置密碼,備註如果不能訪問可以試圖關閉防火牆再試,關閉防火牆命令:service firewalld stop