1. 簡介
GitLab
是一個用於倉庫管理系統的開源項目,使用Git作為代碼管理工具,並在此基礎上搭建起來的
web
服務。
GitLab
和GitHub
一樣屬於第三方基於Git
開發的作品,免費且開源(基於MIT協議),與Github
類似,
可以注冊用戶,任意提交你的代碼,添加SSHKey
等等。不同的是,GitLab
是可以部署到自己的服務器
上,數據庫等一切信息都掌握在自己手上,適合團隊內部協作開發,你總不可能把團隊內部的智慧總放
在別人的服務器上吧?簡單來說可把GitLab
看作個人版的GitHub
。
2. Gitlab-ee安裝
1 . 安裝相關依賴
sudo yum install -y curl policycoreutils-python openssh-server
# 啟動sshd
sudo systemctl enable sshd
sudo systemctl start sshd
# 系統防火牆中打開HTTP,HTTPS
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
sudo systemctl reload firewalld
2 . 設置postfix開機自啟,並啟動,postfix支持gitlab發郵件功能
sudo yum install postfix
sudo systemctl enable postfix
sudo systemctl start postfix
3 . 配置yum源
在線下載安裝yum源:
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.rpm.sh | sudo bash
4 . 安裝gitlab並配置域名
yum install -y gitlab-ee
5. 修改gitlab配置
vi /etc/gitlab/gitlab.rb
修改gitlab
訪問地址和端口,默認為80,我們改為82
# 改為需要配置的域名
external_url 'http://gitlab.example.com'
# 修改監聽端口,默認80
nginx['listen_port'] = 82
6 . 重載配置及啟動gitlab
gitlab-ctl reconfigure
gitlab-ctl restart
7. 把端口添加到防火牆
firewall-cmd --zone=public --add-port=82/tcp --permanent
firewall-cmd --reload
啟動成功后,看到以下修改管理員root
密碼的頁面,修改密碼后,然后登錄即可