博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Ubuntu14.04下Mongodb(在线安装方式|apt-get)安装部署步骤(图文详解)(博主推荐)...
阅读量:6121 次
发布时间:2019-06-21

本文共 5397 字,大约阅读时间需要 17 分钟。

 

 

 

 

  不多说,直接上干货!

 

 

本博文介绍了,并详细指引读者在Ubuntu下MongoDB的安装和使用。本教程在Ubuntu14.04下通过。 

 

 

一、MongoDB介绍

  MongoDB 是一个是一个基于分布式文件存储的,介于关系数据库和非关系数据库之间,是非关系数据库当中功能最丰富,最像关系数据库的。他支持的非常松散,是类似json的bson格式,因此可以存储比较复杂的数据类型。Mongo最大的特点是他支持的查询语言非常强大,其语法有点类似于面向对象的查询语言,几乎可以实现类似关系数据库单表查询的绝大部分功能,而且还支持对数据建立索引。

 

 

 

二、安装MongoDB

  MongoDB安装很简单,无需下载源文件,可以直接用apt-get命令进行安装。 

首先,查看下你的操作系统的版本。 

root@zhouls-virtual-machine:~# cat /etc/issueUbuntu 14.04.4 LTS \n \lroot@zhouls-virtual-machine:~#

 

 

 

 

root@zhouls-virtual-machine:~# sudo apt-get install mongodbReading package lists... DoneBuilding dependency tree       Reading state information... Donemongodb is already the newest version.0 upgraded, 0 newly installed, 0 to remove and 338 not upgraded.root@zhouls-virtual-machine:~# mongo -versionMongoDB shell version: 2.4.9root@zhouls-virtual-machine:~# sudo apt-get --purge remove mongodb mongodb-clients mongodb-serverReading package lists... DoneBuilding dependency tree       Reading state information... DoneThe following packages were automatically installed and are no longer required:  libboost-dev libboost-filesystem1.54.0 libboost-program-options1.54.0  libboost-thread1.54.0 libboost1.54-dev libgoogle-perftools4 libpcrecpp0  libsnappy1 libstdc++-4.8-dev libtcmalloc-minimal4 libunwind8 libv8-3.14.5  mongodb-devUse 'apt-get autoremove' to remove them.The following packages will be REMOVED:  mongodb* mongodb-clients* mongodb-server*0 upgraded, 0 newly installed, 3 to remove and 338 not upgraded.After this operation, 107 MB disk space will be freed.Do you want to continue? [Y/n] y(Reading database ... 180474 files and directories currently installed.)Removing mongodb (1:2.4.9-1ubuntu2) ...Removing mongodb-server (1:2.4.9-1ubuntu2) ...arg: removemongodb stop/waitingPurging configuration files for mongodb-server (1:2.4.9-1ubuntu2) ...dpkg: warning: while removing mongodb-server, directory '/var/log/mongodb' not empty so not removeddpkg: warning: while removing mongodb-server, directory '/var/lib/mongodb' not empty so not removedRemoving mongodb-clients (1:2.4.9-1ubuntu2) ...Processing triggers for man-db (2.6.7.1-1ubuntu1) ...root@zhouls-virtual-machine:~# clearroot@zhouls-virtual-machine:~# sudo apt-get install mongodbReading package lists... DoneBuilding dependency tree       Reading state information... DoneThe following extra packages will be installed:  mongodb-clients mongodb-serverThe following NEW packages will be installed:  mongodb mongodb-clients mongodb-server0 upgraded, 3 newly installed, 0 to remove and 338 not upgraded.Need to get 0 B/12.9 MB of archives.After this operation, 107 MB of additional disk space will be used.Do you want to continue? [Y/n] ySelecting previously unselected package mongodb-clients.(Reading database ... 180427 files and directories currently installed.)Preparing to unpack .../mongodb-clients_1%3a2.4.9-1ubuntu2_amd64.deb ...Unpacking mongodb-clients (1:2.4.9-1ubuntu2) ...Selecting previously unselected package mongodb-server.Preparing to unpack .../mongodb-server_1%3a2.4.9-1ubuntu2_amd64.deb ...Unpacking mongodb-server (1:2.4.9-1ubuntu2) ...Selecting previously unselected package mongodb.Preparing to unpack .../mongodb_1%3a2.4.9-1ubuntu2_amd64.deb ...Unpacking mongodb (1:2.4.9-1ubuntu2) ...Processing triggers for man-db (2.6.7.1-1ubuntu1) ...Processing triggers for ureadahead (0.100.0-16) ...ureadahead will be reprofiled on next rebootSetting up mongodb-clients (1:2.4.9-1ubuntu2) ...Setting up mongodb-server (1:2.4.9-1ubuntu2) ...mongodb start/running, process 3594Processing triggers for ureadahead (0.100.0-16) ...Setting up mongodb (1:2.4.9-1ubuntu2) ...root@zhouls-virtual-machine:~#

 

 

 

 

  安装完成后,在终端输入以下命令查看MongoDB版本:

