• 欢迎访问蜷缩的蜗牛博客 蜷缩的蜗牛
  • 微信搜索: 蜷缩的蜗牛 | 联系站长 kbsonlong@qq.com
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Gitlab安装和简单配置

Linux 蜷缩的蜗牛 1年前 (2017-05-31) 58次浏览 已收录 0个评论

 

1、官网安装文档:https://about.gitlab.com/downloads/#centos7

sudo yum install curl policycoreutils openssh-server openssh-clients
sudo systemctl enable sshd
sudo systemctl start sshd
sudo yum install postfix
sudo systemctl enable postfix
sudo systemctl start postfix
sudo firewall-cmd --permanent --add-service=http
sudo systemctl reload firewalld

 

2、配置官网镜像源

curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
sudo yum install gitlab-ce

 

由于国内特殊网络,使用官网镜像源较慢,在此提供国内镜像源

清华大学镜像源:https://mirror.tuna.tsinghua.edu.cn/help/gitlab-ce/

RHEL/CentOS 用户

新建 /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

 

sudo yum makecache
sudo yum install gitlab-ce

 

安装完成后目录结构如下

[root@docker gitlab]# tree /opt/gitlab/ -L 1
/opt/gitlab/
├── bin
├── dependency_licenses.json
├── embedded
├── etc
├── init
├── LICENSE
├── LICENSES
├── service
├── sv
├── var
├── version-manifest.json
└── version-manifest.txt
 
8 directories, 4 files
[root@docker gitlab]# tree /etc/gitlab/ -L 1
/etc/gitlab/
├── gitlab.rb
├── gitlab-secrets.json
└── trusted-certs

 

主要集成了如下服务

# tree /opt/gitlab/sv/ -L 1
/opt/gitlab/sv/
├── gitaly
├── gitlab-monitor
├── gitlab-workhorse
├── logrotate
├── nginx
├── node-exporter
├── postgres-exporter
├── postgresql
├── prometheus
├── redis
├── redis-exporter
├── sidekiq
└── unicorn

 

3、配置 gitlab 地址

# cat /etc/gitlab/gitlab.rb |grep ^external_url
external_url 'http://192.168.99.101'

默认 url 地址是http://{hostname}

 

4、重载配置并启动

gitlab-ctl reconfigure

启动时确保 80、8060、8080、9090、9100、9121、9168、9187 这些端口没有占用,否则可能导致启动失败

5、查看启动状态

# gitlab-ctl status
run: gitaly: (pid 5435) 2522s; run: log: (pid 4150) 3071s
run: gitlab-monitor: (pid 5441) 2522s; run: log: (pid 4585) 3023s
run: gitlab-workhorse: (pid 5445) 2522s; run: log: (pid 4203) 3065s
run: logrotate: (pid 5456) 2521s; run: log: (pid 4305) 3053s
run: nginx: (pid 5737) 2439s; run: log: (pid 4264) 3059s
run: node-exporter: (pid 5471) 2520s; run: log: (pid 4415) 3041s
run: postgres-exporter: (pid 5478) 2520s; run: log: (pid 4514) 3029s
run: postgresql: (pid 5487) 2519s; run: log: (pid 3858) 3170s
run: prometheus: (pid 5490) 2519s; run: log: (pid 4372) 3047s
run: redis: (pid 5497) 2518s; run: log: (pid 3744) 3181s
run: redis-exporter: (pid 5502) 2518s; run: log: (pid 4449) 3035s
run: sidekiq: (pid 5804) 2371s; run: log: (pid 4104) 3077s
run: unicorn: (pid 5540) 2515s; run: log: (pid 4049) 3083s

 

6、gitlab 启动、停止、重启等操作

[root@docker gitlab]# gitlab-ctl stop
ok: down: gitaly: 0s, 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: 1s, normally up
ok: down: node-exporter: 0s, normally up
ok: down: postgres-exporter: 0s, normally up
ok: down: postgresql: 0s, normally up
ok: down: prometheus: 0s, normally up
ok: down: redis: 1s, normally up
ok: down: redis-exporter: 0s, normally up
ok: down: sidekiq: 0s, normally up
ok: down: unicorn: 0s, normally up
[root@docker gitlab]# gitlab-ctl start
ok: run: gitaly: (pid 14482) 0s
ok: run: gitlab-monitor: (pid 14488) 1s
ok: run: gitlab-workhorse: (pid 14491) 0s
ok: run: logrotate: (pid 14500) 0s
ok: run: nginx: (pid 14506) 1s
ok: run: node-exporter: (pid 14514) 0s
ok: run: postgres-exporter: (pid 14520) 1s
ok: run: postgresql: (pid 14526) 0s
ok: run: prometheus: (pid 14534) 1s
ok: run: redis: (pid 14544) 0s
ok: run: redis-exporter: (pid 14548) 0s
ok: run: sidekiq: (pid 14559) 1s
ok: run: unicorn: (pid 14562) 0s
[root@docker gitlab]# gitlab-ctl status
run: gitaly: (pid 14482) 12s; run: log: (pid 4150) 3982s
run: gitlab-monitor: (pid 14488) 12s; run: log: (pid 4585) 3934s
run: gitlab-workhorse: (pid 14491) 11s; run: log: (pid 4203) 3976s
run: logrotate: (pid 14500) 11s; run: log: (pid 4305) 3964s
run: nginx: (pid 14506) 11s; run: log: (pid 4264) 3970s
run: node-exporter: (pid 14514) 10s; run: log: (pid 4415) 3952s
run: postgres-exporter: (pid 14520) 10s; run: log: (pid 4514) 3940s
run: postgresql: (pid 14526) 9s; run: log: (pid 3858) 4081s
run: prometheus: (pid 14534) 9s; run: log: (pid 4372) 3958s
run: redis: (pid 14544) 8s; run: log: (pid 3744) 4092s
run: redis-exporter: (pid 14548) 8s; run: log: (pid 4449) 3946s
run: sidekiq: (pid 14559) 8s; run: log: (pid 4104) 3988s
run: unicorn: (pid 14562) 7s; run: log: (pid 4049) 3994s
[root@docker gitlab]# gitlab-ctl restart
ok: run: gitaly: (pid 14624) 0s
ok: run: gitlab-monitor: (pid 14630) 0s
ok: run: gitlab-workhorse: (pid 14633) 1s
ok: run: logrotate: (pid 14645) 0s
ok: run: nginx: (pid 14651) 1s
ok: run: node-exporter: (pid 14659) 0s
ok: run: postgres-exporter: (pid 14665) 1s
ok: run: postgresql: (pid 14674) 0s
ok: run: prometheus: (pid 14684) 0s
ok: run: redis: (pid 14695) 1s
ok: run: redis-exporter: (pid 14699) 0s
ok: run: sidekiq: (pid 14705) 1s
ok: run: unicorn: (pid 14710) 0s
[root@docker gitlab]#

蜷缩的蜗牛 , 版权所有丨如未注明 , 均为原创丨 转载请注明Gitlab 安装和简单配置
喜欢 (0)
[]
分享 (0)

您必须 登录 才能发表评论!