ubuntu 20 安装mongodb

文章描述

  1. 导入MongoDB公钥
wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add -

2.  创建MongoDB列表文件

echo "deb [ arch=amd64,arm64 ] http://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list

 

3. 更新本地包数据库

sudo apt-get update

 

4. 安装MongoDB包

sudo apt-get install -y mongodb-org

 

5. 启动MongoDB服务并设置开机自启

sudo systemctl start mongod
sudo systemctl enable mongod

 

6.验证MongoDB是否正在运行

sudo systemctl status mongod

 

 

 

评论(共0条)