標題就凸顯了尷尬,是的,本地(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 *