CentOS下pgAdmin插件安装指南
在CentOS上安装pgAdmin插件前,需先完成pgAdmin4的部署。以下是两种常用安装方式:
# 更新系统包
sudo yum update -y
# 安装EPEL仓库(若未安装)
sudo yum install epel-release -y
# 安装pgAdmin4
sudo yum install pgadmin4 -y
# 启动pgAdmin4服务并设置开机自启
sudo systemctl start pgadmin4
sudo systemctl enable pgadmin4
安装完成后,通过浏览器访问http://<服务器IP>:5050
,使用默认用户名postgres
、密码postgres
登录。
# 安装开发工具及依赖
sudo yum groupinstall "Development Tools" -y
sudo yum install python3-pip python3-devel postgresql-devel -y
# 克隆pgAdmin4源码
git clone https://github.com/pgadmin/pgadmin4.git
cd pgadmin4
# 安装Python依赖
pip3 install -r requirements/base.txt
pip3 install -r requirements/dev.txt
# 构建并安装pgAdmin4
python3 setup.py build
sudo python3 setup.py install
# 启动pgAdmin4服务
pgadmin4 --listen localhost --port 5050
访问http://<服务器IP>:5050
登录。
pgAdmin插件可通过界面导入或手动复制两种方式安装,以下是详细流程:
http://<服务器IP>:5050
,输入凭据登录。.zip
文件(如pgadmin-extensions-1.0.0.zip
),点击“安装”。sudo systemctl restart pgadmin4
.zip
格式的插件文件。plugins
目录:# 默认plugins目录路径(根据安装方式调整)
sudo unzip plugin.zip -d /usr/lib/pgadmin4/web/pgAdmin4/plugins/
sudo systemctl restart pgadmin4
安装完成后,可通过pgAdmin界面管理插件:
sudo
获取root权限,避免目录写入失败。