首頁  >  文章  >  資料庫  >  centos 下安装 mongodb 小纸条

centos 下安装 mongodb 小纸条

WBOY
WBOY原創
2016-06-07 16:32:44982瀏覽

change to root su - ## OR ## sudo -i add yum repo /etc/yum.repos.d/10gen-mongodb.repo [10gen] name=10gen Repository baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/i686 gpgcheck=0 install mongodb yum install mongo-10gen mongo-10

change to root

su - ## OR ## sudo -i

add yum repo

/etc/yum.repos.d/10gen-mongodb.repo [10gen] name=10gen Repository baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/i686 gpgcheck=0

install mongodb

yum install mongo-10gen mongo-10gen-server

Configure MongoDB

vi /etc/mongod.conf logpath=/var/log/mongo/mongod.log port=27017 dbpath=/var/lib/mongo

Start MongoDB Server

service mongod start ## OR ## /etc/init.d/mongod start

Start MongoDB on boot

chkconfig --levels 235 mongod on

Test MongoDB Server

mongo use test switched to db test db.foo.find() db.foo.save({a: 1}) db.foo.find()

Open MongoDB Port (27017) on Iptables Firewall

/etc/sysconfig/iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 27017 -j ACCEPT

Restart Iptables Firewall

service iptables restart ## OR ## /etc/init.d/iptables restart

Test remote connection

mongo server:port/database ## Example ## mongo 10.0.10.45:27017/test

nodejs

cd ~ wget https://raw.github.com/isaacs/nave/master/nave.sh chmod +x nave.sh ./nave.sh install 0.10.21 ./nave.sh use 0.10.21 node -v

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn