ubuntu gitlab服务器搭建

gitlab服务器搭建

1.安装依赖包

sudo apt-get install curl openssh-server ca-certificates postfix

执行完成后,出现邮件配置,选择Internet那一项(不带Smarthost的)

2.下载最新的包

安装gitlab-ce软件包

https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/ubuntu/pool/xenial/main/g/gitlab-ce/链接中下载最新版gitlab-ce(这里下载gitlab-ce_11.1.4-ce.0_amd64.deb)

3.安装

sudo dpkg -i gitlab-ce_11.1.4-ce.0_amd64.deb

4.修改gitlab配置

sudo vim /etc/gitlab/gitlab.rb 

修改external_url为

external_url 'http://192.168.1.128'

该ip地址为ubuntu的ip地址(具体采用ifconfig查看)

5.gitlab配置重新生成

sudo gitlab-ctl reconfigure

会执行很长时间。

6.检查状态

sudo gitlab-ctl status
run: alertmanager: (pid 32042) 126s; run: log: (pid 32048) 126s
run: gitaly: (pid 31950) 134s; run: log: (pid 31960) 133s
run: gitlab-monitor: (pid 31971) 133s; run: log: (pid 31992) 129s
run: gitlab-workhorse: (pid 31929) 135s; run: log: (pid 31940) 135s
run: logrotate: (pid 30838) 311s; run: log: (pid 31946) 134s
run: nginx: (pid 336) 1s; run: log: (pid 31942) 134s
run: node-exporter: (pid 31170) 259s; run: log: (pid 31963) 133s
run: postgres-exporter: (pid 32063) 125s; run: log: (pid 32071) 125s
run: postgresql: (pid 30295) 454s; run: log: (pid 31918) 136s
run: prometheus: (pid 32016) 127s; run: log: (pid 32062) 125s
run: redis: (pid 30223) 460s; run: log: (pid 31917) 136s
run: redis-exporter: (pid 31305) 237s; run: log: (pid 31976) 131s
run: sidekiq: (pid 30770) 326s; run: log: (pid 31920) 136s
run: unicorn: (pid 30726) 332s; run: log: (pid 31919) 136s

表示正常。

7.在浏览器中输入ip访问。

通常情况下,80端口会被占用。

修改/etc/gitlab/gitlab.rb

增加nginx['listen_port'] = 8081

重新执行,

sudo gitlab-ctl reconfigure

tips:其他指令

$ sudo gitlab-ctl stop
ok: down: alertmanager: 0s, normally up
ok: down: gitaly: 1s, normally up
ok: down: gitlab-monitor: 0s, normally up
ok: down: gitlab-workhorse: 1s, normally up
ok: down: logrotate: 0s, normally up
ok: down: nginx: 0s, normally up
ok: down: node-exporter: 1s, normally up
ok: down: postgres-exporter: 0s, normally up
ok: down: postgresql: 1s, normally up
ok: down: prometheus: 0s, normally up
ok: down: redis: 0s, normally up
ok: down: redis-exporter: 0s, normally up
ok: down: sidekiq: 1s, normally up
ok: down: unicorn: 0s, normally up

$ sudo gitlab-ctl start
ok: run: alertmanager: (pid 14696) 1s
ok: run: gitaly: (pid 14709) 0s
ok: run: gitlab-monitor: (pid 14723) 0s
ok: run: gitlab-workhorse: (pid 14726) 1s
ok: run: logrotate: (pid 14733) 0s
ok: run: nginx: (pid 14742) 1s
ok: run: node-exporter: (pid 14750) 0s
ok: run: postgres-exporter: (pid 14756) 1s
ok: run: postgresql: (pid 14779) 0s
ok: run: prometheus: (pid 14782) 0s
ok: run: redis: (pid 14789) 1s
ok: run: redis-exporter: (pid 14792) 1s
ok: run: sidekiq: (pid 14803) 0s
ok: run: unicorn: (pid 14826) 0s

$ sudo gitlab-ctl restart
ok: run: alertmanager: (pid 15399) 1s
ok: run: gitaly: (pid 15414) 0s
ok: run: gitlab-monitor: (pid 15427) 1s
ok: run: gitlab-workhorse: (pid 15447) 0s
ok: run: logrotate: (pid 15458) 0s
ok: run: nginx: (pid 15538) 1s
ok: run: node-exporter: (pid 15548) 0s
ok: run: postgres-exporter: (pid 15555) 1s
ok: run: postgresql: (pid 15567) 0s
ok: run: prometheus: (pid 15569) 1s
ok: run: redis: (pid 15589) 0s
ok: run: redis-exporter: (pid 15658) 0s
ok: run: sidekiq: (pid 15682) 0s
ok: run: unicorn: (pid 15696) 0s

dpkg来卸载(Gitlab)deb包

1.查看

sudo dpkg -l | grep 'gitlab'

2.卸载

 sudo dpkg -r gitlab-ce

3.再次查看发现变成了rc

sudo dpkg -l | grep 'gitlab'

4.彻底删除

sudo dpkg -P gitlab-ce
posted @ 2018-08-06 17:21  TBHacker  阅读(685)  评论(0编辑  收藏  举报