pgAdmin 是 Postgres 的领先开源管理工具,pgAdmin 4 旨在满足新手和经验丰富的 Postgres 用户的需求,提供强大的图形界面,简化数据库对象的创建、维护和使用。
pgAdmin 可在 Linux、Unix、macOS 和 Windows 上使用来管理 PostgreSQL 和 EDB Advanced Server 11 及更高版本。
当前最新版本8.0不支持通过 部署
yum provides semanage
yum -y install policycoreutils-python.x86_64
systemctl stop firwalld.service
systemctl disable firwalld.service
rpm -i https://ftp.postgresql.org/pub/pgadmin/pgadmin4/yum/pgadmin4-redhat-repo-2-1.noarch.rpm
作为服务器使用我们只需要安装web端就好
yum install -y pgadmin4-web
官网提供一下安装方式
To install pgAdmin, run one of the following commands:
Install for both desktop and web modes. #安装桌面版和web版本
sudo yum install pgadmin4
Install for desktop mode only. #安装桌面版
sudo yum install pgadmin4-desktop
Install for web mode only.
sudo yum install pgadmin4-web
#安装web版本
/usr/pgadmin4/bin/setup-web.sh
[root@pgAdmin web]# /usr/pgadmin4/bin/setup-web.sh
Setting up pgAdmin 4 in web mode on a Redhat based platform...
Creating configuration database...
NOTE: Configuring authentication for SERVER mode.
Enter the email address and password to use for the initial pgAdmin user account:
Email address:
The email address is not valid. It must have exactly one @-sign.
Invalid email address. Please try again.
Email address: circle-dba.qq.com
The email address is not valid. It must have exactly one @-sign.
Invalid email address. Please try again.
Email address: circle-dba@qq.com
Password:
Retype password:
pgAdmin 4 - Application Initialisation
======================================
Creating storage and log directories...
Configuring SELinux...
setsebool: SELinux is disabled.
setsebool: SELinux is disabled
The Apache web server is running and must be restarted for the pgAdmin 4 installation to complete. Continue (y/n)? y
Apache successfully restarted. You can now start using pgAdmin 4 in web mode at http://127.0.0.1/pgadmin4
[root@pgAdmin web]#
yum provides semanage
yum -y install policycoreutils-python.x86_64
vi /etc/selinux/config
##找到以下行:
SELINUX=enforcing
##将其改为:
SELINUX=disabled
保存并关闭文件。
重新启动系统以使更改生效。
systemctl stop firwalld.service
systemctl disable firwalld.service
mkdir /var/lib/pgadmin
mkdir /var/log/pgadmin
python3 -m venv pgadmin4
source pgadmin4/bin/activate
pip install pgadmin4
vi /root/pgadmin4/lib/python3.6/site-packages/pgadmin4/config.py
#找到
DEFAULT_SERVER = '127.0.0.1'
#修改为
DEFAULT_SERVER = '0.0.0.0'
pgadmin4
直到出现
NOTE: Configuring authentication for SERVER mode.
Enter the email address and password to use for the initial pgAdmin user account:
Email address: user@domain.com
Password:
Retype password:
Starting pgAdmin 4. Please navigate to http://0.0.0.0:5050 in your browser.
* Serving Flask app "pgadmin" (lazy loading)
* Environment: production
WARNING: Do not use the development server in a production environment.
Use a production WSGI server instead.
* Debug mode: off
docker pull dpage/pgadmin4
docker run -p 5050:80 \
-e 'PGADMIN_DEFAULT_EMAIL=circledba@qq.com' \
-e 'PGADMIN_DEFAULT_PASSWORD=123456' \
-d dpage/pgadmin4