Ubuntu 22.04|20.04|18.04 に pgAdmin 4 をインストールする方法 |
この投稿は主に、新規ユーザーに Ubuntu 22.04|20.04|18.04 Linux システムに pgAdmin 4 をインストールする方法をガイドするために書かれています。 pgAdmin は、Linux、Unix、Mac OS X、および Windows 上で動作する、機能が豊富なオープンソースの PostgreSQL 管理および開発プラットフォームです。
pgAdmin を使用すると、バージョン 9.2 以降、直感的で強力な Web インターフェイスを使用して PostgreSQL データベース サーバーを管理できます。他のプラットフォームに pgAdmin 4 をインストールするためのガイドがあります。
- Debian に pgAdmin 4 をインストールする方法
- CentOS 7 に pgAdmin 4 をインストールする方法
- FreeBSD 12 に pgAdmin4 をインストールする方法
共有プラットフォームとは異なるプラットフォームについては、上記のガイドと pgAdmin の公式ドキュメントを参照してください。 Ubuntu システムまたは Linux Mint を実行している場合は、このガイドが役に立ちます。
Ubuntu に pgAdmin4 をインストールするための 1 つの要件は、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 サーバーです。
「全般」セクションで、サーバーの名前と説明を入力します。
「接続」 タブで、アクセスの詳細 (DB ホスト、DB ユーザー、パスワード) を入力します。
完了したら、[保存] ボタンをクリックして設定を保存します。サーバーの追加に成功すると、左側のサイドバーに名前が表示されます。
サーバーを選択してデータベースの概要情報を表示し、変更を加えます。 pgAdmin の使用方法の詳細については、ドキュメント ページをご覧ください。
おすすめの本:
- PostgreSQL データベースを学ぶのに最適な本
関連している :
- Ubuntu に PostgreSQL 12 をインストールする
- 最高の無料およびオープンソース Web ホスティング コントロール パネル
- ClickHouse 分析 DBMS を Ubuntu にインストールする方法
- 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 のインストール