ubuntu 简单安装 Mongodb

发布时间:2020-07-24 22:21:24 作者:John966
来源:网络 阅读:1067

 ubuntu 简单安装 Mongodb

系统:ubuntu 12.04 x64

下面介绍最简单的安装方式

1.添加国内163的更新源

 首先备份Ubuntu12.04源列表

sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak


 修改更新源(163源),在最后一行添加

sudo vi /etc/apt/sources.list


deb http://mirrors.163.com/ubuntu/ precise main restricted

deb-src http://mirrors.163.com/ubuntu/ precise main restricted

deb http://mirrors.163.com/ubuntu/ precise-updates main restricted

deb-src http://mirrors.163.com/ubuntu/ precise-updates main restricted

deb http://mirrors.163.com/ubuntu/ precise universe

deb-src http://mirrors.163.com/ubuntu/ precise universe

deb http://mirrors.163.com/ubuntu/ precise-updates universe

deb-src http://mirrors.163.com/ubuntu/ precise-updates universe

deb http://mirrors.163.com/ubuntu/ precise multiverse

deb-src http://mirrors.163.com/ubuntu/ precise multiverse

deb http://mirrors.163.com/ubuntu/ precise-updates multiverse

deb-src http://mirrors.163.com/ubuntu/ precise-updates multiverse

deb http://mirrors.163.com/ubuntu/ precise-backports main restricted universe multiverse

deb-src http://mirrors.163.com/ubuntu/ precise-backports main restricted universe multiverse

deb http://mirrors.163.com/ubuntu/ precise-security main restricted

deb-src http://mirrors.163.com/ubuntu/ precise-security main restricted

deb http://mirrors.163.com/ubuntu/ precise-security universe

deb-src http://mirrors.163.com/ubuntu/ precise-security universe

deb http://mirrors.163.com/ubuntu/ precise-security multiverse

deb-src http://mirrors.163.com/ubuntu/ precise-security multiverse

deb http://extras.ubuntu.com/ubuntu precise main

deb-src http://extras.ubuntu.com/ubuntu precise main


  更新源

sudo apt-get update


2.安装mongodb

sudo apt-get install mongodb


安装完成之后,自动运行mongod程序,查看是否运行

pgrep mongo -l

800 mongod

进入数据库

mongo

MongoDB shell version: 2.0.4

connecting to: test

>exit

创建目录

sudo mkdir -p /data/mongodb/db /data/mongodb/log

启动程序

sudo mongod --dbpath /data/mongodb/db --logpath /data/mongodb/log/mongodb.log --logappend

all output going to: /data/mongodb/log/mongodb.log

查看端口

sudo netstat -nalupt | grep mongo

tcp        0      0 127.0.0.1:27017         0.0.0.0:*               LISTEN      800/mongod

tcp        0      0 127.0.0.1:28017         0.0.0.0:*               LISTEN      800/mongod




推荐阅读:
  1. Install MongoDB in Ubuntu 16.0
  2. Ubuntu apt-get 安装Mongodb

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

ubuntu 简单安装 mongodb un nt

上一篇:数据结构(C语言版)严蔚敏:第三章:栈与队列---栈的应用---p52表达式求值的算法详细分析

下一篇:Multiple Ingress controllers(多ingress部署)

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》