如何在 Ubuntu 22.04|20.04|18.04 上安装 pgAdmin 4如何在 Ubuntu 22.04|20.04|18.04 上安装 pgAdmin 4如何在 Ubuntu 22.04|20.04|18.04 上安装 pgAdmin 4如何在 Ubuntu 22.04|20.04|18.04 上安装 pgAdmin 4
  • 业务
  • 目标
  • 支持
  • 登录
找到的结果: {phrase} (显示: {results_count} 共: {results_count_total})
显示: {results_count} 共: {results_count_total}

加载更多搜索结果...

搜索范围
模糊匹配
搜索标题
搜索内容

如何在 Ubuntu 22.04|20.04|18.04 上安装 pgAdmin 4

发表 admin at 2025年2月28日
类别
  • 未分类
标签

写这篇文章主要是为了指导新用户如何在 Ubuntu 22.04|20.04|18.04 Linux 系统上安装 pgAdmin 4。 pgAdmin 是一个功能丰富的开源 PostgreSQL 管理和开发平台,可在 Linux、Unix、Mac OS X 和 Windows 上运行。

借助 pgAdmin,您可以使用直观且功能强大的 Web 界面管理 PostgreSQL 数据库服务器(从版本 9.2 开始)。我们有在其他平台上安装 pgAdmin 4 的指南。

  • 如何在 Debian 上安装 pgAdmin 4
  • 如何在 CentOS 7 上安装 pgAdmin 4
  • 如何在 FreeBSD 12 上安装 pgAdmin4

请参阅上述指南和官方 pgAdmin 文档,了解与共享平台不同的平台。如果您运行的是 Ubuntu 系统或 Linux Mint,本指南将适合您。

在 Ubuntu 上安装 pgAdmin4 的一项要求是 PostgreSQL 服务器。您可以选择使用 >=9.6 的任何版本的 PostgreSQL 服务器。我们有指南可供安装 PostgreSQL 数据库服务器时参考。

  • 在 Ubuntu 上安装 PostgreSQL 13
  • 在 Ubuntu 上安装 PostgreSQL 12

在 Ubuntu 上完成 PostgreSQL 数据库服务器的安装后,继续在系统上安装并启动 pgAdmin4。

第1步:添加pgAdmin4存储库

适用于所有基于 Debian 的 Linux 操作系统的 pgAdmin 软件包可从 pgAdmin APT 存储库中获取。在此步骤中,我们将把存储库添加到我们的 Ubuntu 系统中。

curl  -fsSL https://www.pgadmin.org/static/packages_pgadmin_org.pub | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/pgadmin.gpg

使用下面的命令在您的 Ubuntu 系统中添加 pgAdmin 存储库:

sudo sh -c 'echo "deb https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/$(lsb_release -cs) pgadmin4 main" > /etc/apt/sources.list.d/pgadmin4.list'

您可以使用以下命令检查创建的存储库文件的内容:

$ cat /etc/apt/sources.list.d/pgadmin4.list
deb https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/bullseye pgadmin4 main

步骤2:在Ubuntu上安装pgAdmin4

最后,更新包列表。

sudo apt update

要在 Ubuntu 22.04|20.04|18.04 系统上安装 pgAdmin4 软件包,请运行以下命令,并提供正确的版本号:

sudo apt install pgadmin4

按y键继续安装

