参考大神安装步骤:
https://www.cnblogs.com/menghaoqi/p/6296127.html
1、配置yum源
vim /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
2、更新本地yum缓存
sudo yum makecache
3、安装GitLab社区版
sudo yum install gitlab-ce #自动安装最新版
sudo yum install gitlab-ce-x.x.x #安装指定版本
GitLab常用命令
sudo gitlab-ctl start # 启动所有 gitlab 组件;
sudo gitlab-ctl stop # 停止所有 gitlab 组件;
sudo gitlab-ctl restart # 重启所有 gitlab 组件;
sudo gitlab-ctl status # 查看服务状态;
sudo gitlab-ctl reconfigure # 启动服务;
sudo vim /etc/gitlab/gitlab.rb # 修改默认的配置文件;
gitlab-rake gitlab:check SANITIZE=true --trace # 检查gitlab;
sudo gitlab-ctl tail # 查看日志;
3、启动gitlab
sudo gitlab-ctl reconfigure
注意事项以及异常故障排查:
1,按照该方式,我安装了一个确实没问题,只不过是英文版。没有经过汉化(汉化请参考后边的教程)。
2,默认安装登录需要重置root密码。可以自己单独设置一个复杂密码后登录。
3,gitlab本身采用80端口,如安装前服务器有启用80,安装完访问会报错。需更改gitlab的默认端口。
修改vim /etc/gitlab/gitlab.rb:
external_url 'http://localhost:90'
如果就想用80端口,那没问题。如果更改了端口,后边可以自行调整nginx配置文件进行nginx反向代理设置。
4,这里可以绑定自己的gitlab的域名或者公网、内网IP替换localhost进行公网访问,具体根据自己的实际情况。安全起见,一般会将gitlab部署于内网。具体部署到哪里,请根据自己的实际情况来定。(基于安全原因,这里不建议设置公网IP进行暴露,可以通过nginx设置IP绑定进行return或者其他规则进行IP回避访问。)
本站测试gitlab地址域名为:gitlab.21yunwei.com
5,unicorn本身采用8080端口,如果你那里没有8080使用,可以后边不用修改了。如安装前服务器有启用8080,安装完访问会报错。需更改unicorn的默认端口:
修改 /etc/gitlab/gitlab.rb:
unicorn['listen'] = '127.0.0.1' unicorn['port'] = 3000
5,每次重新配置,都需要执行sudo gitlab-ctl reconfigure 使之生效。
6,日志位置:/var/log/gitlab 可以进去查看访问日志以及报错日志等,供访问查看以及异常排查。
gitlab-ctl tail #查看所有日志
gitlab-ctl tail nginx/gitlab_access.log #查看nginx访问日志