# 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
```

{% hint style="info" %}
`-> 27EDEAF22F3ABCEB50DB9A125CC908FDB71E12C2`
{% endhint %}

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](https://wiki.archlinux.org/index.php/Start)/[Enable](https://wiki.archlinux.org/index.php/Enable) the `mongodb.service` daemon.

```
systemctl enable --now mongodb
```

```
systemctl start --now mongodb
```

## Test Connetions

```bash
mongo
```

To quit:

```bash
exit
```

## References:

{% embed url="<https://wiki.archlinux.org/index.php/MongoDB>" %}

{% embed url="<https://www.vultr.com/docs/how-to-install-mongodb-4-0-on-arch-linux>" %}

{% embed url="<https://unix.stackexchange.com/questions/361213/unable-to-add-gpg-key-with-apt-key-behind-a-proxy>" %}
