關閉防火牆、SELinuxhtml
開啓郵件服務node
systemctl start postfix systemctl enable postfix
#ps:不開去郵箱能夠不期待,不是必須操做
centos7: ~]# yum install -y curl openssh-server openssh-clients postfix cronie policycoreutils-python # gitlab-ce 10.x.x之後的版本須要依賴policycoreutils-python centos8: ~]# yum install -y curl openssh-server openssh-clients postfix cronie policycoreutils-python-utils
~]# curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
由於官方源太慢,可使用國內清華yum源,配置以下python
~]# vim /etc/yum.repos.d/gitlab-ce.repo [gitlab-ce] name=Gitlab CE Repository baseurl=https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el$releasever/ gpgcheck=0 enabled=1
~]# yum -y install gitlab-ce # 自動安裝最新版 ~]# yum -y install gitlab-ce-x.x.x # 安裝指定版本Gitlab
]# head -1 /opt/gitlab/version-manifest.txt gitlab-ce 13.8.4
[root@node1 gitlab]# pwd /opt/gitlab [root@node1 gitlab]# ll 總用量 2580 drwxr-xr-x 2 root root 153 2月 14 21:02 bin -rw-r--r-- 1 root root 192450 2月 11 18:36 dependency_licenses.json drwxr-xr-x 14 root root 168 2月 14 21:02 embedded drwxr-xr-x 2 root root 32 2月 14 21:02 etc drwxr-xr-x 2 root root 6 2月 11 18:37 init -rw-r--r-- 1 root root 2391185 2月 11 18:36 LICENSE drwxr-xr-x 2 root root 306 2月 14 21:02 licenses drwxr-xr-x 2 root root 8192 2月 14 21:02 LICENSES drwxr-xr-x 2 root root 6 2月 11 18:37 service drwxr-xr-x 2 root root 6 2月 11 18:37 sv -rw-r--r-- 1 root root 31942 2月 11 18:37 version-manifest.json -rw-r--r-- 1 root root 12135 2月 11 18:37 version-manifest.txt #依賴包位置
#設置登陸連接 [root@qfedu.com ~]# vim /etc/gitlab/gitlab.rb *** ## GitLab URL ##! URL on which GitLab will be reachable. ##! For more details on configuring external_url see: ##! https://docs.gitlab.com/omnibus/settings/configuration.html#configuring-the-external-url-for-gitlab # 沒有域名,能夠設置爲本機IP地址
32 external_url 'http://192.168.1.1' #也能夠加端口nginx
***
[root@node1 gitlab]# grep "^external_url" /etc/gitlab/gitlab.rb
external_url 'http://192.168.1.1' #綁定監聽的域名或IPgit
redis
~]# gitlab-ctl reconfigure
......
Running handlers:
Running handlers complete
Chef Infra Client finished, 578/1549 resources updated in 02 minutes 57 secondssql
Notes:
It seems you haven't specified an initial root password while configuring the GitLab instance.
On your first visit to your GitLab instance, you will be presented with a screen to set a
password for the default admin account with username `root`.json
gitlab Reconfigured!vim
[root@node1 gitlab]# gitlab-ctl start ok: run: alertmanager: (pid 14192) 65s ok: run: gitaly: (pid 14079) 67s ok: run: gitlab-exporter: (pid 14089) 67s ok: run: gitlab-workhorse: (pid 14049) 68s ok: run: grafana: (pid 14211) 64s ok: run: logrotate: (pid 13583) 153s ok: run: nginx: (pid 13560) 160s ok: run: node-exporter: (pid 14064) 68s ok: run: postgres-exporter: (pid 14203) 64s ok: run: postgresql: (pid 13272) 215s ok: run: prometheus: (pid 14174) 66s ok: run: puma: (pid 13459) 178s ok: run: redis: (pid 13101) 227s ok: run: redis-exporter: (pid 14091) 66s ok: run: sidekiq: (pid 13487) 172s
[root@node1 gitlab]# lsof -i:80 #查看git
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
nginx 13560 root 7u IPv4 64606 0t0 TCP *:http (LISTEN)
nginx 13561 gitlab-www 7u IPv4 64606 0t0 TCP *:http (LISTEN)
nginx 13562 gitlab-www 7u IPv4 64606 0t0 TCP *:http (LISTEN)
nginx 13563 gitlab-www 7u IPv4 64606 0t0 TCP *:http (LISTEN)
nginx 13564 gitlab-www 7u IPv4 64606 0t0 TCP *:http (LISTEN)centos
~]# gitlab-rails console production irb(main):001:0>user = User.where(id: 1).first # id爲1的是超級管理員 irb(main):002:0>user.password = 'yourpassword' # 密碼必須至少8個字符 irb(main):003:0>user.save! # 如沒有問題 返回true exit # 退出
~]# gitlab-ctl start # 啓動全部 gitlab 組件; ~]# gitlab-ctl stop # 中止全部 gitlab 組件; ~]# gitlab-ctl restart # 重啓全部 gitlab 組件; ~]# gitlab-ctl status # 查看服務狀態; ~]# gitlab-ctl reconfigure # 初始化服務; ~]# vim /etc/gitlab/gitlab.rb # 修改默認的配置文件; ~]# gitlab-ctl tail # 查看日誌;