The following additional packages will be installed:
  cpp cpp-9 fontconfig-config fonts-dejavu-core gcc-9-base libapache2-mod-wsgi-py3 libatomic1 libauthen-sasl-perl libdata-dump-perl libdrm-amdgpu1 libdrm-intel1 libdrm-nouveau2 libdrm-radeon1
  libencode-locale-perl libfile-basedir-perl libfile-desktopentry-perl libfile-listing-perl libfile-mimeinfo-perl libfont-afm-perl libfontconfig1 libfontenc1 libgl1 libgl1-mesa-dri libglapi-mesa
  libglvnd0 libglx-mesa0 libglx0 libhtml-form-perl libhtml-format-perl libhtml-parser-perl libhtml-tagset-perl libhtml-tree-perl libhttp-cookies-perl libhttp-daemon-perl libhttp-date-perl
  libhttp-message-perl libhttp-negotiate-perl libice6 libio-html-perl libio-socket-ssl-perl libio-stringy-perl libipc-system-simple-perl libisl22 libllvm12 liblwp-mediatypes-perl
  liblwp-protocol-https-perl libmailtools-perl libmpc3 libnet-dbus-perl libnet-http-perl libnet-smtp-ssl-perl libnet-ssleay-perl libpciaccess0 libpq5 libsensors-config libsensors5 libsm6
  libtie-ixhash-perl libtimedate-perl libtry-tiny-perl liburi-perl libvulkan1 libwayland-client0 libwww-perl libwww-robotrules-perl libx11-protocol-perl libx11-xcb1 libxaw7 libxcb-dri2-0
  libxcb-dri3-0 libxcb-glx0 libxcb-present0 libxcb-randr0 libxcb-shape0 libxcb-shm0 libxcb-sync1 libxcb-xfixes0 libxcomposite1 libxcursor1 libxfixes3 libxft2 libxi6 libxinerama1 libxkbfile1
  libxml-parser-perl libxml-twig-perl libxml-xpathengine-perl libxmu6 libxpm4 libxrandr2 libxrender1 libxshmfence1 libxt6 libxtst6 libxv1 libxxf86dga1 libxxf86vm1 mesa-vulkan-drivers
  perl-openssl-defaults pgadmin4-desktop pgadmin4-server pgadmin4-web postgresql-client postgresql-client-12 postgresql-client-common x11-common x11-utils x11-xserver-utils xdg-utils
Suggested packages:
  cpp-doc gcc-9-locales libdigest-hmac-perl libgssapi-perl libcrypt-ssleay-perl lm-sensors libauthen-ntlm-perl libunicode-map8-perl libunicode-string-perl xml-twig-tools postgresql-12
  postgresql-doc-12 mesa-utils nickle cairo-5c xorg-docs-core
The following NEW packages will be installed:
  cpp cpp-9 fontconfig-config fonts-dejavu-core gcc-9-base libapache2-mod-wsgi-py3 libatomic1 libauthen-sasl-perl libdata-dump-perl libdrm-amdgpu1 libdrm-intel1 libdrm-nouveau2 libdrm-radeon1
  libencode-locale-perl libfile-basedir-perl libfile-desktopentry-perl libfile-listing-perl libfile-mimeinfo-perl libfont-afm-perl libfontconfig1 libfontenc1 libgl1 libgl1-mesa-dri libglapi-mesa
  libglvnd0 libglx-mesa0 libglx0 libhtml-form-perl libhtml-format-perl libhtml-parser-perl libhtml-tagset-perl libhtml-tree-perl libhttp-cookies-perl libhttp-daemon-perl libhttp-date-perl
  libhttp-message-perl libhttp-negotiate-perl libice6 libio-html-perl libio-socket-ssl-perl libio-stringy-perl libipc-system-simple-perl libisl22 libllvm12 liblwp-mediatypes-perl
  liblwp-protocol-https-perl libmailtools-perl libmpc3 libnet-dbus-perl libnet-http-perl libnet-smtp-ssl-perl libnet-ssleay-perl libpciaccess0 libpq5 libsensors-config libsensors5 libsm6
  libtie-ixhash-perl libtimedate-perl libtry-tiny-perl liburi-perl libvulkan1 libwayland-client0 libwww-perl libwww-robotrules-perl libx11-protocol-perl libx11-xcb1 libxaw7 libxcb-dri2-0
  libxcb-dri3-0 libxcb-glx0 libxcb-present0 libxcb-randr0 libxcb-shape0 libxcb-shm0 libxcb-sync1 libxcb-xfixes0 libxcomposite1 libxcursor1 libxfixes3 libxft2 libxi6 libxinerama1 libxkbfile1
  libxml-parser-perl libxml-twig-perl libxml-xpathengine-perl libxmu6 libxpm4 libxrandr2 libxrender1 libxshmfence1 libxt6 libxtst6 libxv1 libxxf86dga1 libxxf86vm1 mesa-vulkan-drivers
  perl-openssl-defaults pgadmin4 pgadmin4-desktop pgadmin4-server pgadmin4-web postgresql-client postgresql-client-12 postgresql-client-common x11-common x11-utils x11-xserver-utils xdg-utils
