Linux Mint에 MongoDB를 설치할 수 없습니다

Linux Mint에 MongoDB를 설치할 수 없습니다

Linux Mint에 MongoDB를 설치할 수 없습니다.

운영 체제: 리눅스 민트 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

다시 설치하고

답변2

같은 문제가 있습니다. 온라인에서 찾은 것은 아무것도 작동하지 않았습니다. 그러나 마침내 실행 가능한 해결책을 추측했습니다.

바꾸다

sudo apt-get purge mongod*

내가 해냈어

sudo apt-get purge mongo*

그러면 문제가 해결됩니다.

답변3

Ubuntu 시스템에서도 동일한 문제가 발생했습니다.

sudo apt-get purge mongod*
sudo apt autoremove
sudo apt-get update && sudo apt-get upgrade

위의 명령이 도움이 됩니다.

관련 정보