22.4 GITLAB
在讲完搭建GIT服务器之后,我们都知道这并不完美,只适用于开发人员较少的公司。所以寻求一种更好的解决方案,国内有CODING、码云等都可以作为选择,这样可以不用自己维护;另外一种比较好的方法就是搭建GITLAB服务器。
官方网站:https://about.gitlab.com/
安装文档:https://about.gitlab.com/installation/#centos-7 (针对的是企业版ee)
我们要使用的是社区版本ce,不管是哪个版本,都要求服务器内存不低于4G。
安装gitlab
- 编辑repo文件:
# vim /etc/yum.repos.d/gitlab.repo
[gitlab-ce]
name=Gitlab CE Repository
baseurl=https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el$releasever/
gpgcheck=0
enabled=1
- 安装gitlab:
# yum install -y gitlab-ce
# gitlab-ctl reconfigure #自动配置gitlab
Running handlers:
Running handlers complete
Chef Client finished, 432/614 resources updated in 05 minutes 39 seconds
gitlab Reconfigured!
上面配置过程会花费一些时间,因为gitlab会将它启动所需要的服务全部配置好后打开。
# netstat -lntp
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 4376/node_exporter
tcp 0 0 127.0.0.1:9229 0.0.0.0:* LISTEN 5000/gitlab-workhor
tcp 0 0 127.0.0.1:9168 0.0.0.0:* LISTEN 5043/ruby
tcp 0 0 127.0.0.1:8080 0.0.0.0:* LISTEN 3903/unicorn master
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 4078/nginx: master
tcp 0 0 127.0.0.1:8082 0.0.0.0:* LISTEN 3949/sidekiq 5.1.3
tcp 0 0 127.0.0.1:9236 0.0.0.0:* LISTEN 5020/gitaly
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1029/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1394/master
tcp 0 0 0.0.0.0:8060 0.0.0.0:* LISTEN 4078/nginx: master
tcp 0 0 127.0.0.1:9121 0.0.0.0:* LISTEN 4503/redis_exporter
tcp 0 0 127.0.0.1:9090 0.0.0.0:* LISTEN 5053/prometheus
tcp 0 0 127.0.0.1:9187 0.0.0.0:* LISTEN 5098/postgres_expor
tcp 0 0 127.0.0.1:9093 0.0.0.0:* LISTEN 5069/alertmanager
tcp6 0 0 ::1:9168 :::* LISTEN 5043/ruby
tcp6 0 0 :::22 :::* LISTEN 1029/sshd
tcp6 0 0 ::1:25 :::* LISTEN 1394/master
tcp6 0 0 :::9094 :::* LISTEN 5069/alertmanager
tcp6 0 0 :::3306 :::* LISTEN 1352/mysqld
- 查看gitlab状态:
# gitlab-ctl status #查看gitlab服务状态
run: alertmanager: (pid 5069) 372s; run: log: (pid 5091) 371s
run: gitaly: (pid 5020) 374s; run: log: