【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 -y install 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 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]#

6.访问我们的网站

在这里插入图片描述

liunx下通过python方式安装pgAdmin4(8.0)

1.安装python3以及pip3(版本3.8及以上不能运行,建议安装3.6.15)

见文章 【centos7】安装python3 pip3

2.安装依赖包

yum provides semanage 
yum -y install 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: 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

9.访问pgAdmin4

在这里插入图片描述

Liunx下通过docker 部署pgAdmin4

1.下载镜像

docker pull dpage/pgadmin4

2.启动镜像映射到5050端口

docker run -p 5050:80 \
    -e 'PGADMIN_DEFAULT_EMAIL=circledba@qq.com' \
    -e 'PGADMIN_DEFAULT_PASSWORD=123456' \
    -d dpage/pgadmin4

3.访问pgAdmin4

在这里插入图片描述

  • 10
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

DBA圈小圈

你的鼓励是我最大的动力!

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值