官方安装:install-mongodb-on-ubuntu

这里采用基于 deb 的方式安装(以清华源):

wget https://mirrors.tuna.tsinghua.edu.cn/mongodb/apt/ubuntu/dists/focal/mongodb-org/5.0/multiverse/binary-amd64/mongodb-cli_1.20.3_amd64.deb
wget https://mirrors.tuna.tsinghua.edu.cn/mongodb/apt/ubuntu/dists/focal/mongodb-org/5.0/multiverse/binary-amd64/mongodb-database-tools_100.5.0_amd64.deb
wget https://mirrors.tuna.tsinghua.edu.cn/mongodb/apt/ubuntu/dists/focal/mongodb-org/5.0/multiverse/binary-amd64/mongodb-mongosh_0.15.6_amd64.deb
wget https://mirrors.tuna.tsinghua.edu.cn/mongodb/apt/ubuntu/dists/focal/mongodb-org/5.0/multiverse/binary-amd64/mongodb-mongosh_1.1.0_amd64.deb
wget https://mirrors.tuna.tsinghua.edu.cn/mongodb/apt/ubuntu/dists/focal/mongodb-org/5.0/multiverse/binary-amd64/mongodb-org-database-tools-extra_5.0.3_amd64.deb
wget https://mirrors.tuna.tsinghua.edu.cn/mongodb/apt/ubuntu/dists/focal/mongodb-org/5.0/multiverse/binary-amd64/mongodb-org-database_5.0.3_amd64.deb
wget https://mirrors.tuna.tsinghua.edu.cn/mongodb/apt/ubuntu/dists/focal/mongodb-org/5.0/multiverse/binary-amd64/mongodb-org-mongos_5.0.3_amd64.deb
wget https://mirrors.tuna.tsinghua.edu.cn/mongodb/apt/ubuntu/dists/focal/mongodb-org/5.0/multiverse/binary-amd64/mongodb-org-server_5.0.3_amd64.deb
wget https://mirrors.tuna.tsinghua.edu.cn/mongodb/apt/ubuntu/dists/focal/mongodb-org/5.0/multiverse/binary-amd64/mongodb-org-shell_5.0.3_amd64.deb
wget https://mirrors.tuna.tsinghua.edu.cn/mongodb/apt/ubuntu/dists/focal/mongodb-org/5.0/multiverse/binary-amd64/mongodb-org-tools_5.0.3_amd64.deb
wget https://mirrors.tuna.tsinghua.edu.cn/mongodb/apt/ubuntu/dists/focal/mongodb-org/5.0/multiverse/binary-amd64/mongodb-org_5.0.3_amd64.deb

安装:

sudo dpkg -i *.deb

启动 Mongodb:

sudo systemctl start mongod
#sudo systemctl daemon-reload

sudo systemctl status mongod
sudo systemctl enable mongod

sudo systemctl stop mongod
sudo systemctl restart mongod

Mongodb 日志路径:/var/log/mongodb/mongod.log.

Mongodb 命令行工具:mongosh. (mongodb-shell)

相关

[1] - Ubuntu - Mongodb 3.6.5 安装

[2] - Ubuntu - Mongodb 4.x 版本安装

Last modification:October 13th, 2021 at 04:13 pm