How Can I Install a MongoDB Client?
MongoDB official website provides client installation packages for different OSs. Download the official binary installation package at https://www.mongodb.com/download-center#community.
The following uses Red Hat Linux 7 and MongoDB 3.4.0 as examples to describe how to obtain the required installation package and install the MongoDB client.
Procedure
- Obtain the installation package.
- Log in at https://www.mongodb.com/download-center/community.
- Choose Server, select RHEL 7.0 Linux 64-bit x64 for OS, and click All version binaries. Figure 1 shows an example.
- Open the downloading page, click linux/mongodb-linux-x86_64-rhel70-3.4.0.tgz to download the binary installation package of MongoDB 3.4.0. Figure 2 shows an example.
- Upload the installation package to the ECS. For details about how to log in to an ECS, see How Do I Create and Log In to an ECS?.
- Decompress the installation package on the ECS.
tar zxvf mongodb-linux-x86_64-rhel70-3.4.0.tgz
- Obtain the client tool from the bin directory of the installation package.
cd mongodb-linux-x86_64-rhel70-3.4.0/bin
The common tools are as follows:
- MongoDB client mongo
- Data export tool mongoexport
- Data import tool mongoimport
- Before using a client tool, assign the execute permission to it.
- Run the chmod +x mongo command to grant a client permission to connect to a DB instance.
- Run the chmod +x mongoexport command to grant a client permission to export data.
- Run the chmod +x mongoimport command to grant a client permission to import data.
- Connect to a DB instance from the client. For details, see section "Connecting to a DB Instance" in Document Database Service Getting Started


Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.