How Can I Install Mongodb 3.6.8 version on debian?

Hello All,

I tried to install 3.6.8 version on our new server to keep up with old server mongo version so that I can dump data and restore.Where I tried this at 4th step However its saying Unable to find packages for all these .Can someone help me. If not let me know how I can dump and restore from older version to newer version.

sudo apt-get install -y mongodb-org=3.6.8 mongodb-org-server=3.6.8 mongodb-org-shell=3.6.8 mongodb-org-mongos=3.6.8 mongodb-org-tools=3.6.8

Hi @priyatham_ik,

MongoDB 3.6 reached End Of Life (EOL) in April 2021 so it is likely you are using a newer version of Debian than may be supported: MongoDB 3.6 Supported Platforms.

Some possible approaches in order of recommendation:


Hello @Stennie_X ,

I have installed the 4.4 version on new server and did this mentioned below to dump and restore from old db to new db

ssh -fN -L 27018:localhost:27017 <remote_host> 

  mongodump --port 27018 --db <remote_db_name> --username <remote_db_username> --password <remote_db_password> --archive | mongorestore --username <destination_db_username> --password <destination_db_password> --archive

After running these commands on my new server  I see my db when I do show dbs on mongo shell however when I change the port to 27018 in mongodb config file in order to run this restored db its throwing error and exiting with 42 saying address already in use  and Its happening because of the ssh tunnel and when I kill the port and re run it now I dont see the restored DB .

Can anyone help me ?

Why you want to start mongod again?
Just connect to your restored db using the correct port 27017
Show us how you are connecting with screenshots

Hello @Ramachandra_Tummala ,

On my new server I have restored to the port 27018 as per my previous commands when I type mongo and run show dbs I can see the restored db however when I check sudo service mongod status its showing inactive

Here is what it shows when I do show dbs by entering the mongo shell using mongo --port 27018

show dbs
MyDB 0.018GB
admin 0.000GB
config 0.000GB
local 0.000GB
playlist 0.000GB
test_playlist 0.000GB

Here is what I get when I do sudo service mongod status and I have updated port to 27018 in config file

Are you sure you restored to your mongod on port 28000
Your mongodump is from port 28000 which you piped to restore on localhost on default port 27017
What do you see if you issue just mongo

Yes I’m certainly sure that I restored to port 27018 and I followed the second answer from this post How do I copy a database from one MongoDB server to another? - Stack Overflow.

If I understood it correctly I have ran the ssh tunnel on new server which makes all the request forwarded through port 27018 to old server (the db from which Im going to dump) with default port.

when I do mongo on new server this is what I get -

MongoDB shell version v4.4.17
connecting to: mongodb://
Error: couldn’t connect to server, connection attempt failed: SocketException: Error connecting to :: caused by :: Connection refused :
exception: connect failed
exiting with code 1

However when I do mongo --port 27018 on the same new server this is what I get-
mongo --port 27018
MongoDB shell version v4.4.17
connecting to: mongodb://

@Ramachandra_Tummala @Stennie_X

Thanks for your help and Info guys ,Finally I was able to dump and restore this way-

From new server I dumped remotely using : mongodump --host = --port=27017 and
then restored in newserver: mongorestore --port=27018

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.