How to Install MongoDB on Arch Linux

Use MongoDB's pre-built binary. Use AUR package mongodb-bin and possibly mongodb-tools-bin. This skips the entire compilation stage, downloading a pre-built binary from mongodb.org, and packaging it with the necessary configuration files.

yay -S mongodb-bin

If during the installation you get ==> Error: Problem importing keys like this:

==> PGP keys need importing:
 -> 27EDEAF22F3ABCEB50DB9A125CC908FDB71E12C2, required by: libcurl-openssl-1.0
==> Import? [Y/n] y
:: Importing keys with gpg......
gpg: keyserver receive failed: General error
==> Error: Problem importing keys

-> 27EDEAF22F3ABCEB50DB9A125CC908FDB71E12C2

You can solve it by running the following code:

gpg --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 --recv 27EDEAF22F3ABCEB50DB9A125CC908FDB71E12C2
sudo pacman -Syy
yay -S mongodb-bin

After installing the package. Start/Enable the mongodb.service daemon.

systemctl enable --now mongodb
systemctl start --now mongodb

Test Connetions

mongo

To quit:

exit

References:

Last updated