介紹
GitLab是一個很好的git的web管理系統,其免費版本GitLab-CE也足夠滿足一般的需求。
GitLab官網:https://about.gitlab.com/
gitlab-ce: 社區版 免費 中小型企業
gitlab-ee: 企業版 收費 功能相對較多
區別對比:https://about.gitlab.com/features/#compare
下載參考:https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/
安裝
## 打開系統防火牆HTTP和SSH訪問
yum install curl policycoreutils openssh-server openssh-clients
systemctl enable sshd
systemctl start sshd
## 安裝郵件服務
yum install postfix
systemctl enable postfix
systemctl start postfix
## 開啟防火牆服務
firewall-cmd --permanent --add-service=http
systemctl reload firewalld
## 添加GitLab鏡像源並安裝
curl -sS http://packages.gitlab.com.cn/install/gitlab-ce/script.rpm.sh | sudo bash <慢>
這是官方的yum源,安裝速度會比較慢,可以使用國內源,修改如下文件即可:
vim /etc/yum.repos.d/gitlab_gitlab-ce.repo
修改內容如下:
[gitlab-ce]
name=gitlab-ce
baseurl=http://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7
repo_gpgcheck=0
gpgcheck=0
enabled=1
gpgkey=https://packages.gitlab.com/gpg.key
## 安裝gitlab-ce
yum install -y gitlab-ce
## 配置服務並啟動
gitlab-ctl reconfigure
## 訪問
http://ip
## 初始賬號是root 密碼是隨機密碼,去密碼文件 /etc/gitlab/initial_root_password 查詢
安裝成功截圖
服務啟動后和隨機密碼查詢如下:
訪問頁面:
登錄成功:
修改密碼
漢化
下載最新的漢化包:
git clone https://gitlab.com/xhang/gitlab.git
如果是要下載老版本的漢化包,需要加上老版本的分支,如果想下載10.0.2,可以運行如下語句:
git clone https://gitlab.com/xhang/gitlab.git -b v10.0.2-zh
停止GitLab並執行如下語句:
gitlab-ctl stop cp /home/local/gitlab/* /opt/gitlab/embedded/service/gitlab-rails/ -rf
復制時可能不斷提示是否要覆蓋,這時可能是系統每次執行cp命令時,其實是執行了cp -i命令的別名。出現這種情況可以修改~/.bashrc,在“alias cp=’cp-i’”前加#注釋即可。
復制可能出現如下提示,可以不用理會。
注釋后記得執行:
source ~/.bashrc
或者重啟即可。
接下來可以重新配置和啟動:
sudo gitlab-ctl reconfigure
sudo gitlab-ctl restart
--- 僅供參考