Install the Atlas CLI to quickly provision and manage Atlas database deployments from the terminal.
To check whether your operating system is compatible with the Atlas CLI, see Check Compatibility.
To verify packages before installation, see Verify the Integrity of Atlas CLI Packages.
Quick Start
Choose one of the following methods to quickly install the Atlas CLI:
brew install mongodb-atlas
Download the binary for your operating system:
Operating System | Download |
|---|---|
Windows | |
MacOS | |
Ubuntu/Debian | |
RHEL/CentOS/SLES/AMZ | |
Linux |
curl -fsSL https://pgp.mongodb.com/server-8.0.asc | \ sudo gpg -o /usr/share/keyrings/mongodb-server-8.0.gpg \ --dearmor echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-8.0.gpg ] \ https://repo.mongodb.com/apt/ubuntu jammy/mongodb-enterprise/8.0 \ multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-enterprise-8.0.list sudo apt-get update sudo apt-get install -y mongodb-atlas
sudo tee /etc/yum.repos.d/mongodb-enterprise-8.0.repo <<EOF [mongodb-enterprise-8.0] name=MongoDB Enterprise Repository baseurl=https://repo.mongodb.com/yum/redhat/\$releasever/mongodb-enterprise/8.0/\$basearch/ gpgcheck=1 enabled=1 gpgkey=https://pgp.mongodb.com/server-8.0.asc EOF sudo yum install -y mongodb-atlas
Installation Methods
Select your installation method to view detailed steps to install or update the Atlas CLI.
Install the Atlas CLI
To install the Atlas CLI on Ubuntu-based systems using Apt, follow the steps below.
Complete the Prerequisites
To install the Atlas CLI using Apt, you must install gnupg and curl:
sudo apt-get install gnupg curl
Procedure
Import the public key used by apt.
From a terminal, issue the following command to import the MongoDB public GPG Key from https://pgp.mongodb.com/server-7.0.asc. Replace 7.0 with your edition of MongoDB.
curl -fsSL https://pgp.mongodb.com/server-7.0.asc | \ sudo gpg -o /usr/share/keyrings/mongodb-server-7.0.gpg \ --dearmor
A successful command returns an OK.
Create a list file for your version of Ubuntu.
Create a /etc/apt/sources.list.d/mongodb-enterprise.list file for your version of Ubuntu. Replace 7.0 with your edition of MongoDB.
echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-8.0.gpg ] https://repo.mongodb.com/apt/ubuntu noble/mongodb-enterprise/8.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-enterprise.list
echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-7.0.gpg ] https://repo.mongodb.com/apt/ubuntu jammy/mongodb-enterprise/7.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-enterprise.list
Authenticate with Atlas.
After you install the Atlas CLI, authenticate:
atlas auth login
The command opens a browser window and returns a one-time activation code. This code expires after 10 minutes.
For more authentication options, see Connect from the Atlas CLI.
Update the Atlas CLI
To update the Atlas CLI with Apt, follow the steps below.
Update the Atlas CLI.
If you installed the Atlas CLI and mongosh together using the mongodb-atlas package, invoke the following apt command:
sudo apt-get install --only-upgrade mongodb-atlas
If you installed the Atlas CLI only using the mongodb-atlas-cli package, invoke the following apt command:
sudo apt-get install --only-upgrade mongodb-atlas-cli
Install the Atlas CLI
To install the Atlas CLI on Ubuntu-based systems using Apt, follow the steps below.
Complete the Prerequisites
To install the Atlas CLI using Apt, you must install gnupg and curl:
sudo apt-get install gnupg curl
Procedure
Import the public key used by apt.
From a terminal, issue the following command to import the MongoDB public GPG Key from https://pgp.mongodb.com/server-7.0.asc. Replace 7.0 with your edition of MongoDB.
curl -fsSL https://pgp.mongodb.com/server-7.0.asc | \ sudo gpg -o /usr/share/keyrings/mongodb-server-7.0.gpg \ --dearmor
A successful command returns an OK.
Create a list file for your version of Ubuntu.
Create the list file /etc/apt/sources.list.d/mongodb-org-7.0.list for your version of Ubuntu. Replace 7.0 with your edition of MongoDB.
echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-8.0.gpg ] https://repo.mongodb.org/apt/ubuntu noble/mongodb-org/8.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-8.0.list
echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-7.0.gpg ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/7.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-7.0.list
Authenticate with Atlas.
After you install the Atlas CLI, authenticate:
atlas auth login
The command opens a browser window and returns a one-time activation code. This code expires after 10 minutes.
For more authentication options, see Connect from the Atlas CLI.
Update the Atlas CLI
To update the Atlas CLI with Apt, follow the steps below.
Update the Atlas CLI.
If you installed the Atlas CLI and mongosh together using the mongodb-atlas package, invoke the following apt command:
sudo apt-get install --only-upgrade mongodb-atlas
If you installed the Atlas CLI only using the mongodb-atlas-cli package, invoke the following apt command:
sudo apt-get install --only-upgrade mongodb-atlas-cli
Install the Atlas CLI
To install the Atlas CLI on Debian-based systems using Apt, follow the steps below.
Complete the Prerequisites
To install the Atlas CLI using Apt, you must install gnupg and curl:
sudo apt-get install gnupg curl
Procedure
Import the public key used by apt.
From a terminal, issue the following command to import the MongoDB public GPG Key from https://pgp.mongodb.com/server-7.0.asc. Replace 7.0 with your edition of MongoDB.
curl -fsSL https://pgp.mongodb.com/server-7.0.asc | \ sudo gpg -o /usr/share/keyrings/mongodb-server-7.0.gpg \ --dearmor
A successful command returns an OK.
Create a list file for your version of Debian.
Create a /etc/apt/sources.list.d/mongodb-enterprise.list file for your version of Debian. Replace 7.0 with your edition of MongoDB.
echo "deb http://repo.mongodb.com/apt/debian trixie/mongodb-enterprise/7.0 main" | sudo tee /etc/apt/sources.list.d/mongodb-enterprise.list
echo "deb http://repo.mongodb.com/apt/debian bookworm/mongodb-enterprise/7.0 main" | sudo tee /etc/apt/sources.list.d/mongodb-enterprise.list
Authenticate with Atlas.
After you install the Atlas CLI, authenticate:
atlas auth login
The command opens a browser window and returns a one-time activation code. This code expires after 10 minutes.
For more authentication options, see Connect from the Atlas CLI.
Update the Atlas CLI
To update the Atlas CLI with Apt, follow the steps below.
Update the Atlas CLI.
If you installed the Atlas CLI and mongosh together using the mongodb-atlas package, invoke the following apt command:
sudo apt-get install --only-upgrade mongodb-atlas
If you installed the Atlas CLI only using the mongodb-atlas-cli package, invoke the following apt command:
sudo apt-get install --only-upgrade mongodb-atlas-cli
Install the Atlas CLI
To install the Atlas CLI on Debian-based systems using Apt, follow the steps below.
Complete the Prerequisites
To install the Atlas CLI using Apt, you must install gnupg and curl:
sudo apt-get install gnupg curl
Procedure
Import the public key used by apt.
From a terminal, issue the following command to import the MongoDB public GPG Key from https://pgp.mongodb.com/server-7.0.asc. Replace 7.0 with your edition of MongoDB.
curl -fsSL https://pgp.mongodb.com/server-7.0.asc | \ sudo gpg -o /usr/share/keyrings/mongodb-server-7.0.gpg \ --dearmor
A successful command returns an OK.
Create a list file for your version of Debian.
Create the list file /etc/apt/sources.list.d/mongodb-org-7.0.list for your version of Debian. Replace 7.0 with your edition of MongoDB.
echo "deb http://repo.mongodb.org/apt/debian trixie/mongodb-org/7.0 main" | sudo tee /etc/apt/sources.list.d/mongodb-org-7.0.list
echo "deb http://repo.mongodb.org/apt/debian bookworm/mongodb-org/7.0 main" | sudo tee /etc/apt/sources.list.d/mongodb-org-7.0.list
Authenticate with Atlas.
After you install the Atlas CLI, authenticate:
atlas auth login
The command opens a browser window and returns a one-time activation code. This code expires after 10 minutes.
For more authentication options, see Connect from the Atlas CLI.
Update the Atlas CLI
To update the Atlas CLI with Apt, follow the steps below.
Update the Atlas CLI.
If you installed the Atlas CLI and mongosh together using the mongodb-atlas package, invoke the following apt command:
sudo apt-get install --only-upgrade mongodb-atlas
If you installed the Atlas CLI only using the mongodb-atlas-cli package, invoke the following apt command:
sudo apt-get install --only-upgrade mongodb-atlas-cli
Install the Atlas CLI
To install the Atlas CLI using Homebrew, follow the steps below.
Complete the Prerequisites
To install the Atlas CLI using Homebrew, you must:
Use a MacOS or Linux operating system.
Install Homebrew.
Procedure
Authenticate with Atlas.
After you install the Atlas CLI, authenticate:
atlas auth login
The command opens a browser window and returns a one-time activation code. This code expires after 10 minutes.
For more authentication options, see Connect from the Atlas CLI.
Update the Atlas CLI
To update the Atlas CLI with Homebrew, follow the steps below.
Update the Atlas CLI.
If you installed the Atlas CLI and mongosh together using the mongodb-atlas package, invoke the following brew command:
brew update brew upgrade mongodb-atlas
If you installed the Atlas CLI and mongosh together using the mongodb-atlas-cli package, invoke the following brew command:
brew update brew upgrade mongodb-atlas-cli
Install the Atlas CLI
To install the Atlas CLI using Chocolatey, follow the steps below.
Complete the Prerequisites
To install the Atlas CLI using Chocolatey, you must do the following:
Ensure that your system meets the requirements for installing Chocolatey.
Install Chocolatey using
cmd.exeorPowerShell.exe. To learn more, see Installing Chocolatey.
Procedure
Authenticate with Atlas.
After you install the Atlas CLI, authenticate:
atlas auth login
The command opens a browser window and returns a one-time activation code. This code expires after 10 minutes.
For more authentication options, see Connect from the Atlas CLI.
Update the Atlas CLI
To update the Atlas CLI with Chocolatey, follow the steps below.
Install the Atlas CLI
To install the Atlas CLI using Docker, follow the steps below.
Complete the Prerequisites
To install the Atlas CLI using Docker, install the Docker engine or Docker desktop.
Procedure
To pull the latest Atlas CLI Docker image, run the following command:
docker pull mongodb/atlas
If you run docker pull mongodb/atlas without specifying a version tag, Docker automatically pulls the latest version of the Docker image (mongodb/atlas:latest).
To pull a specific version of the Docker image, run the following command, replacing <tag> with the version tag:
docker pull mongodb/atlas:<tag>
To learn how to run Atlas CLI commands with Docker after you pull the Docker image, see Run Atlas CLI Commands with Docker.
Authenticate with Atlas
After pulling the Docker image, authenticate to start using the Atlas CLI:
docker run -it mongodb/atlas auth login
The command opens a browser window and returns a one-time activation code. This code expires after 10 minutes.
For more authentication options, see Connect from the Atlas CLI.
Install the Atlas CLI
To install the Atlas CLI by downloading the binary, follow the steps below.
Procedure
(Optional) Add Atlas CLI to your PATH.
You can run the binary from any directory if you do one of the following:
Add the location of the executable to your
PATH.Move the executable to a directory in your
PATH.
You can accomplish this in several ways, depending on your personal settings and environment. Consult the documentation for your shell and operating system for more examples.
In the following example, the user downloads and extracts a binary for the MongoDB CLI to the /atlascli_1.59.3-macOS_x86_64 directory.
The user then moves the executable file to a directory already in their PATH:
cd atlascli_1.59.3-macOS_x86_64 mv atlas /usr/local/bin
Authenticate with Atlas.
After you install the Atlas CLI, authenticate:
atlas auth login
The command opens a browser window and returns a one-time activation code. This code expires after 10 minutes.
For more authentication options, see Connect from the Atlas CLI.
Update the Atlas CLI
To update the Atlas CLI by downloading the binary, follow the steps below.
Install the Atlas CLI
To install the Atlas CLI on RHEL-based systems using Yum, follow the steps below.
Procedure
Configure yum for your edition of MongoDB.
Create a /etc/yum.repos.d/mongodb-enterprise-7.0.repo file so that you can install Atlas CLI directly using yum. Replace 7.0 with your edition of MongoDB.
[mongodb-enterprise-7.0] name=MongoDB Repository baseurl=https://repo.mongodb.com/yum/redhat/$releasever/mongodb-enterprise/7.0/$basearch/ gpgcheck=1 enabled=1 gpgkey=https://pgp.mongodb.com/server-7.0.asc
Authenticate with Atlas.
After you install the Atlas CLI, authenticate:
atlas auth login
The command opens a browser window and returns a one-time activation code. This code expires after 10 minutes.
For more authentication options, see Connect from the Atlas CLI.
Update the Atlas CLI
To update the Atlas CLI with Yum, follow the steps below.
Update the Atlas CLI.
If you installed the Atlas CLI and mongosh together using the mongodb-atlas package, invoke the following yum command:
yum update mongodb-atlas
If you installed the Atlas CLI only using the mongodb-atlas-cli package, invoke the following yum command:
yum update mongodb-atlas-cli
Install the Atlas CLI
To install the Atlas CLI on RHEL-based systems using Yum, follow the steps below.
Procedure
Configure yum for your edition of MongoDB.
Create a /etc/yum.repos.d/mongodb-org-7.0.repo file so that you can install Atlas CLI directly using yum. Replace 7.0 with your edition of MongoDB.
[mongodb-org-7.0] name=MongoDB Repository baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/7.0/x86_64/ gpgcheck=1 enabled=1 gpgkey=https://pgp.mongodb.com/server-7.0.asc
Authenticate with Atlas.
After you install the Atlas CLI, authenticate:
atlas auth login
The command opens a browser window and returns a one-time activation code. This code expires after 10 minutes.
For more authentication options, see Connect from the Atlas CLI.
Update the Atlas CLI
To update the Atlas CLI with Yum, follow the steps below.
Update the Atlas CLI.
If you installed the Atlas CLI and mongosh together using the mongodb-atlas package, invoke the following yum command:
yum update mongodb-atlas
If you installed the Atlas CLI only using the mongodb-atlas-cli package, invoke the following yum command:
yum update mongodb-atlas-cli
Install the Atlas CLI
To install the Atlas CLI on Amazon Linux 2023 using Yum, follow the steps below.
Procedure
Configure yum for your edition of MongoDB.
Create a /etc/yum.repos.d/mongodb-enterprise-7.0.repo file so that you can install Atlas CLI directly using yum. Replace 7.0 with your edition of MongoDB.
[mongodb-enterprise-7.0] name=MongoDB Enterprise Repository baseurl=https://repo.mongodb.com/yum/amazon/2023/mongodb-enterprise/7.0/$basearch/ gpgcheck=1 enabled=1 gpgkey=https://pgp.mongodb.com/server-7.0.asc
Authenticate with Atlas.
After you install the Atlas CLI, authenticate:
atlas auth login
The command opens a browser window and returns a one-time activation code. This code expires after 10 minutes.
For more authentication options, see Connect from the Atlas CLI.
Update the Atlas CLI
To update the Atlas CLI with Yum, follow the steps below.
Update the Atlas CLI.
If you installed the Atlas CLI and mongosh together using the mongodb-atlas package, invoke the following yum command:
yum update mongodb-atlas
If you installed the Atlas CLI only using the mongodb-atlas-cli package, invoke the following yum command:
yum update mongodb-atlas-cli
Install the Atlas CLI
To install the Atlas CLI on Amazon Linux 2023 using Yum, follow the steps below.
Procedure
Configure yum for your edition of MongoDB.
Create a /etc/yum.repos.d/mongodb-org-7.0.repo file so that you can install Atlas CLI directly using yum. Replace 7.0 with your edition of MongoDB.
[mongodb-org-7.0] name=MongoDB Repository baseurl=https://repo.mongodb.org/yum/amazon/2023/mongodb-org/7.0/x86_64/ gpgcheck=1 enabled=1 gpgkey=https://pgp.mongodb.com/server-7.0.asc
Authenticate with Atlas.
After you install the Atlas CLI, authenticate:
atlas auth login
The command opens a browser window and returns a one-time activation code. This code expires after 10 minutes.
For more authentication options, see Connect from the Atlas CLI.
Update the Atlas CLI
To update the Atlas CLI with Yum, follow the steps below.
Update the Atlas CLI.
If you installed the Atlas CLI and mongosh together using the mongodb-atlas package, invoke the following yum command:
yum update mongodb-atlas
If you installed the Atlas CLI only using the mongodb-atlas-cli package, invoke the following yum command:
yum update mongodb-atlas-cli
Take the Next Steps
Connect from the Atlas CLI to start using the Atlas CLI commands.