在CentOS系統(tǒng)上安裝所需的依賴:ssh舟铜,防火墻,postfix(用于郵件通知) ,wget,以下這些命令也會打開系統(tǒng)防火墻中的HTTP和SSH端口訪問祥国。
centos7安裝gitlab:
第一步:安裝SSH
??sudo yum install -y curl policycoreutils-pythonopenssh-server
第二步:將SSH服務設置成開機自啟動阁谆,安裝命令:sudo?systemctl?enable?sshd ?
第三步 :啟動SSH服務碳抄,安裝命令:sudo systemctl start sshd
第四步:安裝防火墻(如果已經(jīng)安裝了防火墻并且已經(jīng)在運行狀態(tài),則可直接進行第6步)
yum install firewalld systemd -y
第五步 :開啟防火墻场绿,安裝命令:service firewalld ?start
Dependency Updated:
? cryptsetup-libs.x86_64 0:2.0.3-3.el7? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
? firewalld-filesystem.noarch 0:0.5.3-5.el7? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
? python-firewall.noarch 0:0.5.3-5.el7? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
? systemd-libs.x86_64 0:219-62.el7_6.5? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
? systemd-sysv.x86_64 0:219-62.el7_6.5? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
Complete!
第六步:添加http服務到firewalld,pemmanent表示永久生效剖效,若不加--permanent系統(tǒng)下次啟動后就會失效。
sudo firewall-cmd --permanent --add-service=http
[root@localhost java]# sudo firewall-cmd --permanent --add-service=http
success
第七 步 :重啟防火墻焰盗,安裝命令:sudo systemctl reload firewalld
第八 步 :接下來璧尸,安裝Postfix以發(fā)送通知郵件,安裝命令:sudo yum install postfix
第九 步 :將postfix服務設置成開機自啟動熬拒,安裝命令:sudo systemctl enable postfix
第10 步 :啟動postfix爷光,安裝命令:sudo systemctl start postfix
第11步 :wget 用于從外網(wǎng)上下載插件
檢查系統(tǒng)中是否已經(jīng)安裝wget,使用命令若出現(xiàn)下圖wget相關(guān)版本描述則說明系統(tǒng)中已經(jīng)安裝wget 若報系統(tǒng)找不到命令說明wget未安裝
若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.0.0-ce.0.el7.x86_64.rpm
2.安裝gitlab?安裝命令:rpm -i gitlab-ce-10.0.0-ce.0.el7.x86_64.rpm
錯誤異常:
?gitlab-ce-10.*.* 提示 error: Failed dependencies:
warning: gitlab-ce-10.0.0-ce.0.el7.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID f27eab47: NOKEY
error: Failed dependencies:
? ? ? ? policycoreutils-python is needed by gitlab-ce-10.0.0-ce.0.el7.x86_64
安裝gitlab的依賴項
yum install policycoreutils-python
重新執(zhí)行以上步驟
安裝過程需要些時間,如果出現(xiàn)下圖活烙,則說明安裝成功徐裸。
warning: gitlab-ce-10.0.0-ce.0.el7.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID f27eab47: NOKEY
It looks like GitLab has not been configured yet; skipping the upgrade script.
? ? ? *.? ? ? ? ? ? ? ? ? *.
? ? ? ***? ? ? ? ? ? ? ? ***
? ? *****? ? ? ? ? ? ? *****
? ? .******? ? ? ? ? ? *******
? ? ********? ? ? ? ? ? ********
? ,,,,,,,,,***********,,,,,,,,,
? ,,,,,,,,,,,*********,,,,,,,,,,,
? .,,,,,,,,,,,*******,,,,,,,,,,,,
? ? ? ,,,,,,,,,*****,,,,,,,,,.
? ? ? ? ,,,,,,,****,,,,,,
? ? ? ? ? ? .,,,***,,,,
? ? ? ? ? ? ? ? ,*,.
? ? _______ __? __? ? ? ? ? __
? ? / ____(_) /_/ /? ____ _/ /_
? / / __/ / __/ /? / __ \`/ __ \
? / /_/ / / /_/ /___/ /_/ / /_/ /
? \____/_/\__/_____/\__,_/_.___/
Thank you for installing GitLab!
GitLab was unable to detect a valid hostname for your instance.
Please configure a URL for your GitLab instance by setting `external_url`
configuration in /etc/gitlab/gitlab.rb file.
Then, you can start your GitLab instance by running the following command:
? sudo gitlab-ctl reconfigure
For a comprehensive list of configuration options please see the Omnibus GitLab readme
https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md
4.修改gitlab配置文件指定服務器ip和自定義端口:
vim? /etc/gitlab/gitlab.rb
9 ## GitLab URL
? 10 ##! URL on which GitLab will be reachable.
? 11 ##! For more details on configuring external_url see:
? 12 ##! https://docs.gitlab.com/omnibus/settings/configuration.html#configuring-the-external-url-for-gitlab
? 13 external_url 'http://192.168.0.208:9000'
5.重置并啟動GitLab
gitlab-ctl reconfigure
gitlab-ctl restart
提示? "ok: run:"表示啟動成功
6.訪問 GitLab頁面