自動化部署之gitlab部署
阿新 • • 發佈:2017-12-20
自動化部署 gitlab
安裝依賴及gitlab
[root@linux-node1 ~]# yum install -y curl policycoreutils openssh-server openssh-clients postfix [root@linux-node1 ~]# systemctl start postfix
2.安裝gitlab
由於國內網絡偏慢,這裏使用清華大學的鏡像源進行安裝gitlab-ce [root@linux-node1 ~]# cat /etc/yum.repos.d/gitlab-ce.repo [gitlab-ce] name=gitlab-ce baseurl=http://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7 repo_gpgcheck=0 gpgcheck=0 enabled=1 gpgkey= [root@linux-node1 ~]# yum makecache [root@linux-node1 ~]# yum install -y gitlab-ce
3.修改配置文件
[root@linux-node1 ~]# vim /etc/gitlab/gitlab.rb external_url 'http://192.168.56.11' [root@linux-node1 ~]# gitlab-ctl reconfigure 這一步時間比較長,耐心等待 gitlab常用命令: 關閉gitlab:[root@linux-node1 ~]# gitlab-ctl stop 啟動gitlab:[root@linux-node1 ~]# gitlab-ctl start 重啟gitlab:[root@linux-node1 ~]# gitlab-ctl restart 重載配置文件: gitlab-ctl reconfigure
可以使用gitlab-ctl
管理gitlab,例如查看gitlab狀態:
[root@linux-node1 ~]# gitlab-ctl status run: gitaly: (pid 53207) 176s; run: log: (pid 52331) 647s run: gitlab-monitor: (pid 53233) 174s; run: log: (pid 52406) 620s run: gitlab-workhorse: (pid 53189) 180s; run: log: (pid 52274) 671s run: logrotate: (pid 52307) 654s; run: log: (pid 52306) 654s run: nginx: (pid 53694) 2s; run: log: (pid 52285) 665s run: node-exporter: (pid 52388) 631s; run: log: (pid 52387) 631s run: postgres-exporter: (pid 53262) 171s; run: log: (pid 52478) 581s run: postgresql: (pid 52013) 855s; run: log: (pid 52012) 855s run: prometheus: (pid 53245) 172s; run: log: (pid 52443) 598s run: redis: (pid 51951) 867s; run: log: (pid 51950) 867s run: redis-exporter: (pid 52426) 609s; run: log: (pid 52425) 609s run: sidekiq: (pid 52256) 677s; run: log: (pid 52255) 677s run: unicorn: (pid 52218) 683s; run: log: (pid 52217) 683s
提示:gitlab需要使用到80端口,所以得保證80端口不被占用
[root@linux-node1 ~]# lsof -i:80 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME httpd 963 apache 4u IPv6 56349 0t0 TCP *:http (LISTEN) httpd 1156 apache 4u IPv6 56349 0t0 TCP *:http (LISTEN) httpd 1392 apache 4u IPv6 56349 0t0 TCP *:http (LISTEN) httpd 1544 apache 4u IPv6 56349 0t0 TCP *:http (LISTEN) httpd 22057 root 4u IPv6 56349 0t0 TCP *:http (LISTEN) httpd 22793 apache 4u IPv6 56349 0t0 TCP *:http (LISTEN) httpd 23247 apache 4u IPv6 56349 0t0 TCP *:http (LISTEN) httpd 23367 apache 4u IPv6 56349 0t0 TCP *:http (LISTEN) httpd 26356 apache 4u IPv6 56349 0t0 TCP *:http (LISTEN) httpd 64149 apache 4u IPv6 56349 0t0 TCP *:http (LISTEN) httpd 64641 apache 4u IPv6 56349 0t0 TCP *:http (LISTEN) [root@linux-node1 ~]# systemctl stop httpd [root@linux-node1 ~]# gitlab-ctl restart ok: run: gitaly: (pid 55012) 0s ok: run: gitlab-monitor: (pid 55022) 1s ok: run: gitlab-workhorse: (pid 55025) 0s ok: run: logrotate: (pid 55034) 1s ok: run: nginx: (pid 55036) 0s ok: run: node-exporter: (pid 55046) 1s ok: run: postgres-exporter: (pid 55051) 0s ok: run: postgresql: (pid 55059) 1s ok: run: prometheus: (pid 55066) 0s ok: run: redis: (pid 55072) 0s ok: run: redis-exporter: (pid 55081) 0s ok: run: sidekiq: (pid 55105) 0s ok: run: unicorn: (pid 55112) 0s [root@linux-node1 ~]# lsof -i:80 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME nginx 54794 root 8u IPv4 1562548 0t0 TCP *:http (LISTEN) nginx 54802 gitlab-www 8u IPv4 1562548 0t0 TCP *:http (LISTEN)
4.瀏覽器訪問登錄:
安裝完成!
自動化部署之gitlab部署