在 CentOS 上启动 GitLab,通常取决于你的安装方式。下面是最常见的 Omnibus GitLab 启动流程(官方推荐方式)。
gitlab-ctl status
如果能看到服务状态,说明 GitLab 已安装。
sudo gitlab-ctl start
sudo gitlab-ctl status
正常会看到类似:
run: gitaly: (pid 1234) 10s
run: nginx: (pid 1235) 10s
run: postgresql: (pid 1236) 10s
run: redis: (pid 1237) 10s
run: sidekiq: (pid 1238) 10s
run: unicorn / puma: (pid 1239) 10s
sudo gitlab-ctl restart
如果修改过 /etc/gitlab/gitlab.rb:
sudo gitlab-ctl reconfigure
GitLab 一般会使用 systemd:
sudo systemctl enable gitlab-runsvdir
sudo systemctl start gitlab-runsvdir
查看状态:
systemctl status gitlab-runsvdir
默认访问地址:
http://服务器IP
如果是第一次启动,可能需要设置管理员密码。
sudo netstat -tunlp | grep 80
修改端口(如改为 8080):
编辑 /etc/gitlab/gitlab.rb:
external_url 'http://IP:8080'
nginx['listen_port'] = 8080
然后:
sudo gitlab-ctl reconfigure
sudo gitlab-ctl restart
sudo gitlab-ctl tail
或指定服务:
sudo gitlab-ctl tail nginx
| 功能 | 命令 |
|---|---|
| 启动 | gitlab-ctl start |
| 停止 | gitlab-ctl stop |
| 重启 | gitlab-ctl restart |
| 查看状态 | gitlab-ctl status |
| 重载配置 | gitlab-ctl reconfigure |
| 查看日志 | gitlab-ctl tail |
如果你愿意,可以告诉我:
我可以给你更精确的启动方案。