How to install mongodb 3.6 on ubuntu 22.04 [migrated] - mongodb

This question was migrated from Stack Overflow because it can be answered on Database Administrators Stack Exchange.
Migrated 15 days ago.
Installing mongodb 3.6 on ubuntu 22 keeps throwing this error!!
The following packages have unmet dependencies:
mongodb-org-mongos : Depends: libssl1.0.0 (>= 1.0.2~beta3) but it is not installable
mongodb-org-server : Depends: libssl1.0.0 (>= 1.0.2~beta3) but it is not installable
mongodb-org-shell : Depends: libssl1.0.0 (>= 1.0.2~beta3) but it is not installable
mongodb-org-tools : Depends: libssl1.0.0 (>= 1.0.2~beta3) but it is not installable
E: Unable to correct problems, you have held broken packages
I am new to ubuntu system but tried everything available in the internet.
also Downgraded the libsssl1
sudo wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_amd64.deb

MongoDB 3.6 is relatively old (EOL/EOS April 2021) and not recommended for production use unless the case requires it (the latest is 6.1 as of reading this text)
If you need it only for some testing to not pollute your Ubuntu 22 installation I would recommend to install it manually in some folder separate for your testing only, described in following steps:
Download the 3.6 package from the archive(example 3.6.22):
https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1804-3.6.22.tgz
Uncompress the binary files in some folder ( example /database/bin ) .
If needed download the expected ssl libraries and extract the libcrypto package to expected location:
http://security.ubuntu.com/ubuntu/pool/main/o/openssl1.0/
sudo cp libcrypto.so.1.0.0 /usr/lib/
Prepare some nice config file and store in /database/bin/mydb.conf :
storage:
dbPath: /database/db1
directoryPerDB: true
journal:
enabled: true
wiredTiger:
engineConfig:
cacheSizeGB: 1
directoryForIndexes: true
systemLog:
destination: file
logAppend: true
path: /database/log/db1.log
net:
port: 20000
bindIp: 127.0.0.1
processManagement:
fork: true
Create the necessary directories and start the mongod binary:
mkdir -p /database/db1
mkdir -p /database/log
/database/bin/mongod --config mydb.conf
You can access the database as follow:
/database/bin/mongo --port 20000

To install the latest stable version, issue the following
sudo apt-get install -y mongodb-org
To get rid of "E: Unable to correct problems, you have held broken packages
"
open the terminal with "Ctrl + Alt + T" and type:
sudo apt install --fix-missing
Hope that helps...

Related

Unable to install mongodb in ubuntu 22.04 (mongodb-org, libssl1.1)

