Ubuntu14.04下Mongodb(在线安装方式|apt-get)安装部署步骤(图文详解)(博主推荐)

时间:2021-09-04 00:38:30

  不多说,直接上干货!

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

一、MongoDB介绍

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

二、安装MongoDB

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

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

Ubuntu14.04下Mongodb(在线安装方式|apt-get)安装部署步骤(图文详解)(博主推荐)

root@zhouls-virtual-machine:~# cat /etc/issue
Ubuntu 14.04. LTS \n \l root@zhouls-virtual-machine:~#

Ubuntu14.04下Mongodb(在线安装方式|apt-get)安装部署步骤(图文详解)(博主推荐)

root@zhouls-virtual-machine:~# sudo apt-get install mongodb
Reading package lists... Done
Building dependency tree
Reading state information... Done
mongodb is already the newest version.
upgraded, newly installed, to remove and not upgraded.
root@zhouls-virtual-machine:~# mongo -version
MongoDB shell version: 2.4.
root@zhouls-virtual-machine:~# sudo apt-get --purge remove mongodb mongodb-clients mongodb-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
The 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.-dev libgoogle-perftools4 libpcrecpp0
libsnappy1 libstdc++-4.8-dev libtcmalloc-minimal4 libunwind8 libv8-3.14.
mongodb-dev
Use 'apt-get autoremove' to remove them.
The following packages will be REMOVED:
mongodb* mongodb-clients* mongodb-server*
upgraded, newly installed, to remove and not upgraded.
After this operation, MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... files and directories currently installed.)
Removing mongodb (:2.4.-1ubuntu2) ...
Removing mongodb-server (:2.4.-1ubuntu2) ...
arg: remove
mongodb stop/waiting
Purging configuration files for mongodb-server (:2.4.-1ubuntu2) ...
dpkg: warning: while removing mongodb-server, directory '/var/log/mongodb' not empty so not removed
dpkg: warning: while removing mongodb-server, directory '/var/lib/mongodb' not empty so not removed
Removing mongodb-clients (:2.4.-1ubuntu2) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
root@zhouls-virtual-machine:~# clear root@zhouls-virtual-machine:~# sudo apt-get install mongodb
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
mongodb-clients mongodb-server
The following NEW packages will be installed:
mongodb mongodb-clients mongodb-server
upgraded, newly installed, to remove and not upgraded.
Need to get B/12.9 MB of archives.
After this operation, MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Selecting previously unselected package mongodb-clients.
(Reading database ... files and directories currently installed.)
Preparing to unpack .../mongodb-clients_1%3a2.4.9-1ubuntu2_amd64.deb ...
Unpacking mongodb-clients (:2.4.-1ubuntu2) ...
Selecting previously unselected package mongodb-server.
Preparing to unpack .../mongodb-server_1%3a2.4.9-1ubuntu2_amd64.deb ...
Unpacking mongodb-server (:2.4.-1ubuntu2) ...
Selecting previously unselected package mongodb.
Preparing to unpack .../mongodb_1%3a2.4.9-1ubuntu2_amd64.deb ...
Unpacking mongodb (:2.4.-1ubuntu2) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Processing triggers for ureadahead (0.100.-) ...
ureadahead will be reprofiled on next reboot
Setting up mongodb-clients (:2.4.-1ubuntu2) ...
Setting up mongodb-server (:2.4.-1ubuntu2) ...
mongodb start/running, process
Processing triggers for ureadahead (0.100.-) ...
Setting up mongodb (:2.4.-1ubuntu2) ...
root@zhouls-virtual-machine:~#

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

Ubuntu14.04下Mongodb(在线安装方式|apt-get)安装部署步骤(图文详解)(博主推荐)

root@zhouls-virtual-machine:~# mongo -version
MongoDB shell version: 2.4.

  启动和关闭mongodb命令如下:

Ubuntu14.04下Mongodb(在线安装方式|apt-get)安装部署步骤(图文详解)(博主推荐)

