简体   繁体   中英

How to install Mongodb version 3.4.17 in Ubuntu 20.04.4

I have tried a lot but there is no way in which I can install mongoDB 3.4.* versions on my Ubuntu 20.04.4 LTS.

Plz help me in that.

I have tried this:

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6

echo "deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.4.list

sudo apt update

sudo apt install mongodb-org

But it was giving an error after the last line's execution:

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-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 Depends: mongodb-org-tools but it is not going to be installed E: Unable to correct problems, you have held broken packages.

Easy steps:

  1. Download the latest(3.4.23) binary archive packaged for ubuntu 16.04 ( There was no ubuntu 20.04 at the time when mongodb 3.4.23 was packaged )

  2. Copy in example folder:

     cp *23.tgz /installDir/
  3. Untar the package in the target folder:

     tar zxvf mongodb-linux-x86_64-ubuntu1604-3.4.23.tgz
  4. Prepare mongodb.conf file with expected parameters, there is many examples , but here is something minimal:

     processManagement: fork: true net: bindIp: localhost port: 27017 storage: dbPath: /installDir/data/ systemLog: destination: file path: "/installDir/log/mongod.log" logAppend: true storage: journal: enabled: true

You need to create the /installDir/data & /installDir/log folders , mongodb will not start if those folders are not found.

  1. Start the binary or as a service depending on your needs.

     /installDir/xxx/bin/mongod --config mongodb.conf
  2. When you dont needed it ( it is pretty old version already , at the time of my answer there is 5.0.8 current and 6.0 release canidate ) you can remove the /installDir/ folder with:

     rm -rf /installDir/*

mongod 3.4 will need the ubuntu 16 OS openssl ssl&crypto 1.0.0 libraries, you may download and copy them from official debian archive extract and create symblic link so the mongod 3.4 to find them:

     wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl1.0/libssl1.0.0_1.0.2n-1ubuntu5_amd64.deb
     dpkg -x libssl1.0.0_1.0.2n-1ubuntu5_amd64.deb /installDir/
     sudo ln -s /installDir/libssl.so.1.0.0 /usr/lib/libssl.so.1.0.0
     sudo ln -s /installDir/libcrypto.so.1.0.0 /usr/lib/libcrypto.so.1.0.0

PS I just now have seen you need the concrete mongodb version 3.4.17 , process is same just replace 23 with 17

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM