EDIT: It’s been a number of years, and unfortunately the top answer still points users away from the latest stable version of MongoDB. In fact the last available package for mongodb
is 3.6.3.
I don’t work at the company anymore, but I will point to:
https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-ubuntu/
That’s the best way to install the latest stable version MongoDB. It includes instructions for adding the necessary repositories and keys to allow running apt install mongodb-org
. There is a platform support matrix that will help with identifying which versions of MongoDB you can install on any given Linux OS version.
just want to chime in here. I’m the Senior Technical Writer for MongoDB Server Docs. This post is one of a few that comes up with «install MongoDB on Ubuntu 18.04», and there are several comments here referencing the mongodb
package for installation. The unofficial mongodb
package provided by Ubuntu is not maintained by MongoDB. You should always use the official MongoDB mongodb-org
packages. Furthermore, from a bit of personal testing it looks like having mongodb
installed will cause issues if you try to install mongodb-org
, so its just added trouble
The few times I’ve run into this issue when testing locally, attempting to install one of the subpackages (i.e. mongodb-org-server
) usually surfaced the actual error (i.e. missing libcurl3
, which was removed in 18.04 as a default installed library). These issues may be more common when testing development builds ( at the time of writing, that’s the 4.2 dev series).
To check which package you have installed on your local system, run the following:
sudo apt list --installed | grep mongo
This was my output after I installed mongodb
, then attempted mongodb-org
:
mongo-tools/bionic,now 3.6.3-0ubuntu1 amd64 [installed,auto-removable]
mongodb-org/bionic,now 4.0.5 amd64 [installed]
mongodb-org-shell/bionic,now 4.0.5 amd64 [installed,automatic]
mongodb-server-core/bionic,now 1:3.6.3-0ubuntu1 amd64 [installed,auto-removable]
So you can see, I’ve got a mix between the two packages (and a bunch of dkpg
errors). I ended up using a mix of apt remove
, apt autoremove
, and apt purge
to fix up the system.
The following packages have unmet dependencies:
mongodb-org-mongos : Depends: libssl1.0.0 (>= 1.0.1) but it is not installable
mongodb-org-server : Depends: libssl1.0.0 (>= 1.0.1) but it is not installable
mongodb-org-shell : Depends: libssl1.0.0 (>= 1.0.1) but it is not installable
mongodb-org-tools : Depends: libssl1.0.0 (>= 1.0.1) but it is not installable
E: Unable to correct problems, you have held broken packages.
I am getting this error even i did update the repo
: sudo apt-get update
also i did check if there any broken packeges with
: sudo apt-get check
step i took to install mongodb in linux:
1) sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5
2) echo "deb http://repo.mongodb.org/apt/debian wheezy/mongodb-org/3.6 main" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.6.list
3)sudo apt-get update
4)sudo apt-get install -y mongodb-org
but still getting the same error. how can i solve this?
asked May 16, 2018 at 16:36
8
I guess this is the problem that you are facing.
enter image description hereThe following packages have unmet dependencies: mongodb-org-mongos : Depends: libssl1.1 (>= 1.1.1) but it is not installable mongodb-org-server : Depends: libssl1.1 (>= 1.1.1) but it is not installable E: Unable to correct problems, you have held broken packages.
You can try the following steps to install mongodb in Ubuntu at any version:
sudo apt update sudo apt upgrade wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | sudo apt-key add - sudo apt-get update sudo apt-get install -y mongodb-org
Now you may get the error like above screenshot. Try the following steps :
wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1-1ubuntu2.1~18.04.20_amd64.deb sudo dpkg -i libssl1.1_1.1.1-1ubuntu2.1~18.04.20_amd64.deb
Now, mongodb is ready to be installed. Run the following installation command again:
sudo apt-get install -y mongodb-org
To check Mongodb version, run the following command :
mongod --version
enter image description here
answered Sep 15, 2022 at 10:49
azam45azam45
2961 silver badge5 bronze badges
1
In my case, I’m using Linux Mint 17 -> Ubuntu 14.04 and I was installing with Ubuntu 16.04 resulting in this conflict.
Check your Ubuntu/Debian version — the wiki is a useful resource — before trying these commands.
If that doesn’t solve it then run
sudo apt purge mongod*
sudo apt purge mongodb*
sudo apt purge mongodb-org*
That should remove any inconsistency and then go to https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/ and follow the procedure.
This resolved the issue.
Troubadour
13.3k2 gold badges38 silver badges57 bronze badges
answered Aug 6, 2018 at 3:23
KNDheerajKNDheeraj
8348 silver badges22 bronze badges
1
I’m also getting the following error while installing MongoDB
mongodb-org-mongos : Depends: libssl1.1 (>= 1.1.0) but it is not
installable
mongodb-org-server : Depends: libssl1.1 (>= 1.1.0) but it is not
installable
mongodb-org-shell : Depends: libssl1.1 (>= 1.1.0) but it is not installable
E: Unable to correct problems, you have held broken packages.
Here is the solution for this kind of issue
Use the following command
echo "deb http://security.ubuntu.com/ubuntu impish-security main" | sudo
tee /etc/apt/sources.list.d/impish-security.list
sudo apt-get update
sudo apt-get install libssl1.1
answered Jun 21, 2022 at 7:54
0
100% working solution!!!
The below solution worked for me to install mongodb:
- Download libssl1.1_1.1.1f-1ubuntu2_amd64.deb:
wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_amd64.deb
- Install it using the dpkg command:
sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2_amd64.deb
answered Oct 13, 2022 at 16:58
Finally! Below Solutions worked for me
It is because of the missing dependencies mongodb not installing on ubuntu 22.04.
The main reason is the missing of libssl1.1 dependency. So we need to install it seperately.
sudo apt install dirmngr gnupg apt-transport-https ca-certificates software-properties-common
2.echo "deb http://security.ubuntu.com/ubuntu impish-security main" | sudo tee /etc/apt/sources.list.d/impish-security.list
3.Go to root user sudo -i
then paste this
wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_amd64.deb
4.apt update
5.apt install libssl1.1
6.wget -qO - https://www.mongodb.org/static/pgp/server-5.0.asc | sudo apt-key add -
7.echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-5.0.list
8.apt update
9.apt install -y mongodb-org
The latest version of mongodb will be installed
To start it
1.systemctl enable mongod
2.systemctl start mongod
In case MongoDB doesn’t start run the command below to reload.
systemctl daemon-reload
code copied from https://www.mongodb.com/community/forums/t/installing-mongodb-over-ubuntu-22-04/159931/38
answered Nov 1, 2022 at 12:35
Распространенные проблемы при установке mongoDB новичкам
- Установить MongoDB
- Импортировать данные
Установить MongoDB
Сначала вОфициальный сайтЗагрузите установочный пакет MSI и начните установку.
далее до конца(Поменял путь установки на диск D по ходу)
Не проверятьInstall MongoDB CompassИначе установка займет много времени
Перейти к следующему шагу
Какого черта, недостаточно разрешений? ? ? Выйдите из установки, щелкните правой кнопкой мыши инсталляционный пакет, чтобы посмотреть на него, нетЗапустить от имени администратора, Ну, выберите «Игнорировать напрямую», и следующая установка будет завершена.
Поскольку на предыдущем шаге был выбран вариант «Игнорировать», база данных еще недоступна, и ее необходимо настроить снова. Я нашел много руководств в Интернете и сказал использовать
mongod --dbpath "C:MongoDBdatadb" --logpath "C:MongoDBdatalogmongo.log" --install --serviceName "MongoDB"
Ух ~ Я немного потерял дар речи, на самом деле, если вы используете установочный пакет msi для установки базы данных mongoDB, вам не нужно писать, как указано выше. Благодаря выборуIgnoreПоэтому нам нужно вручную указать путь к базе данных
mongod --dbpath "D:mongoDBdata"
готово, процесс довольно прост, не так ли? НЕТ! Вы недооцениваете отвратительную часть этой базы данных. Я перезагрузил компьютер и использовал mongo для запуска базы данных.
. . . Тихая ошибка, сообщение об ошибке выглядит следующим образом:
Mongodbshell version: 3.4.6
connecting to: test
Mon Mar 3 23:45:09.491 Error: couldn't connect to server 127.0.0.1:27017 at src/mongo/shell/mongo.js:145
exception: connect failed
Есть много онлайн-руководств по этому поводу, и некоторые говорят, что удаление файла mongo.lock в data db file и перезапуск сервера — это нормально, это правда?NO, Искал, а такого файла нет, так что жульничать, приуныл. «… Есть еще много людей, которые вводят разные причудливые команды и показывают скальпы людей.
Я попытался использовать команду net start MongoDB для запуска службы, но это не удалось:
Найдите MongoDB в службе диспетчера задач, обнаружьте, что статус остановлен, щелкните правой кнопкой мыши, чтобы запустить, запроситеСервис своевременно не ответил на запрос запуска или управления
Отчаянный ~
- Зайдите в Baidu, попробуйте метод большого парня:
Настройте переменную среды mongodb, а затем добавьте ее в путь
Откройте cmd от имени администратора, а затем удалите службу mongodb, созданную по умолчанию во время установки. Обратите внимание, что имя службы здесь должно быть заменено на ваш локальный компьютер.
sc delete MongoDB
Затем используйте следующую команду для воссоздания службы
E:MongoDbbinmongod.exe --dbpath "E:MongoDbdata" --logpath "E:MongoDblogdb.log" --install --serviceName "mongo" --logappend --directoryperdb
. . . . . . . . . . . . . . . . . . . Тихо и бесполезно, я не знаю, правильно ли сделал это человек, написавший эту статью, в любом случае это бесполезно.
На самом деле решить эту проблему очень просто, достаточновbin
Найдите в папке файл mongod.cfg и откройте его:
# mongod.conf
# for documentation of all options, see:
# http://docs.mongodb.org/manual/reference/configuration-options/
# Where and how to store data.
storage:
dbPath: E:MongoDBdata
journal:
enabled: true
# engine:
# mmapv1:
# wiredTiger:
# where to write logging data.
systemLog:
destination: file
logAppend: true
path: E:MongoDBlogmongod.log
# network interfaces
net:
port: 27017
bindIp: 127.0.0.1
#processManagement:
#security:
#operationProfiling:
#replication:
#sharding:
## Enterprise-Only Options:
#auditLog:
#snmp:
mp:
Удалена последняя сводящая с ума строчкаmp:
Перезапустите сервис, успехов!
Импортировать данные
Команды для импорта данных можно использовать только после выхода из оболочки mongo.Онлайн-руководства действительно сбивают с толку и неясны.
Ссылка на сообщение в блоге Великого Бога
Если есть какое-либо нарушение, свяжитесь со мной, чтобы удалить его, спасибо
Ubuntu 18.04 and MongoDB 4.2
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
Now, add the new key:
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 4B7C549A058F8B6B
Add the new repository:
echo "deb [arch=amd64] http://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.2.list
Install MongoDB
sudo apt update
sudo apt install mongodb-org
Enable and start the mongod
server service:
systemctl enable mongod.service
systemctl start mongod.service
Check your installation:
~$ mongo --version
MongoDB shell version v4.2.2
git version: a0bbbff6ada159e19298d37946ac8dc4b497eadf
OpenSSL version: OpenSSL 1.1.1 11 Sep 2018
allocator: tcmalloc
modules: none
build environment:
distmod: ubuntu1804
distarch: x86_64
target_arch: x86_64
You can also check your service has started:
~$ systemctl status mongod.service
● mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: e
Active: active (running) since Mon 2019-12-30 08:05:48 MST; 1min 7s ago
Docs: https://docs.mongodb.org/manual
Main PID: 7941 (mongod)
CGroup: /system.slice/mongod.service
└─7941 /usr/bin/mongod --config /etc/mongod.conf
Ubuntu 20.04 and MongoDB 4.4 or MongoDB 5.0
First, remove MongoDB from previous if installed:
systemctl stop mongod.service
systemctl disable mongod.service
sudo apt remove --autoremove mongodb-org
Remove any mongodb repo list files:
sudo rm /etc/apt/sources.list.d/mongodb*.list
sudo apt update
Now, add the new key for MongoDB 4.4:
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 656408E390CFB1F5
The new key for MongoDB 5.0:
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv B00A0BD1E2C63C11
Add the new repository for MongoDB 4.4:
echo "deb [arch=amd64] http://repo.mongodb.org/apt/ubuntu $(lsb_release -sc)/mongodb-org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org.list
Or the new repository for MongoDB 5.0:
echo "deb [arch=amd64] http://repo.mongodb.org/apt/ubuntu $(lsb_release -sc)/mongodb-org/5.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org.list
Install MongoDB
sudo apt update
sudo apt install mongodb-org
Enable and start the mongod
server service:
systemctl enable mongod.service
systemctl start mongod.service
Check your installation:
~$ mongo --version
MongoDB shell version v4.4.3
Build Info: {
"version": "4.4.3",
"gitVersion": "913d6b62acfbb344dde1b116f4161360acd8fd13",
"openSSLVersion": "OpenSSL 1.1.1f 31 Mar 2020",
"modules": [],
"allocator": "tcmalloc",
"environment": {
"distmod": "ubuntu2004",
"distarch": "x86_64",
"target_arch": "x86_64"
}
}
Or
$ mongo --version
MongoDB shell version v5.0.2
Build Info: {
"version": "5.0.2",
"gitVersion": "6d9ec525e78465dcecadcff99cce953d380fedc8",
"openSSLVersion": "OpenSSL 1.1.1f 31 Mar 2020",
"modules": [],
"allocator": "tcmalloc",
"environment": {
"distmod": "ubuntu2004",
"distarch": "x86_64",
"target_arch": "x86_64"
}
}
You can also check your service has started:
~$ systemctl status mongod.service
● mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset>
Active: active (running) since Sun 2021-01-24 07:52:50 MST; 27s ago
Docs: https://docs.mongodb.org/manual
Main PID: 2353629 (mongod)
Memory: 59.2M
CGroup: /system.slice/mongod.service
└─2353629 /usr/bin/mongod --config /etc/mongod.conf
Jan 24 07:52:50 terrance-ubuntu systemd[1]: Started MongoDB Database Server.
Ubuntu 22.04 and MongoDB 6.0
The MongoDB repos are not 100% ready for 22.04 yet, so you will have to use the Focal repository from them to install it. Also, the repo doesn’t have the key ready for GPG since apt-key is now deprecated, but these instructions still work for now.
First, remove MongoDB from previous if installed:
systemctl stop mongod.service
systemctl disable mongod.service
sudo apt remove --autoremove mongodb-org
Remove any mongodb repo list files:
sudo rm /etc/apt/sources.list.d/mongodb*.list
sudo apt update
You might need to install gpg before doing the next step.
sudo apt install gpg
Now, add the new key for MongoDB 6.0:
curl -fsSL https://pgp.mongodb.com/server-6.0.asc | sudo gpg --dearmor -o /usr/share/keyrings/mongodb60.gpg
Add the new repository for MongoDB 6.0 (You have to use the Focal repo as the Jammy repo does not contain the mongodb-org
install for the mongod server):
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/mongodb60.gpg] http://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org.list
Install MongoDB
sudo apt update
sudo apt install mongodb-org
Enable and start the mongod
server service:
systemctl enable mongod.service
systemctl start mongod.service
Check your installation:
mongod --version
db version v6.0.2
Build Info: {
"version": "6.0.2",
"gitVersion": "94fb7dfc8b974f1f5343e7ea394d0d9deedba50e",
"openSSLVersion": "OpenSSL 1.1.1f 31 Mar 2020",
"modules": [],
"allocator": "tcmalloc",
"environment": {
"distmod": "ubuntu2004",
"distarch": "x86_64",
"target_arch": "x86_64"
}
}
systemctl status mongod.service
● mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset>
Active: active (running) since Thu 2022-10-13 08:13:21 MDT; 39s ago
Docs: https://docs.mongodb.org/manual
Main PID: 44048 (mongod)
Memory: 68.1M
CPU: 1.169s
CGroup: /system.slice/mongod.service
└─44048 /usr/bin/mongod --config /etc/mongod.conf
Oct 13 08:13:21 terrance-ubuntu systemd[1]: Started MongoDB Database Server.
Hope this helps!
я делаю всё по инструкции, а именно
1.sudo apt-key adv —keyserver hkp://keyserver.ubuntu.com:80 —recv EA312927
2.echo «deb repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 multiverse» | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list
3.sudo apt-get update
и уже тут появляется ошибка в
Ошибка GPG: repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 Release: Следующие подписи не могут быть проверены, так как недоступен открытый ключ: NO_PUBKEY D68FA50FEA312927
5. если ввести sudo apt install -y mongodb-org
он пишет «Невозможно найти пакет mongodb-org»
Как это пофиксить?
Перезапуск пробовал
-
Вопрос заданболее трёх лет назад
-
792 просмотра
Комментировать
Решения вопроса 2
попробуйте выполнить
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv D68FA50FEA312927
а потомsudo apt-get update
@lil_koi Автор вопроса
лучший из худших
появилась новая проблема, это я прописал
sudo apt-get install -y mongodb-org
а потом проверил status
Пригласить эксперта
Похожие вопросы
-
Показать ещё
Загружается…
22 июн. 2023, в 00:59
8000 руб./за проект
22 июн. 2023, в 00:56
8000 руб./за проект
22 июн. 2023, в 00:39
12000 руб./за проект