ubuntu安装[email protected]、4.2、4.4

安装

# 配置apt Repository mongodb 4.0, 4.2, 4.4
$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 68818c72e52529d4 #4.0
$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 4B7C549A058F8B6B #4.2
$ wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add -  #4.4

# 此处4.0可以改成4.2、4.4
# Ubuntu 20.04 LTS:
$ echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb.list
# Ubuntu 18.04 LTS:
$ echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb.list
# Ubuntu 16.04 LTS:
$ echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb.list

# 更新一下
$ sudo apt-get update

# 安装mongodb
$ sudo apt install mongodb-org

# 其它命令
$ sudo systemctl enable mongod
$ sudo systemctl start mongod 
$ sudo systemctl stop mongod
$ sudo systemctl restart mongod 

# 查看版本
 $ mongod --version 

卸载

# 卸载 mongodb
$ sudo apt-get remove mongodb
# 卸载 mongodb 和它的依赖项。
$ sudo apt-get remove --auto-remove mongodb
# 卸载 mongodb 和它的依赖项, 并清除您的配置数据
$ sudo apt-get purge --auto-remove mongodb

你可能感兴趣的:(ubuntu安装[email protected]、4.2、4.4)