Linux pgAdmin网络配置需关注系统网络、pgAdmin服务及防火墙设置,具体要求如下:
ip addr
查看接口信息,编辑/etc/netplan/*.yaml
(Ubuntu)或/etc/sysconfig/network-scripts/ifcfg-*
(CentOS)设置静态IP、网关、DNS等参数,修改后重启网络服务(sudo netplan apply
或sudo systemctl restart network
)。/etc/pgadmin/pgadmin4.conf
或~/.config/pgadmin/pgadmin.conf
),设置listen_address = 0.0.0.0
以允许所有IP访问,指定监听端口(默认5432)。firewalld
可执行:sudo firewall-cmd --add-port=5432/tcp --permanent
sudo firewall-cmd --reload
。postgresql.conf
中listen_addresses = '*'
),并在pg_hba.conf
中添加允许pgAdmin访问的IP规则(如host all all 0.0.0.0/0 md5
),重启PostgreSQL生效。注:配置前建议备份相关文件,部分步骤可能因Linux发行版或pgAdmin版本略有差异,可参考官方文档调整。