溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點(diǎn)擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

ubuntu 簡單安裝 Mongodb

發(fā)布時(shí)間:2020-07-24 22:21:24 來源:網(wǎng)絡(luò) 閱讀:1067 作者:John966 欄目:MongoDB數(shù)據(jù)庫

 ubuntu 簡單安裝 Mongodb

系統(tǒng):ubuntu 12.04 x64

下面介紹最簡單的安裝方式

1.添加國內(nèi)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


安裝完成之后,自動(dòng)運(yùn)行mongod程序,查看是否運(yùn)行

pgrep mongo -l

800 mongod

進(jìn)入數(shù)據(jù)庫

mongo

MongoDB shell version: 2.0.4

connecting to: test

>exit

創(chuàng)建目錄

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

啟動(dòng)程序

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




向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI