Saturday, May 11, 2024
 Popular · Latest · Hot · Upcoming
3
rated 0 times [  3] [ 0]  / answers: 1 / hits: 749  / 2 Years ago, fri, december 3, 2021, 10:16:57

Reading this article
https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-ubuntu/


I try to install mongodb on my remote ubuntu 18 I got error :


root@nsn-do-lamp:~# wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | sudo apt-key add -
OK
root@nsn-do-lamp:~#
root@nsn-do-lamp:~# wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | sudo apt-key add -
OK
root@nsn-do-lamp:~# echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list
deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 multiverse
root@nsn-do-lamp:~# sudo apt-get install -y mongodb-org
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package mongodb-org
root@nsn-do-lamp:~# sudo apt-get update
Hit:1 http://security.ubuntu.com/ubuntu bionic-security InRelease
Hit:2 http://ppa.launchpad.net/certbot/certbot/ubuntu bionic InRelease
Hit:3 http://ppa.launchpad.net/ondrej/php/ubuntu bionic InRelease
Hit:4 http://mirrors.digitalocean.com/ubuntu bionic InRelease
Hit:5 https://deb.nodesource.com/node_14.x bionic InRelease
Hit:6 https://download.docker.com/linux/ubuntu bionic InRelease
Hit:7 http://mirrors.digitalocean.com/ubuntu bionic-updates InRelease
Hit:8 http://mirrors.digitalocean.com/ubuntu bionic-backports InRelease
Ign:9 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 InRelease
Get:10 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 Release [4412 B]
Get:11 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 Release.gpg [801 B]
Get:12 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0/multiverse amd64 Packages [6644 B]
Get:13 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0/multiverse arm64 Packages [5562 B]
Fetched 17.4 kB in 2s (9957 B/s)
Reading package lists... Done
root@nsn-do-lamp:~# sudo apt-get install -y mongodb-org
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
mongodb-org : Depends: mongodb-org-database but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

...
root@nsn-do-lamp:~# uname -a
Linux nsn-do-lamp 4.15.0-191-generic #202-Ubuntu SMP Thu Aug 4 01:49:29 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
root@nsn-do-lamp:~# lsb_release -d; uname -r; uname -i
Description: Ubuntu 18.04.5 LTS
4.15.0-191-generic
x86_64

Why I got the error and how can it be fixed ?


UPDATED :


I tried to fix this problem with proposed methods and got error :


sudo apt-get install -y  mongodb-org-mongos  mongodb-org-server   mongodb-org   mongodb-org-database
...
The following packages have unmet dependencies:

mongodb-org-mongos : Depends: libc6 (>= 2.29) but 2.27-3ubuntu1.6 is to be installed
Depends: libgcc-s1 (>= 4.2) but it is not installable
mongodb-org-server : Depends: libc6 (>= 2.29) but 2.27-3ubuntu1.6 is to be installed
Depends: libgcc-s1 (>= 4.2) but it is not installable
E: Unable to correct problems, you have held broken packages.

Looks like I have old ubuntu 18 and that eaised this error


I suppose that it could be salved with option “Install a specific release of MongoDB.”


But I am not sure which version(how can I find it) of MongoDB have I to install ?


Thanks!


More From » apt

 Answers
2

Installing MongoDB 6.0 into Ubuntu 18.04 LTS:


First, remove MongoDB from previous if installed:


sudo apt remove --autoremove mongodb-org

Remove any mongodb repo list files:


sudo rm /etc/apt/sources.list.d/mongodb*.list
sudo apt update

Add the new key:


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

Add the new repo:


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

Update the system for the new repo:


sudo apt update

Install MongoDB 6.0:


sudo apt install mongodb-org

Enable and start the mongod server service:


systemctl enable mongod.service
systemctl start mongod.service

Check that the service has started:


terrance@ubuntu-virtualbox:~$ systemctl status mongod.service 
● mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: enabled)
Active: active (running) since Sun 2022-08-21 09:08:43 MDT; 9min ago
Docs: https://docs.mongodb.org/manual
Main PID: 1015 (mongod)
CGroup: /system.slice/mongod.service
└─1015 /usr/bin/mongod --config /etc/mongod.conf

Aug 21 09:08:43 ubuntu-virtualbox systemd[1]: Started MongoDB Database Server.
Aug 21 09:09:28 ubuntu-virtualbox systemd[1]: mongod.service: Current command vanished from the unit file, execution of the command list won't be resumed.

Check MongoDB server version:


terrance@ubuntu-virtualbox:~$ mongos --version
mongos version v6.0.1
Build Info: {
"version": "6.0.1",
"gitVersion": "32f0f9c88dc44a2c8073a5bd47cf779d4bfdee6b",
"openSSLVersion": "OpenSSL 1.1.1 11 Sep 2018",
"modules": [],
"allocator": "tcmalloc",
"environment": {
"distmod": "ubuntu1804",
"distarch": "x86_64",
"target_arch": "x86_64"
}
}

[#291] Sunday, December 5, 2021, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ravturtl

Total Points: 335
Total Questions: 132
Total Answers: 110

Location: Tanzania
Member since Wed, Feb 24, 2021
3 Years ago
ravturtl questions
Wed, Feb 22, 23, 19:16, 1 Year ago
Wed, Nov 3, 21, 07:30, 3 Years ago
Wed, May 19, 21, 17:31, 3 Years ago
Tue, Jan 17, 23, 23:56, 1 Year ago
;