centos7安裝gitlab並配置漢化

一、安裝並配置必要的依賴關係
首先要在CentOS系統上面安裝所需的依賴:ssh、防火牆、postfix(用於郵件通知)、wegt,以下這些命令也會打開系統防火牆中的HTTP和SSH端口訪問。

1、安裝SSH協議

安裝命令: yum install -y curl policycoreutils-python openssh-server

2、設置SSH服務開機自啓動

安裝命令: systemctl enable sshd

3、啓動SSH服務

啓動命令: systemctl start sshd

4、安裝防火牆

安裝命令:yum install firewalld systemd -y


5、開啓防火牆

開啓命令:service firewalld  start

6、添加HTTP服務到firewalld

安裝命令: firewall-cmd --permanent --add-service=http

其中,pemmanent表示永久生效,若不加--permanent系統下次啓動後就會失效。

7、重啓防火牆

重啓命令: systemctl reload firewalld

8、安裝Postfix以發送郵件

安裝命令: yum install postfix

9、將postfix服務設置成開機自啓動

命令: systemctl enable postfix

10、啓動postfix

啓動命令: systemctl start postfix

11、安裝wget,用於從外網上下載插件

安裝命令:  yum -y install wget


12、安裝vim編輯器

安裝命令: yum install vim -y

二、添加GitLab鏡像源並安裝gitlab服務器
1、添加gitlab鏡像

命令:wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-10.5.7-ce.0.el7.x86_64.rpm


2、安裝Gitlab

命令:rpm -i gitlab-ce-10.5.7-ce.0.el7.x86_64.rpm


3、修改gitlab配置文件指定服務器ip和自定義端口:

命令:vim  /etc/gitlab/gitlab.rb

external_url 'http://106.2.20.152:9090'

配置時區

gitlab_rails['time_zone'] = 'Asia/Shanghai'


4、將9090端口添加到防火牆中

命令: firewall-cmd --zone=public --add-port=9090/tcp --permanent 

5、重啓防火牆

重啓命令: systemctl reload firewalld

6、重置gitlab

命令:gitlab-ctl reconfigure


7、啓動gitlab

命令:gitlab-ctl restart

出現如下界面表示啓動成功:

8、訪問Gitlab頁面

如果沒有設置域名,在瀏覽器裏面直接輸入服務器IP和指定的端口號就可以進行訪問,第一次登陸的時候會默認進入修改密碼界面:

三、漢化
1、安裝git

yum install -y git

2、下載漢化包,其中v10.5.7-zh是版本,我的下載目錄是root

git clone https://gitlab.com/xhang/gitlab.git -b v10.5.7-zh

3、停止gitlab服務

gitlab-ctl stop

4、切換到gitlab漢化包所在的目錄

cd /root/gitlab

5、比較漢化標籤和原標籤,導出 patch 用的 diff 文件到/root下 

git diff v10.5.7 v10.5.7-zh > ../10.5.7-zh.diff

6、安裝patch

yum install patch -y

8、將10.5.7-zh.diff作爲補丁更新到gitlab中

patch -d /opt/gitlab/embedded/service/gitlab-rails -p1 < 10.5.7-zh.diff

出現如下直接回車,跳過,這是因爲補丁中有一些較新的文件,但是我們安裝的gitlab並沒有這個文件存在

9、啓動gitlab

gitlab-ctl start

10、重新配置gitlab

gitlab-ctl reconfigure

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章