Debian 10
可以参考官方的方法: https://www.mongodb.com/docs/mongodb-shell/install/#std-label-mdb-shell-install
以下是我安装的步骤
安装必备的应用
1sudo apt-get install gnupg
2```bash
3
4## 添加GPG KEY
5```bash
6wget -qO - https://www.mongodb.org/static/pgp/server-5.0.asc | sudo apt-key add -
创建清单文件 /etc/apt/sources.list.d/mongodb-org-5.0.list for your version of Ubuntu.
Click on the appropriate tab for your version of Ubuntu. If you are unsure of what Ubuntu version the host is running, open a terminal or shell on the host and execute lsb_release -dc.
1echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-5.0.list
重新加载数据库
Issue the following command to reload the local package database:
1sudo apt-get update
安装mongosh命令行工具
To install the latest stable version of mongosh, issue the following command:
1sudo apt-get install -y mongodb-mongosh
Debian 11
Debian 11 取消了apt-key,所以可以用以下方法解决。
添加GPG KEY
1wget -qO - https://adoptopenjdk.jfrog.io/adoptopenjdk/api/gpg/key/public | gpg --no-default-keyring --keyring gnupg-ring:/etc/apt/trusted.gpg.d/adoptopenjdk.gpg --import -
2sudo chown _apt /etc/apt/trusted.gpg.d/adoptopenjdk.gpg
重新加载数据库
Issue the following command to reload the local package database:
1sudo apt-get update
安装mongosh命令行工具
To install the latest stable version of mongosh, issue the following command:
1sudo apt-get install -y mongodb-mongosh
评论