## 软件版本 任何软件开发,版本控制系统是必不可少的,这里选用`Gitlab-ce`社区一键安装版。 系统配置: ``` Distribution : CentOS 6.5 Minimal GitLab version : 8.14 Web Server : Nginx Database : PostgreSQL ``` 启用清华大学的镜像: * 新建`/etc/yum.repos.d/gitlab-ce.repo`,内容为: ``` [gitlab-ce] name=gitlab-ce baseurl=http://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el6 repo_gpgcheck=0 gpgcheck=0 enabled=1 gpgkey=https://packages.gitlab.com/gpg.key ``` * 再执行: ``` # yum makecache # yum install gitlab-ce ``` * 启动: ``` # gitlab-ctl reconfigure ``` * 检查状态: ``` # gitlab-ctl status run: gitlab-workhorse: (pid 12604) 3495s; run: log: (pid 12414) 3525s run: logrotate: (pid 12486) 3508s; run: log: (pid 12485) 3508s down: nginx: 1s, normally up, want up; run: log: (pid 12425) 3524s run: postgresql: (pid 12272) 3560s; run: log: (pid 12271) 3560s run: redis: (pid 12189) 3566s; run: log: (pid 12188) 3566s run: sidekiq: (pid 12405) 3527s; run: log: (pid 12404) 3527s run: unicorn: (pid 12374) 3529s; run: log: (pid 12373) 3529s ``` 注意,此一键安装包的安装路径为:`/opt/gitlab/`。 不仅如此,它也在`/opt/gitlab/embedded/`目录安装了一份自己依赖的`nginx`、`postgresql`、`redis`等等。 上述`run`的内容其实就是它自带的软件。 仔细看一下,`nginx`启动失败了。 查看日志: ``` # gitlab-ctl tail …… 2016-11-24_12:12:29.04308 2016/11/24 20:12:29 [emerg] 16711#0: socket() [::]:80 failed (97: Address family not supported by protocol) …… ``` 不断滚动出现。 各种百度,google,最后发现一句关键的话: > So custombuild would skip to add the line if no Ipv6 exists? 最后发现,阿里云默认是关闭`IPV6`,而`Nginx`默认监听了`IPV6`,由此发生了冲突。 修改一下配置文件: ``` # vim /etc/gitlab/gitlab.rb ``` 关掉`IPV6`: > nginx['listen_addresses'] = ['*', '[::]'] To: > nginx['listen_addresses'] = ['*'] 修改访问域名: > external_url 'http://dajojojalfsdfjo8owrfol' To: > external_url 'http://git.domain.com' 重新配置: ``` # gitlab-ctl reconfigure ``` ## 参考资料 * [Gitlab官方安装文档(CentOS)](https://github.com/gitlabhq/gitlab-recipes/tree/master/install/centos) * [Gitlab Community Edition 镜像使用帮助](https://mirror.tuna.tsinghua.edu.cn/help/gitlab-ce/) * [NGINX settings](https://docs.gitlab.com/omnibus/settings/nginx.html) * [nginx: [emerg] socket() [::1]:80 failed (97: Address family not supported by protocol](http://www.webhostingtalk.com/showthread.php?t=1350938) * [QQ exmail (腾讯企业邮箱)](https://docs.gitlab.com/omnibus/settings/smtp.html#qq-exmail)