注:
1、安裝 Gitlab 對配置要求較高,低於 2核4G內存配置,建議不要安裝最新版
2、本文采用 rpm 安裝,安裝前需要安裝的依賴較多,請耐心操作
1、安裝依賴
yum install -y curl yum install -y policycoreutils-python yum install -y policycoreutils-python* yum install -y openssh-server systemctl enable sshd systemctl start sshd systemctl start firewalld firewall-cmd --permanent --add-service=http firewall-cmd --permanent --add-service=https systemctl reload firewalld yum install postfix systemctl enable postfix systemctl start postfix # 修改郵件服務配置 vi /etc/postfix/main.cf # 發現配置為: inet_interfaces = localhost inet_protocols = all # 改成: inet_interfaces = all inet_protocols = all
2、下載安裝包
# centos8.x 版本使用 wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el8/gitlab-ce-13.4.6-ce.0.el8.x86_64.rpm # centos7.x 版本使用 wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-13.4.6-ce.0.el7.x86_64.rpm
3、rpm安裝
# centos8.x 使用 rpm -ivh gitlab-ce-13.4.6-ce.0.el8.x86_64.rpm # centos7.x 使用 rpm -ivh gitlab-ce-13.4.6-ce.0.el7.x86_64.rpm
4、修改 Gitlab 配置
# 修改配置文件 vim /etc/gitlab/gitlab.rb external_url 'http://你的ip地址:80'
5、啟動
gitlab-ctl reconfigure
gitlab-ctl restart
6、訪問服務
在瀏覽器輸入ip地址,就打開了 gitlab 服務。
第一次進入需要需要給管理員添加密碼,默認賬號為:root,默認密碼:5iveL!fe
7、服務管理
# 查看服務狀態: gitlab-ctl status # 開啟服務: gitlab-ctl start # 關閉服務: gitlab-ctl stop # 關閉gitlab的自動啟動 : systemctl disable gitlab-runsvdir.service # 開啟gitlab的自動啟動: systemctl enable gitlab-runsvdir.service systemctl start gitlab-runsvdir.service gitlab-cmd start