On following installation instructions from MongoDB official site.
While installing mongodb-org package getting the following error
sudo apt install -y mongodb-org
Reading package lists... Done
Building dependency tree... Done
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-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
mongodb-org-shell : Depends: libssl1.1 (>= 1.1.1) but it is not installable
E: Unable to correct problems, you have held broken packages.
I tried installing libssl1.1 package using apt but I was unable to do so it throws following error.
E: Package 'libssl1.1' has no installation candidate
please someone help.
It seems mongodb require specific version of libssl1.1
you can download debian file of that version and install using following commands. Most probably it will resolve this issue.
sudo wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_amd64.deb
sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2_amd64.deb
After hours of looking for a solution I was satisfied with, I finally stumbled across one! Hope this helps anyone else looking to install MongoDB community edition without sacrificing security by using libssl1.1 (the solution here uses >3.0.
MongoDB has the repository for Ubuntu 22.04.1 LTS (Jammy Jellyfish) hidden away. It definitely still isn't on the documentation installation pages as of the time I am posting this. Check it out yourself: https://repo.mongodb.org/apt/ubuntu/dists/jammy/mongodb-org/
The following code will add the repository and install the latest mongodb-org on your system:
sudo apt-get install wget gpg
wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | gpg --dearmor > packages.mongodb.gpg
sudo install -D -o root -g root -m 644 packages.mongodb.gpg /etc/apt/keyrings/packages.mongodb.gpg
echo "deb [ arch=amd64,arm64 signed-by=/etc/apt/keyrings/packages.mongodb.gpg] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list
rm -f packages.mongodb.gpg
sudo apt-get install -y mongodb-org

install mongodb 5.0.2 on fedora 34

I am trying to install mongo on fedora 34.
I have the yum config:
/etc/yum.repo.d/mongodb-org-5.0.repo
with the text
[mongodb-org]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/8/mongodb-org/5.0/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-5.0.asc
To install mongo I run
sudo yum install -y mongodb-org
It fails with the following:
Error:
Problem: conflicting requests
- package mongodb-org-5.0.0-1.el8.x86_64 requires mongodb-org-tools, but none of the providers can be installed
- package mongodb-org-5.0.2-1.el8.x86_64 requires mongodb-org-tools, but none of the providers can be installed
- package mongodb-org-tools-5.0.0-1.el8.x86_64 requires mongodb-org-database-tools-extra, but none of the providers can be installed
- package mongodb-org-tools-5.0.2-1.el8.x86_64 requires mongodb-org-database-tools-extra, but none of the providers can be installed
- nothing provides /usr/libexec/platform-python needed by mongodb-org-database-tools-extra-5.0.0-1.el8.x86_64
- nothing provides /usr/libexec/platform-python needed by mongodb-org-database-tools-extra-5.0.2-1.el8.x86_64
Please help me with the installation steps.
I am not able to install even after following the official mongo installation guide
try to install the server, shell and tools separately
sudo dnf install mongodb-org-server mongodb-org-shell mongodb-database-tools mongodb-org-mongos mongodb-mongosh
Related issue

The following packages have unmet dependencies: mongodb-org :

I am trying to install Mongodb using the command sudo apt-get install -y mongodb-org on ubuntu 16.04 after it produces the following error:
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-shell but it is not going to be installed
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: Unable to correct problems, you have held broken packages.
Looking at the MongoDB Documentation at https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/ it says to use their package not the Ubuntu APT package.
Here are the steps to use the MongoDB Package in a nutshell...
Add the APT Key:
wget -qO - https://www.mongodb.org/static/pgp/server-4.2.asc | sudo apt-key add -
Add the APT Sources List:
echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.2.list
Update APT:
sudo apt-get update
Install the MongoDB Community Edition Package:
sudo apt-get install -y mongodb-org
Start the service:
sudo service mongod start
Log into the database using mongoshell:
mongo
If someone else struggle with this issue and all the other answers didn't work...
This is what work for me:
apt-get install mongodb-org-shell
apt-get install mongodb-org-server
apt-get install mongodb-org-mongos
And then again
sudo apt-get install -y mongodb-org
Detials (run uname -a):
Linux resta-dev 4.15.0-66-generic #75-Ubuntu SMP Tue Oct 1 05:24:09 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
I got this issue when the wrong Ubuntu version was selected. Make sure you double check that you run the correct one.
Your system already had the Ubuntu MongoDB package installed prior to installing the official mongodb-org packages. To confirm whether the host has the Ubuntu mongodb package installed, run;
sudo apt list --installed | grep mongo
If present you will need to remove all the installed mongodb-org packages by running;
sudo apt remove mongo*
Once all the MongoDB packages are removed you can now use the Official installation Guide to complete your installation
Use this command to display the installed applications and their dependencies causing troubles:
sudo dpkg --configure -a
and use the following command and replace package-name with the name of the package that need to be removed
sudo dpkg --remove package-name
You are now good to go.

How to install postgis for postgresql 9.6

I want to install Postgres 9.X and Postgis for it.
I manage to install Postgres with version 9.6 with this command:
sudo apt-get install postgresql-9.6
But then when I type:
sudo apt get install postgis
I suddenly get postgres 10 and postgis for that version.
When I try something like on this link http://technobytz.com/install-postgis-postgresql-9-3-ubuntu.html my installation failed, I get this code in terminal:
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:
postgresql-9.3-postgis-2.1 : Depends: libgdal1 (>= 1.9.0) but it is not going to be installed
Depends: libgeos-c1 (>= 3.3.3) but it is not going to be installed
Depends: liblwgeom-2.1.8 (>= 2.1.6) but it is not going to be installed
Depends: libproj0 but it is not installable
Recommends: postgresql-contrib-9.3 but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
I am using Ubuntu 18.04
On ubuntu, you can use following commands:
sudo apt-get install postgresql-<xx>-postgis-<yy> postgresql-<xx>-postgis-<yy>-scripts
e.g
sudo apt-get install postgresql-9.6-postgis-2.4 postgresql-9.6-postgis-2.4-scripts
Just choose the proper version you need.

Postgis installation on Ubuntu 15.10 server gives dependencies error

I am trying to install postgis on Ubuntu server 15.10 using the following command:
sudo apt-get install postgresql-9.5-postgis-2.2
but I am getting following error:
The following packages have unmet dependencies:
postgresql-9.5-postgis-2.2 : Depends: libgdal1h (>= 1.9.0) but it is not installable
Just solved it. The problem was with my sources.list file. It was missing the right postgresql repository. I edited the sources file:
sudo gedit /etc/apt/sources.list
There I had to change the line:
deb http://apt.postgresql.org/pub/repos/apt trusty-pgdg main
to:
deb http://apt.postgresql.org/pub/repos/apt wily-pgdg main