How to install mongoDB on Manjaro 21 Ornara
- Enable AUR
- Make sure system is up to date
sudo pacman -Syu
- To install, use the following command:
pamac build mongodb-bin
pamac build mongodb-tools-bin
pamac build mongodb-compass
- Enable service and start on boot:
sudo systemctl start mongodb
sudo systemctl enable mongodb
- Run command
mongo
as console MongoDB
If you find the error like this:
MongoDB shell version v4.4.6
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed: SocketException: Error connecting to 127.0.0.1:27017 :: caused by :: Connection refused :
connect@src/mongo/shell/mongo.js:374:17
@(connect):2:6
exception: connect failed
exiting with code 1
- Please change the port using command
sudo nano /etc/mongodb.conf
- Change line 23
port: 27017
- To port 27018
- Re-run command with
mongo 127.0.0.1:27018
Note: Don't forget use port 27018 when login using Compass
I used your fix and it worked, but what is different between port 27017 and port 27018 so that it runs on one but not the other?