Ubuntu22.04 「pgAdmin4」をインストールする

Ubuntu22.04 「pgAdmin4」をインストールする

Ubuntu22.04に、「pgAdmin4」をインストールする手順を記述してます。リポジトリを追加してから「apt」でインストールします。作業時間は10分ほどです。また、「curl」を使用するので事前にインストールしておきます。

環境

  • OS Ubuntu22.04
  • shell /bin/bash

リポジトリ追加

「curl」を使用するのでインストールしておきます。

$ sudo apt install curl

新しいキーを追加します。

$ sudo curl https://www.pgadmin.org/static/packages_pgadmin_org.pub | sudo apt-key add

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
100  3935  100  3935    0     0   3546      0  0:00:01  0:00:01 --:--:--  3548
OK

リストを追加します。

$ 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'

アップデートを行います。

$ apt update

「pgAdmin4」インストール

「apt」を使用してインストールします。

$ sudo apt install pgadmin4

ログイン用の「メールアドレス」と「パスワード」を登録します。

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

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: hoge@hoge.com
Password: パスワードを入力
Retype password: 同じパスワード入力
pgAdmin 4 - Application Initialisation
======================================

Creating storage and log directories...
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

「pgAdmin4」アクセス

ブラウザから「 http://プライベートIP or サーバーアドレス/pgadmin4/browser/ 」にアクセスして、さきほど作成したメールアドレスとパスワードを入力すれば、構築は完了です。

また「DeskTop」版もインストールされています。