Install MongoDB on Manjaro
Asked Answered
M

3

28

I'm facing difficulties installing the MongoDB community server on Manjaro Linux.

There isn't official documentation on how to install it on Arch-based systems and Pacman can't find it in the AUR repos.

Has anyone ever tried to install it?

Mode answered 23/12, 2019 at 12:53 Comment(1)
Pacman doesn't search in AUR, and pamac (the other package manager) searches only with pamac search -a mongodb - and finds something.Telugu
M
71

Here is what I did to install.

As the package is not available in the official Arch repositories and can't be installed using pacman, you need to follow a few steps to install it.

First, you need to get the URL for the repo of prebuilt binaries from AUR. It can be found here and by the time of writing this it was https://aur.archlinux.org/mongodb-bin.git

Simply clone the repo in your home directory or anywhere else. Do git clone https://aur.archlinux.org/mongodb-bin.git, then head to the cloned directory, cd mongodb-bin.

Now, all you need to do is to run makepkg -si command to make the package. the -s flag will handle the dependencies for you and the -i flag will install the package.

After makepkg finishes its execution, don't forget to start mongodb.service. Run systemctl start mongodb and if needed enable it with systemctl enable mongodb.

Type mongo in the terminal and if the Mongo Shell runs you are all set.


Later edit (8.2.2021): This package is now available in AUR.

Mode answered 23/12, 2019 at 15:21 Comment(9)
I've tested the solution on Manjaro Linux. Works fine. Thank you.Cartogram
This works well even just now. However, would this be update alongside all other packages during system updates?Call
@Touchstone you can update this kind of packages using AUR package tool like yay, yay uses similar syntax to pacman, to update official and non-official packages you can use: yay -SyuaBowser
If it's on AUR, you can search for it pamac search -a mongodb and then install it with pamac build mongodb.Telugu
@TomaszGandor when I run pamac build mongodb it just builds forever. I left it running for an hour and came back and still wasn't done. It looks like it's stuck in a dep check loop. Any idea how to work around that?Lampion
@KylerJohnson, yes, try pamac build mongodb-bin ;)Telugu
And by that manner, you can install also MongoDB Compass, thanks bro!Danziger
@ZavenZareyan my pleasure :)Mode
Perfect in Manjaro Linux! thanks bro!Benoni
P
12

It is available in AUR, so you can view it with pamac with -a flag, eg.

  pamac search -a mongodb-bin
  pamac info -a mongodb-bin

And, then build and install with (this can be done after manually cloning too) -

  pamac build mongodb-bin

Note that there's also a package named mongodb, but mongodb-bin is a newer release (you can check the version numbers by search or info arguments)

Polygnotus answered 11/10, 2020 at 14:17 Comment(0)
C
6

I've been using mongodb via docker for a couple of years.
In my experience, it's easier than installing the regular way. (assuming you already have docker installed)

1. Ensure you have docker installed

If you don't already have it, you can install via pacman/pamac, because it's in the official Arch/Manjaro package repositories. The easiest way is to run the following command:

sudo pacman -S docker

2. Run a single docker command

sudo docker run -d -p 27017:27017 -v ~/mongodb_data:/data/db mongo

This command will run mongodb on a port 27017, and place its data files into a folder ~/mongodb_data. If you're running this command for the first time, it will also download all the required files.

Now you're successfully running a local instance of mongodb, and you can connect it with your favorite db management tool or from your code.

Catchment answered 20/6, 2021 at 19:25 Comment(3)
nice i like this. but in this case i'd need to install the mongodbshell separately?Stepdaughter
to get a shell, use --it docker exec -it mongodb bashGlyph
you have to provide a name like this sudo docker run -d -p 27017:27017 -v ~/mongodb_data:/data/db --name MyMongo mongo:latest then run docker exec -it MyMongo bashIniquity

© 2022 - 2024 — McMap. All rights reserved.