在 Ubuntu 上启动 pgAdmin 取决于你是通过哪种方式安装的(APT、Python pip、或 Docker)。下面是最常见的几种方式:
如果是 pgAdmin 4(Web 模式),需要先启动 Apache 或 pgAdmin 服务:
sudo systemctl start pgadmin4
设置开机自启(可选):
sudo systemctl enable pgadmin4
打开浏览器,访问:
http://localhost/pgadmin4
或:
http://127.0.0.1/pgadmin4
首次访问会要求你设置 pgAdmin 管理员邮箱和密码。
如果你是本地用户模式安装:
pgadmin4
或:
python3 -m pgadmin4
通常访问:
http://127.0.0.1:5050
如果你是用 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
sudo systemctl status postgresql
which pgadmin4
或:
dpkg -l | grep pgadmin
如果你愿意,可以告诉我:
我可以给你精确到你当前环境的启动方案 ✅