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
su - ## OR ## sudo -i
/etc/yum.repos.d/10gen-mongodb.repo [10gen] name=10gen Repository baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/i686 gpgcheck=0
yum install mongo-10gen mongo-10gen-server
vi /etc/mongod.conf logpath=/var/log/mongo/mongod.log port=27017 dbpath=/var/lib/mongo
service mongod start ## OR ## /etc/init.d/mongod start
chkconfig --levels 235 mongod on
mongo use test switched to db test db.foo.find() db.foo.save({a: 1}) db.foo.find()
/etc/sysconfig/iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 27017 -j ACCEPT
service iptables restart ## OR ## /etc/init.d/iptables restart
mongo server:port/database ## Example ## mongo 10.0.10.45:27017/test
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
原文地址:centos 下安装 mongodb 小纸条, 感谢原作者分享。