root@zhouls-virtual-machine:~# service mongodb start
start: Job is already running: mongodb
root@zhouls-virtual-machine:~# service mongodb stop
mongodb stop/waiting
root@zhouls-virtual-machine:~#

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

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

Ubuntu14.04下Mongodb(在线安装方式|apt-get)安装部署步骤(图文详解)(博主推荐)

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

  卸载MongoDB

Ubuntu14.04下Mongodb(在线安装方式|apt-get)安装部署步骤(图文详解)(博主推荐)

root@zhouls-virtual-machine:~# sudo apt-get --purge remove mongodb mongodb-clients mongodb-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
The 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.-dev libgoogle-perftools4 libpcrecpp0
libsnappy1 libstdc++-4.8-dev libtcmalloc-minimal4 libunwind8 libv8-3.14.
mongodb-dev
Use 'apt-get autoremove' to remove them.
The following packages will be REMOVED:
mongodb* mongodb-clients* mongodb-server*
upgraded, newly installed, to remove and not upgraded.
After this operation, MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... files and directories currently installed.)
Removing mongodb (:2.4.-1ubuntu2) ...
Removing mongodb-server (:2.4.-1ubuntu2) ...
arg: remove
mongodb stop/waiting
Purging configuration files for mongodb-server (:2.4.-1ubuntu2) ...
dpkg: warning: while removing mongodb-server, directory '/var/log/mongodb' not empty so not removed
dpkg: warning: while removing mongodb-server, directory '/var/lib/mongodb' not empty so not removed
Removing mongodb-clients (:2.4.-1ubuntu2) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
root@zhouls-virtual-machine:~#

