/etc/pgadmin/下的文件)及数据库数据,防止升级过程中出现数据丢失或配置损坏。pgadmin4 --version命令,确认当前pgAdmin的安装版本。sudo yum update -y,确保系统所有软件包为最新版本,避免依赖冲突。sudo yum clean all && sudo yum update,同步YUM仓库的最新包信息。sudo yum update pgadmin4命令,YUM会自动检测并升级到仓库中的最新版本。pgadmin4 --version确认版本号已更新;或在浏览器中访问http://<服务器IP>:5050(默认端口),登录pgAdmin查看版本信息。sudo yum remove pgadmin4,彻底移除旧版本pgAdmin及其依赖(保留配置文件需添加-keepcache选项)。https://ftp.postgresql.org/pub/pgadmin/pgadmin4/yum/repo/centos/$releasever/$basearch/)或GitHub Releases页面,下载适用于CentOS的最新RPM包(如pgadmin4-4.36-1-centos7.x86_64.rpm)。可使用wget命令直接下载,例如:wget https://ftp.postgresql.org/pub/pgadmin/pgadmin4/v4.36/pgadmin4-4.36-1-centos7.x86_64.rpm。sudo yum install ./pgadmin4-*.rpm(注意./表示当前目录下的RPM文件),YUM会自动解决依赖问题并完成安装。/etc/systemd/system/pgadmin4.service),内容如下:[Unit]
Description=pgAdmin 4
After=network.target
[Service]
Type=simple
User=pgadmin
ExecStart=/usr/pgadmin4/bin/pgadmin4
Restart=always
[Install]
WantedBy=multi-user.target
保存后执行sudo systemctl daemon-reload、sudo systemctl enable pgadmin4、sudo systemctl start pgadmin4,设置开机自启并启动服务。http://<服务器IP>:5050,登录pgAdmin查看版本信息,或运行pgadmin4 --version确认。yum deplist pgadmin4查看依赖关系,手动安装缺失的依赖包。firewalld或iptables)允许pgAdmin的默认端口(5050)通过,命令示例:sudo firewall-cmd --add-port=5050/tcp --permanent && sudo firewall-cmd --reload。