mongodb卸载再重装

标题就凸显了尴尬,是的,本地(ubuntu16.04)自带的mongodb太老了,想要装最新版的

卸载:

sudo dpkg -P mongodb

然后下载新版的mongodb:  https://mirrors.tuna.tsinghua.edu.cn/mongodb/apt/ubuntu/dists/xenial/mongodb-org/3.4/multiverse/binary-amd64/

因为官网下载太慢了,所以从镜像站下

但是,下下来安装发现有问题,说

$ sudo dpkg -i mongodb-org-server_3.4.0_amd64.deb
dpkg: regarding mongodb-org-server_3.4.0_amd64.deb containing mongodb-org-server:
 mongodb-org-server conflicts with mongodb-clients
  mongodb-clients (version 1:2.6.10-0ubuntu1) is present and installed.

dpkg: error processing archive mongodb-org-server_3.4.0_amd64.deb (--install):
 conflicting packages - not installing mongodb-org-server
Errors were encountered while processing:
 mongodb-org-server_3.4.0_amd64.deb

也就是没删干净,因为mongo不仅有db,还有相关的server,shell,tool也得删

sudo apt-get clean
sudo apt-get autoclean
sudo apt-get purge mongodb
sudo apt autoremove

这样即可全部删完

回到下载的最新的mongo包的目录:

$ ls
mongodb-org_3.4.0_amd64.deb         mongodb-org-server_3.4.0_amd64.deb  mongodb-org-tools_3.4.0_amd64.deb
mongodb-org-mongos_3.4.0_amd64.deb  mongodb-org-shell_3.4.0_amd64.deb

安装即可

sudo dpkg -i *

 

posted @ 2017-09-19 16:08  dahu1  Views(6555)  Comments(0Edit  收藏  举报