Ubuntu14.04下Mongodb(在线安装方式|apt-get)安装部署步骤(图文详解)(博主推荐)的更多相关文章

  1. Ubuntu14.04下Mongodb数据库可视化工具安装部署步骤(图文详解)(博主推荐)

    不多说,直接上干货! 前期博客 Ubuntu14.04下Mongodb(离线安装方式|非apt-get)安装部署步骤(图文详解)(博主推荐) Ubuntu14.04下Mongodb官网安装部署步骤(图 ...

  2. Ubuntu14.04下Mongodb官网安装部署步骤(图文详解)(博主推荐)

    不多说,直接上干货! 在这篇博客里,我采用了非官网的安装步骤,来进行安装.走了弯路,同时,也是不建议.因为在大数据领域和实际生产里,还是要走正规的为好. Ubuntu14.04下Mongodb(离线安 ...

  3. Ubuntu14.04下Mongodb的Java API编程实例(手动项目或者maven项目)

    不多说,直接上干货! 若大家,不会安装的话,则请移步,随便挑选一种. Ubuntu14.04下Mongodb(在线安装方式|apt-get)安装部署步骤(图文详解)(博主推荐) Ubuntu14.04 ...

  4. Ubuntu14.04下Mongodb官网卸载部署步骤(图文详解)(博主推荐)

    不多说,直接上干货! 前期博客 Ubuntu14.04下Mongodb官网安装部署步骤(图文详解)(博主推荐) https://docs.mongodb.com/manual/tutorial/ins ...

  5. Ubuntu14.04下Mongodb(离线安装方式|非apt-get)安装部署步骤(图文详解)(博主推荐)

    不多说,直接上干货! 说在前面的话  首先,查看下你的操作系统的版本. root@zhouls-virtual-machine:~# cat /etc/issue Ubuntu LTS \n \l r ...

  6. Git学习系列之Windows上安装Git之后的一些配置(图文详解)

    不多说,直接上干货! 前面博客 Git学习系列之Windows上安装Git详细步骤(图文详解) 第一次使用Git时,需要对Git进行一些配置,以方便使用Git. 不过,这种配置工作只需要进行一次便可, ...

  7. 基于CentOS6.5下snort+barnyard2+base的入侵检测系统的搭建(图文详解)(博主推荐)

    为什么,要写这篇论文? 是因为,目前科研的我,正值研三,致力于网络安全.大数据.机器学习研究领域! 论文方向的需要,同时不局限于真实物理环境机器实验室的攻防环境.也不局限于真实物理机器环境实验室的大数 ...

  8. 全网最详细的Sublime Text 3的安装Package Control插件管理包(图文详解)

    不多说,直接上干货! 全网最详细的Windows里下载与安装Sublime Text *(图文详解) 全网最详细的Sublime Text 3的激活(图文详解) 全网最详细的Sublime Text ...

  9. Ubuntu14.04下编译安装或apt-get方式安装搭建Apache或Httpd服务(图文详解)

    不多说,直接上干货! 写在前面的话 对于 在Ubuntu系统上,编译安装Apache它默认路径是在/usr/local/apache2/htdocs 或者编译安装httpd它默认路径是在/usr/lo ...

随机推荐

  1. UINavigationController的创建和相关设置---学习笔记四

    导航控制器 一.设置字体大小,背景等. 二.自定义返回按钮. 三.设置手势. 一.导航中也有个appearance属性,通过它可以设置所有导航的颜色. 二.自定义返回按钮. 1.首先需要知道的是,要把 ...

  2. Android学习笔记之HttpClient实现Http请求....

    PS:最近光忙着考试了....破组成原理都看吐了....搞的什么也不想干...写篇博客爽爽吧....貌似明天就考试了...sad... 学习笔记: 1.如何实现Http请求来实现通信.... 2.解决 ...

  3. ACM-ICPC国际大学生程序设计竞赛北京赛区(2015)网络赛 B Mission Impossible 6

    #1228 : Mission Impossible 6 时间限制:1000ms 单点时限:1000ms 内存限制:256MB 描述 You must have seen the very famou ...

  4. 淘宝内部分享:怎么跳出MySQL的10个大坑

    编者按:淘宝自从2010开始规模使用MySQL,替换了之前商品.交易.用户等原基于IOE方案的核心数据库,目前已部署数千台规模.同时和Oracle, Percona, Mariadb等上游厂商有良好合 ...

  5. SharePoint 2013 图文开发系列之入门教程

    做了SharePoint有三年了,大家经常会问到,你的SharePoint是怎么学的,想想自己的水平,也不过是初级开发罢了.因为,SharePoint开发需要接触的东西太多了,Windows操作系统. ...

  6. java学习笔记(三):类和对象

     创建对象 构造器 每一个类都有一个构造器. 如果我们不单独为一个类编写构造器那么 Java 的编译器将会给这个类建立一个默认的构造器. 每当一个新的对象被创建,至少一个构造器将会被调用. 构造器的一 ...

  7. 转://tcpdump抓包实例

    基本语法 ========过滤主机--------- 抓取所有经过 eth1,目的或源地址是 192.168.1.1 的网络数据# tcpdump -i eth1 host 192.168.1.1- ...

  8. jenkins 升级jdk到1.8.0 报java.io.IOException:Unable to read /var/lib/jenkins/config.xml

    今天手动下载安装了jdk1.8.0, 并修改了配置文件,当前默认使用该版本的jdk.但是报出一下错误: 问题查到: https://issues.jenkins-ci.org/browse/JENKI ...

  9. Android 美学设计基础 <2>

    我们接着上期的项目进行分享. 1.2.2 Elevation (仰角) 仰角只的是不同的素材块在Z轴上的选对位置 仰角的测量方式 这里只的是两个平面在z的距离,记住我们默认每个平面都是1dp的厚度 1 ...

  10. 浅析Web数据存储-Cookie、UserData、SessionStorage、WebSqlDatabase

    Cookie 它是标准的客户端浏览器状态保存方式,可能在浏览器诞生不久就有Cookie了,为什么需要Cookie 这个东东?由于HTTP协议没有状态,所以需要一个标志/存储来记录客户浏览器当前的状态, ...