GitLab是一個基於web界面的Git倉庫管理程序,包括代碼審計、wikis、問題跟蹤等功能。使用GitLab創建、檢查和部署代碼非常容易。它可以托管在我們自己的服務器上,在官方服務器也提供免費的倉庫托管,類似於Github。 |
GitLab有三個不同的版本可用:Community Edition(CE)、Enterprise Edition(EE)和 GitLab托管版本。其中CE版本是開源免費的。EE版本是企業版,需要付費使用的。
環境
- Centos8
- gitlab-ce-13.1.4
推薦cpu核心數量為4核,推薦內存大小為4GB。
安裝GitLab-CE
新建/etc/yum.repos.d/gitlab-ce.repo倉庫文件,然后復制內容到文件里。
[root@localhost ~]# touch /etc/yum.repos.d/gitlab-ce.repo [gitlab-ce] name=Gitlab CE Repository baseurl=https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el$releasever/ gpgcheck=0 enabled=1
更新yum緩存,然后安裝gitlab-ce:
[root@localhost ~]# yum makecache [root@localhost ~]# yum -y install gitlab-ce
安裝完成。
防火牆中開放端口
[root@localhost ~]# firewall-cmd --permanent --add-service=http success [root@localhost ~]# firewall-cmd --permanent --add-service=https success [root@localhost ~]# firewall-cmd --reload success
配置並啟動gitlab
剛安裝完,需要配置一下gitlab。
[root@localhost ~]# gitlab-ctl reconfigure
配置完成之后已經啟動所有服務了,已經設置好開機啟動了。
gitlab-ctl
的常用的操作:
# 重置應用 gitlab-ctl reconfigure # 啟動所有服務 gitlab-ctl start # 關閉所有服務 gitlab-ctl stop # 重啟所有服務 gitlab-ctl restart # 列出所有服務 gitlab-ctl service-list # 查看服務狀態 gitlab-ctl status
web界面訪問GitLab
在瀏覽器輸入本機ip地址,訪問gitlab,第一次訪問需要為管理員設置密碼:
默認的用戶是root
,剛設置好密碼,可以登錄了:
然后就可以創建project了。
總結
GitLab能夠集成大量的工具,如Slack、Hipchat、LDAP、JIRA、Jenkins、許多類型的鈎子和一個完整的API。