1. 程式人生 > >gitlab cicd (一)系列之安裝gitlb

gitlab cicd (一)系列之安裝gitlb

系統

[[email protected] ~]# cat /etc/redhat-release 
CentOS Linux release 7.5.1804 (Core) 

下載gitlab 各個版本的rpm包地址 gitlab的下載地址

yum update -y 
yum install wget -y
wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-11.4.6-ce.0.el7.x86_64.rpm

安裝gitlab rpm

rpm -ivh gitlab-ce-11.4.6-ce.0.el7.x86_64.rpm

修改 gitlab的外部訪問地址

[[email protected] ~]# grep "^external_url" /etc/gitlab/gitlab.rb
external_url 'http://10.39.47.63'

初始化資料庫以及相關配置

# gitlab-ctl reconfigure
...
Running handlers:
Running handlers complete
Chef Client finished, 6/561 resources updated in 22 seconds
gitlab Reconfigured!

啟動gitlab

gitlab-ctl restart
ok: run: alertmanager: (pid 20765) 0s
ok: run: gitaly: (pid 20779) 1s
ok: run: gitlab-monitor: (pid 20810) 0s
ok: run: gitlab-workhorse: (pid 20813) 0s
ok: run: logrotate: (pid 20818) 1s
ok: run: nginx: (pid 20905) 0s
ok: run: node-exporter: (pid 20920) 1s
ok: run: postgres-exporter: (pid 20926) 0s
ok: run: postgresql: (pid 20941) 0s
ok: run: prometheus: (pid 20949) 0s
ok: run: redis: (pid 20964) 0s
ok: run: redis-exporter: (pid 21049) 1s
ok: run: sidekiq: (pid 21057) 1s
ok: run: unicorn: (pid 21069) 0s

檢視啟動是否成功

[[email protected] ~]# netstat -tlnp 
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 127.0.0.1:9100          0.0.0.0:*               LISTEN      20920/node_exporter 
tcp        0      0 127.0.0.1:9229          0.0.0.0:*               LISTEN      20813/gitlab-workho 
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      20905/nginx: master 
tcp        0      0 127.0.0.1:9168          0.0.0.0:*               LISTEN      20810/ruby          
tcp        0      0 127.0.0.1:9236          0.0.0.0:*               LISTEN      20779/gitaly        
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      5812/sshd           
tcp        0      0 0.0.0.0:8060            0.0.0.0:*               LISTEN      20905/nginx: master 
tcp        0      0 127.0.0.1:9121          0.0.0.0:*               LISTEN      21049/redis_exporte 
tcp        0      0 127.0.0.1:9090          0.0.0.0:*               LISTEN      20949/prometheus    
tcp        0      0 127.0.0.1:9187          0.0.0.0:*               LISTEN      20926/postgres_expo 
tcp        0      0 127.0.0.1:9093          0.0.0.0:*               LISTEN      20765/alertmanager  
tcp6       0      0 ::1:9168                :::*                    LISTEN      20810/ruby          
tcp6       0      0 :::22                   :::*                    LISTEN      5812/sshd           
tcp6       0      0 :::9094                 :::*                    LISTEN      20765/alertmanager 
[[email protected] ~]# gitlab-ctl status 
run: alertmanager: (pid 20765) 18087s; run: log: (pid 16453) 19292s
run: gitaly: (pid 20779) 18087s; run: log: (pid 16356) 19293s
run: gitlab-monitor: (pid 20810) 18086s; run: log: (pid 16448) 19293s
run: gitlab-workhorse: (pid 20813) 18086s; run: log: (pid 16335) 19293s
run: logrotate: (pid 23482) 85s; run: log: (pid 16337) 19293s
run: nginx: (pid 20905) 18085s; run: log: (pid 16336) 19293s
run: node-exporter: (pid 20920) 18085s; run: log: (pid 16357) 19293s
run: postgres-exporter: (pid 20926) 18084s; run: log: (pid 16455) 19291s
run: postgresql: (pid 20941) 18084s; run: log: (pid 16307) 19294s
run: prometheus: (pid 20949) 18083s; run: log: (pid 16451) 19292s
run: redis: (pid 20964) 18083s; run: log: (pid 16306) 19294s
run: redis-exporter: (pid 21049) 18083s; run: log: (pid 16449) 19293s
run: sidekiq: (pid 21057) 18082s; run: log: (pid 16309) 19294s
run: unicorn: (pid 21069) 18080s; run: log: (pid 16308) 19294s

登入 http://10.39.47.63
就可以看到登入介面了
首次登入需要設定root的使用者名稱和密碼
gitlab
參考