a) 安装gnupg软件包:
sudo apt-get install gnupg
b)导入包管理系统使用的公钥:
wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add -
c) 添加MongoDB存储库:
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list
d) 安装:
sudo apt-get update
sudo apt install mongodb-org
e) 启动MongoDB服务:
sudo systemctl start mongod.service
sudo systemctl enable mongod
f) 检查服务的状态:
sudo systemctl status mongod
g) MongoDB配置:vim /etc/mongod.conf
配置后重启 sudo systemctl restart mongod