Linux 系統(tǒng)下搭建 Gitlab 服務器的過程分析
更新時間:2023年04月13日 10:04:54 作者:多測師_鄭sir
這篇文章主要介紹了Linux 系統(tǒng)下搭建 Gitlab 服務器的過程,本文給大家介紹的非常詳細,對大家的學習或工作具有一定的參考借鑒價值,需要的朋友可以參考下
1、安裝依賴工具
// 安裝技術依賴 yum install -y curl policycoreutils-python openssh-server // 啟動ssh服務/設置為開機啟動 sudo systemctl enable sshd sudo systemctl start sshd
2、安裝 Postfix 郵件服務器
// 安裝 postfix sudo yum install -y postfix // 啟動 postfix 并設置為開機啟動 sudo systemctl enable postfix sudo systemctl start postfix
3、安裝防火墻
yum install firewalld systemd -y
// 開放 ssh、http 服務 sudo firewall-cmd --add-service=ssh --permanent sudo firewall-cmd --add-service=http --permanent // 設置防火墻規(guī)則 sudo firewall-cmd --reload
4、添加 gitlab 鏡像源并安裝 gitlab 服務器
- 鏡像地址:https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-13.1.2-ce.0.el7.x86_64.rpm
- 鏡像有點大,下載比較慢,根據網速快慢,需要等幾分鐘或者十幾分鐘
wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-13.1.2-ce.0.el7.x86_64.rpm
5、安裝 gitlab
安裝過程需要些時間,安心等待,如果出現(xiàn)下圖,則說明安裝成功
rpm -ivh gitlab-ce-13.1.2-ce.0.el7.x86_64.rpm
6、安裝后修改 gitlab 配置文件,指定訪問服務器 ip 和自定義端口
// 輸入編輯命令 vim /etc/gitlab/gitlab.rb // 通過 vim 編輯命名找到 32 行 // 修改訪問 URL // 格式:external_url 'http://ip:端口' external_url 'http://119.29.xx.xxx:8081'
- 注意這里設置的端口不能被占用,默認是 8080 端口,如果 8080 已經使用,請自定義其它端口,像我這里就用了 8081 ,需要在防火墻設置開放相對應得端口
- 配置完以后還需要修改一處,去掉 puma['port'] = 8080 前面的注釋 #,并修改下端口號,注意和上面端口區(qū)分開,我這里用了 8082
// 開放 8081、8082 端口 firewall-cmd --permanent --zone=public --add-port=8081/tcp firewall-cmd --permanent --zone=public --add-port=8082/tcp // 重新加載防火墻配置 firewall-cmd --reload
7、重置 Gitlab(讓修改后的配置生效)
- 重置過程中如果出現(xiàn)在 action run 時卡住了情況,可以通過執(zhí)行如下命令解決
- 卡住問題解決后,需要重新重置下 gitlab
- 重置過程可能需要幾分鐘,耐心等待就好!
- 出現(xiàn) gitlab Reconfigured!,說明 OK 了。
// 重置 gitlab gitlab-ctl reconfigure // 解決重置過程中卡住問題 systemctl restart gitlab-runsvdir
8、啟動 gitlab 并通過 ip + 端口訪問
gitlab-ctl start // 啟動所有 gitlab 組件; gitlab-ctl stop // 停止所有 gitlab 組件; gitlab-ctl restart // 重啟所有 gitlab 組件; gitlab-ctl status // 查看服務狀態(tài); gitlab-ctl reconfigure // 刷新配置文件; vim /etc/gitlab/gitlab.rb // 修改默認的配置文件; gitlab-rake gitlab:check SANITIZE=true --trace // 檢查gitlab; gitlab-ctl tail // 查看日志;
9、登錄 gitlab
- 賬號:root
- 密碼在文件 /etc/gitlab/initial_root_password 中查看
cat /etc/gitlab/initial_root_password
到此這篇關于Linux 系統(tǒng)下搭建 Gitlab 服務器的文章就介紹到這了,更多相關Linux 搭建 Gitlab 服務器內容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關文章希望大家以后多多支持腳本之家!
相關文章
Caddy 一個用Go實現(xiàn)的Web Server
這篇文章主要介紹了Caddy 一個用Go實現(xiàn)的Web Server,簡潔易用,需要的朋友可以參考下2016-11-11阿里云申請的 CA Wosin 證書,在Windows iis下導入證書的步驟分享
這篇文章主要介紹了阿里云申請的 CA Wosin 證書,在Windows iis下導入證書的步驟分享,需要的朋友可以參考下2017-03-03詳解如何在IntelliJ IDEA中使用.ignore插件忽略不必要提交的文件
這篇文章主要介紹了詳解如何在IntelliJ IDEA中使用.ignore插件忽略不必要提交的文件,具有一定的參考價值,感興趣的小伙伴們可以參考一下2017-11-11jenkins插件Pipeline腳本jenkinsfile操作指南
這篇文章主要為大家介紹了jenkins插件Pipeline腳本jenkinsfile的操作使用指南,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進步2022-03-03