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?

aalaap
  • 4,145
  • 5
  • 52
  • 59
Henry Harutyunyan
  • 2,355
  • 1
  • 16
  • 22
  • 1
    Pacman doesn't search in AUR, and `pamac` (the other package manager) searches only with `pamac search -a mongodb` - and finds something. – Tomasz Gandor Jul 28 '20 at 14:12

3 Answers3

70

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.

Iulia Mihet
  • 650
  • 1
  • 10
  • 34
Henry Harutyunyan
  • 2,355
  • 1
  • 16
  • 22
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)

AdityaG15
  • 290
  • 3
  • 12
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.

Tin
  • 424
  • 5
  • 13