在CentOS上配置pgAdmin的步骤如下:
首先,确保系统已经安装了必要的依赖项。打开终端并执行以下命令:
sudo yum install -y gcc make readline -devel zlib-devel
下载并编译安装 PostgreSQL 源码包:
wget https://ftp.postgresql.org/pub/source/v13.4/postgresql-13.4.tar.gz
tar -xzvf postgresql-13.4.tar.gz
cd postgresql-13.4
./configure --prefix=/usr/local/pgsql
make
sudo make install
sudo useradd -m postgres
sudo su - postgres
psql -c "alter user postgres with password 'your_password';"
exit
/usr/local/pgsql/data/postgresql.conf
,允许远程连接:sudo vi /usr/local/pgsql/data/postgresql.conf
将以下行修改为:
listen_addresses '*'
pg_hba.conf
文件以允许远程连接:sudo vi /usr/local/pgsql/data/pg_hba.conf
在文件末尾添加以下行:
host all all 0.0.0.0/0 md5
sudo systemctl enable --now postgresql
sudo yum install -y pgadmin4
pgadmin4.conf
文件:sudo cp /etc/httpd/conf.d/pgadmin4.conf.sample /etc/httpd/conf.d/pgadmin4.conf
sudo vi /etc/httpd/conf.d/pgadmin4.conf
加入以下内容:
VirtualHost *:80
ServerName pgadmin.cn
sudo systemctl restart httpd
以上步骤应该可以帮助您在CentOS系统上成功安装和配置pgAdmin。如果在安装过程中遇到任何问题,可以参考pgAdmin的官方文档或在社区论坛寻求帮助。