温馨提示×

PgAdmin在Ubuntu如何启动

小樊
42
2026-08-06 03:24:03
栏目: 智能运维

在 Ubuntu 上启动 pgAdmin 取决于你是通过哪种方式安装的(APT、Python pip、或 Docker)。下面是最常见的几种方式:


一、通过 APT 安装的 pgAdmin(最常见)

1️⃣ 启动 pgAdmin 服务

如果是 pgAdmin 4(Web 模式),需要先启动 Apache 或 pgAdmin 服务:

sudo systemctl start pgadmin4

设置开机自启(可选):

sudo systemctl enable pgadmin4

2️⃣ 在浏览器中访问

打开浏览器,访问:

http://localhost/pgadmin4

或:

http://127.0.0.1/pgadmin4

首次访问会要求你设置 pgAdmin 管理员邮箱和密码


二、通过 Python pip 安装的 pgAdmin

如果你是本地用户模式安装:

1️⃣ 启动 pgAdmin

pgadmin4

或:

python3 -m pgadmin4

2️⃣ 浏览器访问

通常访问:

http://127.0.0.1:5050

三、Docker 方式运行 pgAdmin

如果你是用 Docker 启动的:

docker run -p 5050:80 \
  -e PGADMIN_DEFAULT_EMAIL=admin@admin.com \
  -e PGADMIN_DEFAULT_PASSWORD=admin \
  -d dpage/pgadmin4

访问:

http://localhost:5050

四、常见问题排查

✅ 端口被占用

检查端口:

ss -lntp | grep 5050

✅ 服务没启动

sudo systemctl status pgadmin4

✅ PostgreSQL 未启动

sudo systemctl status postgresql

五、快速判断你是如何安装的

which pgadmin4

或:

dpkg -l | grep pgadmin

如果你愿意,可以告诉我:

  • Ubuntu 版本(20.04 / 22.04 / 24.04)
  • 安装方式(apt / pip / docker)
  • 是否看到报错信息

我可以给你精确到你当前环境的启动方案 ✅

0