Install or Update the Atlas CLI
Install the Atlas CLI to quickly provision and manage Atlas database deployments from the terminal.
To verify packages before installation, see Verify the Integrity of Atlas CLI Packages.
Install the Atlas CLI
Select one of the following installation methods and follow the steps to install the Atlas CLI.
To check whether your operating system is compatible with the Atlas CLI, see Check Compatibility.
Complete the Prerequisites
To install the Atlas CLI using Homebrew, you must:
Use a MacOS or Linux operating system.
Install Homebrew.
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.exe
orPowerShell.exe
. To learn more, see Installing Chocolatey.
Complete the Prerequisites
To install the Atlas CLI using Docker, install the Docker engine or Docker desktop.
Follow These Steps
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
[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
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
[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
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 edition of MongoDB.
Select Ubuntu or Debian, then select your version.
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-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
echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-7.0.gpg ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/7.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-7.0.list
echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-7.0.gpg ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/7.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-7.0.list
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 bookworm/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 bullseye/mongodb-org/7.0 main" | sudo tee /etc/apt/sources.list.d/mongodb-org-7.0.list
Select Ubuntu or Debian, then select your version.
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-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
echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-7.0.gpg ] https://repo.mongodb.com/apt/ubuntu focal/mongodb-enterprise/7.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 bionic/mongodb-enterprise/7.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-enterprise.list
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 bullseye/mongodb-enterprise/7.0 main" | sudo tee /etc/apt/sources.list.d/mongodb-enterprise.list
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.
Update the Atlas CLI
To update the Atlas CLI, follow the procedure that corresponds with the method you used to install the Atlas CLI:
Follow These Steps
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
Follow These Steps
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
Follow These Steps
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
Take the Next Steps
Connect from the Atlas CLI to start using the Atlas CLI commands.