Linux MintにMongoDBをインストールできない

Linux MintにMongoDBをインストールできない

Linux Mint に MongoDB をインストールできません。

オペレーティングシステム:Linux Mint 19.1

カーネル: Linux 4.15.0-50-一般

アーキテクチャ:x86-64

フォローする公式文書。

パッケージ管理システムで使用される公開鍵のインポート

$ wget -qO - https://www.mongodb.org/static/pgp/server-4.0.asc | sudo apt-key add -

MongoDB Ubuntu 18.04(Bionic)用のリストファイルの作成

$ echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0 multiverse" |
                    sudo tee /etc/apt/sources.list.d/mongodb-org-4.0.list

ローカルパッケージの再ロード

$ sudo apt-get update

MongoDBパッケージのインストール

$ sudo apt-get install -y mongodb-org

インストール中に次のエラーが発生します。

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  icoutils libboost-program-options1.65.1 libgoogle-perftools4 libpcrecpp0v5
  libtcmalloc-minimal4 libwine-development libwxgtk3.0-gtk3-0v5
  libyaml-cpp0.5v5 mongodb-server-core python-wxgtk3.0 python-wxversion
  wine64-development
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  mongodb-org-mongos mongodb-org-server mongodb-org-shell mongodb-org-tools
The following NEW packages will be installed:
  mongodb-org mongodb-org-mongos mongodb-org-server mongodb-org-shell
  mongodb-org-tools
0 upgraded, 5 newly installed, 0 to remove and 245 not upgraded.
Need to get 48.3 MB/73.0 MB of archives.
After this operation, 267 MB of additional disk space will be used.
Get:1 https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0/multiverse amd64 mongodb-org-shell amd64 4.0.12 [9,865 kB]
Get:2 https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0/multiverse amd64 mongodb-org-tools amd64 4.0.12 [38.5 MB]
Get:3 https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0/multiverse amd64 mongodb-org amd64 4.0.12 [3,528 B]
Fetched 48.3 MB in 31s (1,553 kB/s)                                            
Selecting previously unselected package mongodb-org-shell.
(Reading database ... 349983 files and directories currently installed.)
Preparing to unpack .../mongodb-org-shell_4.0.12_amd64.deb ...
Unpacking mongodb-org-shell (4.0.12) ...
Preparing to unpack .../mongodb-org-server_4.0.12_amd64.deb ...
Unpacking mongodb-org-server (4.0.12) ...
dpkg: error processing archive /var/cache/apt/archives/mongodb-org-server_4.0.12_amd64.deb (--unpack):
 trying to overwrite '/usr/bin/mongod', which is also in package mongodb-server-core 1:3.6.3-0ubuntu1.1
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Preparing to unpack .../mongodb-org-mongos_4.0.12_amd64.deb ...
Unpacking mongodb-org-mongos (4.0.12) ...
dpkg: error processing archive /var/cache/apt/archives/mongodb-org-mongos_4.0.12_amd64.deb (--unpack):
 trying to overwrite '/usr/bin/mongos', which is also in package mongodb-server-core 1:3.6.3-0ubuntu1.1
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Selecting previously unselected package mongodb-org-tools.
Preparing to unpack .../mongodb-org-tools_4.0.12_amd64.deb ...
Unpacking mongodb-org-tools (4.0.12) ...
Selecting previously unselected package mongodb-org.
Preparing to unpack .../mongodb-org_4.0.12_amd64.deb ...
Unpacking mongodb-org (4.0.12) ...
Errors were encountered while processing:
 /var/cache/apt/archives/mongodb-org-server_4.0.12_amd64.deb
 /var/cache/apt/archives/mongodb-org-mongos_4.0.12_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

データベースを始めよう

$ sudo service mongod start

Failed to start mongod.service: Unit mongod.service not found.

次のコマンドは同じエラーを発生させます。

sudo apt-get install -f

mongodb-server-coreを削除できません。

$ apt remove mongodb-server-core

Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 mongodb-org : Depends: mongodb-org-server but it is not going to be installed
               Depends: mongodb-org-mongos but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

ベストアンサー1

mongodb-server-coreと競合しようとしています。

sudo apt-get purge mongod*
sudo apt-get update

再インストールして

おすすめ記事