温馨提示×

怎样在debian重启gitlab

小樊
33
2026-10-20 01:16:05
栏目: 智能运维

在 Debian 系统上重启 GitLab,通常取决于你是通过官方 Omnibus 包安装的,还是通过源码/Docker 安装的。下面按最常见情况说明。


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

如果你是通过 GitLab 官方 .deb 包安装的(默认路径 /opt/gitlab),使用以下命令:

1️⃣ 重启 GitLab 所有服务

sudo gitlab-ctl restart

2️⃣ 只重启某个服务(可选)

sudo gitlab-ctl restart nginx
sudo gitlab-ctl restart unicorn   # 老版本
sudo gitlab-ctl restart puma      # 新版本

3️⃣ 查看服务状态

sudo gitlab-ctl status

二、使用 systemd(推荐方式)

Omnibus 安装也会注册 systemd 服务:

sudo systemctl restart gitlab-runsvdir

或(某些版本):

sudo systemctl restart gitlab

查看状态:

systemctl status gitlab-runsvdir

三、Docker 方式安装的 GitLab

如果是 Docker 容器:

docker restart gitlab

(容器名按实际情况替换)


四、源码安装(较少见)

如果是源码安装,一般使用:

sudo service gitlab restart

或

sudo /etc/init.d/gitlab restart

五、重启后建议检查

sudo gitlab-ctl status
sudo gitlab-rake gitlab:check SANITIZE=true

如果你不确定是哪种安装方式,可以告诉我:

  • which gitlab-ctl 是否有输出
  • 是否是 Docker
  • GitLab 版本

我可以更精确地帮你判断。

0 踩