Centos6/7.X搭建gitlab
- 安装配置依赖项
如想使用Postfix来发送邮件,在安装期间请选择’Internet Site’. 您也可以用sendmai或者 配置SMTP服务 并 使用SMTP发送邮件.
在 Centos 6 系统上, 下面的命令将在系统防火墙里面开放HTTP和SSH端口.
yum install curl openssh-server openssh-clients postfix cronie -y
service postfix start
chkconfig postfix on
lokkit -s http -s ssh
- 安装
添加GitLab仓库,并安装到服务器上
curl -sS http://packages.gitlab.cc/install/gitlab-ce/script.rpm.sh | sudo bash
sudo yum install gitlab-ce
我是rpm安装
Wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el6/gitlab-ce-XXX.rpm
我选择的版本是10.8.4
centos (内核7.x)https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7
centos (内核6.x)https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el6
- 启动GitLab
gitlab-ctl reconfigure
4、注意事项以及异常故障排查:
默认安装登录需要重置root密码。可以自己单独设置一个复杂密码后登录。
gitlab本身采用80端口,如安装前服务器有启用80,安装完访问会报错。需更改gitlab的默认端口。
修改vim /etc/gitlab/gitlab.rb:
external_url 'http://localhost:90'
unicorn本身采用8080端口,如果你那里没有8080使用,可以后边不用修改了。如安装前服务器有启用8080,安装完访问会报错。需更改unicorn的默认端口:
修改 /etc/gitlab/gitlab.rb:
unicorn['listen'] = '127.0.0.1'
unicorn['port'] = 3000
每次重新配置,都需要执行sudo gitlab-ctl reconfigure 使之生效。
日志位置:/var/log/gitlab 可以进去查看访问日志以及报错日志等,供访问查看以及异常排查。
gitlab-ctl tail #查看所有日志
gitlab-ctl tail nginx/gitlab_access.log #查看nginx访问日志