【PostgreSQL】从零开始:(三)PgAdmin4下载与安装
pgAdmin简介
pgAdmin 是 Postgres 的领先开源管理工具,pgAdmin 4 旨在满足新手和经验丰富的 Postgres 用户的需求,提供强大的图形界面,简化数据库对象的创建、维护和使用。
pgAdmin 可在 Linux、Unix、macOS 和 Windows 上使用来管理 PostgreSQL 和 EDB Advanced Server 11 及更高版本。
liunx下部署通过yum部署pgAdmin4(6.21)
当前最新版本8.0不支持通过 部署
1.安装依赖包
yum provides semanage
yum -yinstall policycoreutils-python.x86_64
2.永久停止防火墙
systemctl stop firwalld.service
systemctl disable firwalld.service
3.配置pgadmin4项目源
rpm-i https://ftp.postgresql.org/pub/pgadmin/pgadmin4/yum/pgadmin4-redhat-repo-2-1.noarch.rpm
4.下载并安装pgAdmin4
作为服务器使用我们只需要安装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版本
5.执行初始化命令
/usr/pgadmin4/bin/setup-web.sh
[root@pgAdmin web]# /usr/pgadmin4/bin/setup-web.sh
Setting up pgAdmin 4in 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: [email protected]
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 4in web mode at http://127.0.0.1/pgadmin4
[root@pgAdmin web]#
6.访问我们的网站
liunx下通过python方式安装pgAdmin4(8.0)
1.安装python3以及pip3(版本3.8及以上不能运行,建议安装3.6.15)
见文章 【centos7】安装python3 pip3
2.安装依赖包
yum provides semanage
yum -yinstall policycoreutils-python.x86_64
3.永久关闭SELinux
vi /etc/selinux/config
##找到以下行:SELINUX=enforcing
##将其改为:SELINUX=disabled
保存并关闭文件。
重新启动系统以使更改生效。
4.永久停止防火墙
systemctl stop firwalld.service
systemctl disable firwalld.service
5. 创建使用的目录
mkdir /var/lib/pgadmin
mkdir /var/log/pgadmin
6. 执行安装
python3 -m venv pgadmin4
source pgadmin4/bin/activate
pip install pgadmin4
7.修改配置文件
vi /root/pgadmin4/lib/python3.6/site-packages/pgadmin4/config.py
#找到
DEFAULT_SERVER ='127.0.0.1'#修改为
DEFAULT_SERVER ='0.0.0.0'
8.执行初始化
pgadmin4
直到出现
NOTE: Configuring authentication for SERVER mode.
Enter the email address and password to use for the initial pgAdmin user account:
Email address: [email protected]
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
9.访问pgAdmin4
Liunx下通过docker 部署pgAdmin4
1.下载镜像
docker pull dpage/pgadmin4
2.启动镜像映射到5050端口
docker run -p5050:80 \-e'[email protected]'\-e'PGADMIN_DEFAULT_PASSWORD=123456'\-d dpage/pgadmin4
3.访问pgAdmin4
版权归原作者 DBA圈小圈 所有, 如有侵权,请联系我们删除。