Skip to content
Runbook

Install MongoDB on Arch

Document-oriented NoSQL database (BSON), designed for horizontal scalability and flexible schemas.

Databasenosqldocumentdatabasebson

Installation

Server (AUR) · pacman
yay -S mongodb-bin

MongoDB is not in Arch's official repositories (SSPL license): it is installed via the AUR (mongodb-bin = precompiled binaries). yay is a common AUR helper.

Shell only (AUR) · pacman
yay -S mongosh-bin

Verify the installation

Verify
mongod --version

Service

Start
sudo systemctl start mongodb
Stop
sudo systemctl stop mongodb
Status
sudo systemctl status mongodb
Restart
sudo systemctl restart mongodb
On boot
sudo systemctl enable mongodb

Important files

TypePathDescription
config/etc/mongodb.confServer configuration (file name specific to the Arch package).
data/var/lib/mongodbdbPath data directory.
log/var/log/mongodb/mongod.logServer log.

Default ports

27017

Command-line tools

  • mongoshAdministration and query shell.
  • mongodumpBinary export of a database.
  • mongorestoreRestore of a binary dump.

Uninstall

Uninstall
sudo systemctl stop mongodb
yay -Rns mongodb-bin

Good to know

  • AUR package: it is compiled/packaged by the community — review the PKGBUILD before installing.
  • The systemd unit provided by the package is named "mongodb".
  • Security: by default MongoDB enables no authentication and only listens on 127.0.0.1. Enable authentication (security.authorization: enabled) and create an administrator user before any network exposure; never bind the server to a public IP without a firewall and auth.
  • Linux kernels >= 6.19 (Feb. 2026): mongodb-bin may crash in a loop (SIGSEGV related to rseq/tcmalloc), made worse by GLIBC_TUNABLES=glibc.pthread.rseq=0 in the systemd unit. Workaround: sudo systemctl edit mongodb then add Environment="GLIBC_TUNABLES=glibc.pthread.rseq=1" (or clear the variable), sudo systemctl daemon-reload and restart; or stay on a kernel <= 6.18. Issue tracked upstream.

Installation on Arch

Because of its SSPL license, MongoDB is not in Arch's official repositories. So we go through the AUR with a helper like yay. The mongodb-bin package provides precompiled binaries (the alternative mongodb compiles from source and is very slow).

Always inspect the PKGBUILD of an AUR package before installing it. The service is named mongodb (not mongod).

Security

By default, MongoDB starts without authentication and only listens on 127.0.0.1. Before any networking, enable authentication (security.authorization: enabled in /etc/mongodb.conf) and create an administrator user. Never bind the server to a public IP address without a firewall and authentication: an open instance is quickly discovered and compromised.

Linux kernels >= 6.19: crash loop

On Linux kernels >= 6.19 (February 2026), mongodb-bin may crash in a loop at startup (SIGSEGV related to the rseq/tcmalloc interaction). The problem is made worse by the GLIBC_TUNABLES=glibc.pthread.rseq=0 variable set in the package's systemd unit.

Workaround, pending an upstream fix:

sudo systemctl edit mongodb

Add the following to the override file:

[Service]
Environment="GLIBC_TUNABLES=glibc.pthread.rseq=1"

(you can also simply clear the variable). Then reload and restart:

sudo systemctl daemon-reload
sudo systemctl restart mongodb

Alternative: stay on a kernel <= 6.18. The issue is tracked upstream.