MongoDB Compassをインストールする!(Ubuntu Desktop 22.04)

Ubuntu Desktop 22.04に、MongoDBのGUIクライアントである「MongoDB Compass」をインストールします。

MongoDB Compassの最新バージョンを確認する!

以下のページで、MongoDB Compassの最新バージョンを確認します。

MongoDB Compassをダウンロードする!

$ wget https://downloads.mongodb.com/compass/mongodb-compass_1.36.3_amd64.deb
--2023-04-17 07:47:59--  https://downloads.mongodb.com/compass/mongodb-compass_1.36.3_amd64.deb
Resolving downloads.mongodb.com (downloads.mongodb.com)... 18.65.216.98, 18.65.216.76, 18.65.216.10, ...
Connecting to downloads.mongodb.com (downloads.mongodb.com)|18.65.216.98|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 98133858 (94M) [application/octet-stream]
Saving to: ‘mongodb-compass_1.36.3_amd64.deb’

mongodb-compass_1.36.3_amd64. 100%[=================================================>]  93.59M  18.2MB/s    in 6.3s    

2023-04-17 07:48:06 (14.9 MB/s) - ‘mongodb-compass_1.36.3_amd64.deb’ saved [98133858/98133858]

MongoDB Compassをインストールする!

dpkgコマンドで、「MongoDB Compass」のインストール試みますが、エラーで失敗します。

$  sudo dpkg -i mongodb-compass_1.36.3_amd64.deb 
[sudo] password for usradmin: 
Selecting previously unselected package mongodb-compass.
(Reading database ... 200777 files and directories currently installed.)
Preparing to unpack mongodb-compass_1.36.3_amd64.deb ...
Unpacking mongodb-compass (1.36.3) ...
dpkg: dependency problems prevent configuration of mongodb-compass:
 mongodb-compass depends on libgconf-2-4 | libgconf2-4; however:
  Package libgconf-2-4 is not installed.
  Package libgconf2-4 is not installed.
 mongodb-compass depends on libgconf-2-4; however:
  Package libgconf-2-4 is not installed.

dpkg: error processing package mongodb-compass (--install):
 dependency problems - leaving unconfigured
Processing triggers for mailcap (3.70+nmu1ubuntu1) ...
Processing triggers for gnome-menus (3.36.0-1ubuntu3) ...
Processing triggers for desktop-file-utils (0.26-1ubuntu3) ...
Errors were encountered while processing:
 mongodb-compass

依存パッケージのインストールを試みますが、これもエラーで失敗します。

$ sudo apt install libgconf-2-4
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 libgconf-2-4 : Depends: gconf2-common (= 3.2.6-7ubuntu2) but it is not going to be installed
                Recommends: gconf-service
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

エラーメッセージ通り、インストール状態を修復します。

$ sudo apt --fix-broken install
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
  gconf-service gconf-service-backend gconf2-common libgconf-2-4
The following NEW packages will be installed:
  gconf-service gconf-service-backend gconf2-common libgconf-2-4
0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
Need to get 861 kB of archives.
After this operation, 8,092 kB of additional disk space will be used.
Do you want to continue? [Y/n] 
Get:1 http://jp.archive.ubuntu.com/ubuntu jammy/universe amd64 gconf2-common all 3.2.6-7ubuntu2 [698 kB]
Get:2 http://jp.archive.ubuntu.com/ubuntu jammy/universe amd64 libgconf-2-4 amd64 3.2.6-7ubuntu2 [86.0 kB]
Get:3 http://jp.archive.ubuntu.com/ubuntu jammy/universe amd64 gconf-service-backend amd64 3.2.6-7ubuntu2 [59.3 kB]
Get:4 http://jp.archive.ubuntu.com/ubuntu jammy/universe amd64 gconf-service amd64 3.2.6-7ubuntu2 [17.4 kB]
Fetched 861 kB in 3s (286 kB/s)     
Selecting previously unselected package gconf2-common.
(Reading database ... 201231 files and directories currently installed.)
Preparing to unpack .../gconf2-common_3.2.6-7ubuntu2_all.deb ...
Unpacking gconf2-common (3.2.6-7ubuntu2) ...
Selecting previously unselected package libgconf-2-4:amd64.
Preparing to unpack .../libgconf-2-4_3.2.6-7ubuntu2_amd64.deb ...
Unpacking libgconf-2-4:amd64 (3.2.6-7ubuntu2) ...
Selecting previously unselected package gconf-service-backend.
Preparing to unpack .../gconf-service-backend_3.2.6-7ubuntu2_amd64.deb ...
Unpacking gconf-service-backend (3.2.6-7ubuntu2) ...
Selecting previously unselected package gconf-service.
Preparing to unpack .../gconf-service_3.2.6-7ubuntu2_amd64.deb ...
Unpacking gconf-service (3.2.6-7ubuntu2) ...
Setting up gconf2-common (3.2.6-7ubuntu2) ...

Creating config file /etc/gconf/2/path with new version
Setting up gconf-service (3.2.6-7ubuntu2) ...
Processing triggers for sgml-base (1.30) ...
Setting up libgconf-2-4:amd64 (3.2.6-7ubuntu2) ...
Processing triggers for libc-bin (2.35-0ubuntu3.1) ...
Setting up mongodb-compass (1.36.3) ...
Setting up gconf-service-backend (3.2.6-7ubuntu2) ...

これで、MongoDB Compassがインストールされました。

MongoDB Compassを起動する!

コマンドラインから「MongoDB Compass」を起動します。

$ mongodb-compass

MongoDBに接続する!

URIにMongoDBへの接続情報を入力して、「Connect」ボタンをクリックします。

接続できれば、接続したDBの情報が表示されます。

おわりに

Ubuntu Desktop 22.04への「MongoDB Compass」のインストールは、途中でエラーが発生しますが、対処しながらインストールを続ける必要があります。

参考情報

関連記事

参考書籍(Amazon)