gitlab安裝node
GitLab 是一個用於倉庫管理系統的開源項目,使用Git做爲代碼管理工具,並在此基礎上搭建起來的web服務。本文爲你們帶來gitlab的安裝詳解。nginx
1、環境介紹git
系統:CentOS Linux release 7.6.1810 (Core) web
IP:192.168.0.8redis
配置:2C4Gsql
2、安裝環境包vim
yum -y install policycoreutils openssh-server openssh-clients postfixdom
3、下載rpm包ssh
本文使用的是清華大學開源鏡像站的rpm包。socket
清華大學開源鏡像站網址:https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/
[root@localhost opt]# wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-11.7.5-ce.0.el7.x86_64.rpm #下載rpm包
[root@localhost opt]# rpm -ivh gitlab-ce-11.7.5-ce.0.el7.x86_64.rpm #安裝,安裝結束後有以下信息打印
4、修改配置文件
[root@localhost opt]# vim /etc/gitlab/gitlab.rb
external_url 'http://192.168.0.8:81' #修改你訪問的url
5、初始化並啓動
[root@localhost opt]# gitlab-ctl reconfigure
[root@localhost opt]# gitlab-ctl restart
6、網頁訪問
初始帳戶: root 密碼: 5iveL!fe
第一次登錄會讓你修改密碼,要知足密碼複雜度條件
登錄界面以下,我已經建立過項目,因此可能略有不一樣
7、gitlab默認安裝的目錄及命令
/opt/gitlab/ ## 主目錄
/etc/gitlab/ ## 放置配置文件
/var/opt/gitlab/ ## 各個組件
/var/log/gitlab/ ## 放置日誌文件
檢查gitlab各組件狀態:
[root@localhost ~]# gitlab-ctl status
run: alertmanager: (pid 68651) 395467s; run: log: (pid 107041) 518256s
run: gitaly: (pid 68667) 395467s; run: log: (pid 106843) 518261s
run: gitlab-monitor: (pid 68693) 395466s; run: log: (pid 106957) 518259s
run: gitlab-workhorse: (pid 68697) 395466s; run: log: (pid 106788) 518263s
run: logrotate: (pid 110976) 238484s; run: log: (pid 106803) 518262s
run: nginx: (pid 68860) 395465s; run: log: (pid 106796) 518263s
run: node-exporter: (pid 69005) 395465s; run: log: (pid 106937) 518260s
run: postgres-exporter: (pid 69157) 395464s; run: log: (pid 107091) 518255s
run: postgresql: (pid 69229) 395464s; run: log: (pid 106752) 518265s
run: prometheus: (pid 69311) 395464s; run: log: (pid 107011) 518257s
run: redis: (pid 69324) 395463s; run: log: (pid 106741) 518265s
run: redis-exporter: (pid 69429) 395463s; run: log: (pid 106976) 518258s
run: sidekiq: (pid 69437) 395460s; run: log: (pid 106767) 518264s
run: unicorn: (pid 69461) 395459s; run: log: (pid 106760) 518264s
重啓gitlab:
[root@localhost ~]# gitlab-ctl restart
只重啓某個組件:
[root@localhost ~]# gitlab-ctl restart nginx
gitlab組件:
nginx:
postgresql:
redis:
unicorn:
sidekiq:
logrotate:
修改gitlab代碼數據默認存儲位置
[root@localhost opt]# vim /etc/gitlab/gitlab.rb
git_data_dirs({
"default" => {
"path" => "/data/git_data"
}
})
執行如下命令
gitlab-ctl stop
gitlab-ctl reconfigure
gitlab-ctl start
[root@localhost opt]# ls /data/git_data/ #查看這個目錄下,會有一個repositories目錄
從新加載配置文件時遇到報錯
connections on Unix domain socket "/var/opt/gitlab/postgresql/.s.PGSQL.5432"? [execute] psql: could not connect to server: 沒有那個文件或目錄
解決方法:
systemctl restart gitlab-runsvdir
gitlab-ctl reconfigure