温馨提示×

linux gitlab怎么启动

小樊
38
2026-09-07 13:05:41
栏目: 智能运维

在 Linux 上“启动 GitLab”通常是指 启动 GitLab 服务(Omnibus 安装方式),或者是 GitLab CE/EE 的 systemd 服务。下面按常见情况说明:


一、Omnibus 方式安装的 GitLab(最常见)

1. 启动 GitLab

sudo gitlab-ctl start

2. 停止 GitLab

sudo gitlab-ctl stop

3. 重启 GitLab

sudo gitlab-ctl restart

4. 查看运行状态

sudo gitlab-ctl status

5. 开机自启(systemd)

GitLab 默认会注册为系统服务:

sudo systemctl enable gitlab-runsvdir
sudo systemctl start gitlab-runsvdir

二、通过 systemd 直接启动(等价方式)

sudo systemctl start gitlab-runsvdir.service

三、Docker 方式运行的 GitLab

如果是 Docker 启动:

docker start gitlab

docker run --detach \
  --hostname gitlab.example.com \
  --publish 443:443 --publish 80:80 --publish 22:22 \
  --name gitlab \
  --restart always \
  gitlab/gitlab-ce:latest

四、首次安装后需要重新配置

如果是刚安装完:

sudo gitlab-ctl reconfigure

然后再:

sudo gitlab-ctl start

五、访问 GitLab

浏览器访问:

http://服务器IP

默认管理员:

  • 用户名:root
  • 密码在:
sudo cat /etc/gitlab/initial_root_password

如果你能告诉我:

  • 物理机 / 虚拟机 / Docker / K8s
  • GitLab CE / EE
  • 安装方式(Omnibus / 源码 / Docker)

我可以给你更精确的启动命令。

0