0 upgraded, 110 newly installed, 0 to remove and 6 not upgraded.
Need to get 222 MB of archives.
After this operation, 508 MB of additional disk space will be used.
Do you want to continue? [Y/n] y

Apache 服务应该在安装后启动。

$ systemctl status apache2
● apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
     Active: active (running) since Fri 2023-06-16 12:21:28 UTC; 15s ago
       Docs: https://httpd.apache.org/docs/2.4/
    Process: 22562 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
   Main PID: 22566 (apache2)
      Tasks: 55 (limit: 18678)
     Memory: 15.5M
        CPU: 204ms
     CGroup: /system.slice/apache2.service
             ├─22566 /usr/sbin/apache2 -k start
             ├─22568 /usr/sbin/apache2 -k start
             └─22569 /usr/sbin/apache2 -k start

Jun 16 12:21:28 jammy systemd[1]: Starting The Apache HTTP Server...
Jun 16 12:21:28 jammy systemd[1]: Started The Apache HTTP Server.

步骤 3:为 pgAdmin4 配置 Apache 服务器

启动 Apache Web 服务器配置。

sudo /usr/pgadmin4/bin/setup-web.sh

这将要求您输入 pgadmin4 用户电子邮件地址并设置密码:

Setting up pgAdmin 4 in web mode on a Debian 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: <input-email-address>
Password: <input-password>
Retype password: <Reenter-password>
pgAdmin 4 - Application Initialisation
======================================

Creating storage and log directories...

同意 Apache Web 服务器的配置。

We can now configure the Apache Web server for you. This involves enabling the wsgi module and configuring the pgAdmin 4 application to mount at /pgadmin4. Do you wish to continue (y/n)? y
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

第4步:访问pgAdmin 4 Web界面

如果您配置了 UFW 防火墙,请允许 http 和 https 流量。

sudo ufw allow http
sudo ufw allow https

打开浏览器并http://[ServerIP_or_domain]/pgadmin4。

使用设置的电子邮件地址和密码登录。

等待几秒钟初始化完成。

在 pgAdmin 的第一页上,通过点击“添加新服务器”添加要使用 pgAdmin 进行管理的 PostgreSQL 服务器。这可以是本地或远程 PostgreSQL 服务器。

在“常规”部分下,为服务器提供名称和说明。

在“连接”选项卡下,提供访问详细信息 - 数据库主机、数据库用户和密码。

完成后,点击保存按钮保存配置。如果您成功添加服务器,名称将显示在左侧边栏中。

选择服务器以查看数据库摘要信息并进行更改。从文档页面了解有关如何使用 pgAdmin 的更多信息。

推荐书籍:

  • 学习 PostgreSQL 数据库的最佳书籍

有关的 :

  • 在 Ubuntu 上安装 PostgreSQL 12
  • 最佳免费开源虚拟主机控制面板
  • 如何在 Ubuntu 上安装 ClickHouse 分析 DBMS
  • 如何在 Ubuntu 上安装 ArangoDB

标签:

  • 在 Ubuntu 22.04|20.04|18.04 上安装 pgAdmin 4
  • 在 Ubuntu 22.04|20.04|18.04 上安装 pgAdmin 4
  • Ubuntu 22.04|20.04|18.04 上的 pgAdmin 4 安装
©2015-2025 Norria support@alaica.com