CentOS7安装GitLab

1、新建 /etc/yum.repos.d/gitlab-ce.repo,内容为

[gitlab-ce]
name=gitlab-ce
baseurl=http://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7
repo_gpgcheck=0
gpgcheck=0
enabled=1
gpgkey=https://packages.gitlab.com/gpg.key

再执行
yum makecache
yum install gitlab-ce

注意:这里是使用清华大学的yum源,最新yum源可在www.gitlab.cc查看说明文档

2、启动GitLab

gitlab-ctl reconfigure

3、使用浏览器访问GitLab

首次访问GitLab,系统会让你重新设置管理员的密码,设置成功后会返回登录界面.
默认的管理员账号是root,如果你想更改默认管理员账号,请输入上面设置的新密码登录系统后修改帐号名.

 4、查看GitLab服务状态,列出了所有组件的运行状态

# gitlab-ctl status
run: gitlab-workhorse: (pid 868) 1345s; run: log: (pid 861) 1345s
run: logrotate: (pid 867) 1345s; run: log: (pid 860) 1345s
run: nginx: (pid 866) 1345s; run: log: (pid 859) 1345s
run: postgresql: (pid 858) 1345s; run: log: (pid 857) 1345s
run: redis: (pid 864) 1345s; run: log: (pid 863) 1345s
run: sidekiq: (pid 856) 1345s; run: log: (pid 855) 1345s
run: unicorn: (pid 865) 1345s; run: log: (pid 862) 1345s

5、重启GitLab(重启所有组件)

# gitlab-ctl restart
ok: run: gitlab-workhorse: (pid 3996) 1s
ok: run: logrotate: (pid 4002) 0s
ok: run: nginx: (pid 4009) 0s
ok: run: postgresql: (pid 4016) 1s
ok: run: redis: (pid 4025) 0s
ok: run: sidekiq: (pid 4030) 0s
ok: run: unicorn: (pid 4035) 0s

6、要单独重新启动组件,您可以修改其服务名称为重新启动命令。例如,只重启NGINX你可以运行: 

# gitlab-ctl restart nginx
ok: run: nginx: (pid 4181) 0s

7、有时候,组件超时启动期间,有时他们会被卡住。 在这种情况下,我们可以使用

gitlab-ctl kill <service>
然后重新启动服务

作为最后的手段,你可以尝试重新配置GitLab代替:gitlab-ctl reconfigure

8、配置域名,修改nginx配置文件

cd  /var/opt/gitlab/nginx/conf
vim gitlab-http.conf
...
server_name gitlab.heboan.com;   #修改42行
...


重启nginx
gitlab-ctl restart nginx


修改hosts或DNS解析
访问gitlab.heboan.com
posted @ 2016-09-11 15:39  sellsa  阅读(191)  评论(0)    收藏  举报