在CentOS系统中安装pgAdmin插件的步骤如下:
更新系统包:
sudo yum update -y
安装EPEL仓库(如果尚未安装):
sudo yum install epel-release -y
安装pgAdmin4:
sudo yum install pgadmin4 -y
启动pgAdmin4服务:
sudo systemctl start pgadmin4
设置pgAdmin4开机自启:
sudo systemctl enable pgadmin4
访问pgAdmin4:
打开浏览器,访问 http://<your_server_ip>:5050
,使用默认用户名和密码登录(通常是 postgres
/postgres
或者你在安装时设置的用户名和密码)。
如果你需要特定版本的pgAdmin或者有特殊需求,可以选择从源码编译安装。
安装依赖包:
sudo yum groupinstall "Development Tools" -y
sudo yum install python3-pip python3-devel postgresql-devel -y
安装pip包管理工具:
sudo pip3 install --upgrade pip
下载pgAdmin4源码:
git clone https://github.com/pgadmin/pgadmin4.git
cd pgadmin4
安装Python依赖:
pip3 install -r requirements/base.txt
pip3 install -r requirements/dev.txt
配置环境变量:
编辑 ~/.bashrc
或 ~/.bash_profile
,添加以下内容:
export PGADMIN_DEFAULT_EMAIL="your_email@example.com"
export PGADMIN_DEFAULT_PASSWORD="your_password"
然后执行:
source ~/.bashrc
构建并安装pgAdmin4:
make build
sudo make install
启动pgAdmin4服务:
pgadmin4-web --port 5050
访问pgAdmin4:
打开浏览器,访问 http://<your_server_ip>:5050
,使用你在配置文件中设置的用户名和密码登录。
通过以上步骤,你应该能够在CentOS系统中成功安装并运行pgAdmin插件。