How to install mongodb 7.0 to Ubuntu 22.04
要在Ubuntu 22.04上安装MongoDB 7.0,请遵循以下步骤:
- 导入MongoDB公钥:
wget -qO - https://www.mongodb.org/static/pgp/server-7.0.asc | sudo gpg --dearmor --batch --yes --output /usr/share/keyrings/mongodb-archive-keyring.gpg
- 设置MongoDB仓库列表:
echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-archive-keyring.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
- 更新本地包索引:
sudo apt update
- 安装MongoDB包:
sudo apt install -y mongodb-org
- 启动MongoDB服务:
sudo systemctl start mongod
- 设置MongoDB在系统启动时自动启动:
sudo systemctl enable mongod
- 检查MongoDB服务状态:
sudo systemctl status mongod
以上步骤将安装MongoDB 7.0,并设置服务在系统启动时自动运行。
评论已关闭