root@zhouls-virtual-machine:~# mongo -versionMongoDB shell version: 2.4.9

 

 

 

 

 

 

  启动和关闭mongodb命令如下:

root@zhouls-virtual-machine:~# service mongodb startstart: Job is already running: mongodbroot@zhouls-virtual-machine:~# service mongodb stopmongodb stop/waitingroot@zhouls-virtual-machine:~#

   默认设置MongoDB是随Ubuntu启动自动启动的。 

 

 

 

  输入以下命令查看是否启动成功:

pgrep mongo -l   #注意:-l是英文字母l,不是阿拉伯数字1

 

 

 

 

  卸载MongoDB

root@zhouls-virtual-machine:~# sudo apt-get --purge remove mongodb mongodb-clients mongodb-serverReading package lists... DoneBuilding dependency tree       Reading state information... DoneThe following packages were automatically installed and are no longer required:  libboost-dev libboost-filesystem1.54.0 libboost-program-options1.54.0  libboost-thread1.54.0 libboost1.54-dev libgoogle-perftools4 libpcrecpp0  libsnappy1 libstdc++-4.8-dev libtcmalloc-minimal4 libunwind8 libv8-3.14.5  mongodb-devUse 'apt-get autoremove' to remove them.The following packages will be REMOVED:  mongodb* mongodb-clients* mongodb-server*0 upgraded, 0 newly installed, 3 to remove and 338 not upgraded.After this operation, 107 MB disk space will be freed.Do you want to continue? [Y/n] y(Reading database ... 180474 files and directories currently installed.)Removing mongodb (1:2.4.9-1ubuntu2) ...Removing mongodb-server (1:2.4.9-1ubuntu2) ...arg: removemongodb stop/waitingPurging configuration files for mongodb-server (1:2.4.9-1ubuntu2) ...dpkg: warning: while removing mongodb-server, directory '/var/log/mongodb' not empty so not removeddpkg: warning: while removing mongodb-server, directory '/var/lib/mongodb' not empty so not removedRemoving mongodb-clients (1:2.4.9-1ubuntu2) ...Processing triggers for man-db (2.6.7.1-1ubuntu1) ...root@zhouls-virtual-machine:~#

 

转载地址:http://clgka.baihongyu.com/

你可能感兴趣的文章
Java 生产条形码代码
查看>>
python web开发-flask连接sqlite数据库
查看>>
Zxing二维码扫描
查看>>
MMU的作用
查看>>
决心书
查看>>
计算机网络(2)
查看>>
Nginx unit 源码安装初体验
查看>>
PTA基础编程题目集6-2多项式求值(函数题)
查看>>
哈佛医生帮你增强记忆力
查看>>
Cloudera Search配置
查看>>
[原译]类型安全的黑板模式(属性包)
查看>>
【转】python中的一维卷积conv1d和二维卷积conv2d
查看>>
第十章:为文本添加样式
查看>>
WebApi系列~通过HttpClient来调用Web Api接口~续~实体参数的传递
查看>>
二叉树与双向链表的转换
查看>>
SharePOint 2010 dashboard designer 使用说明
查看>>
Laravel Eloquent ORM 数据model操作
查看>>
对shell脚本进行加密
查看>>
对象的深度复制
查看>>
元数据 Metadata
查看>>