我的系统是Ubuntu 12.10, 官方文档:
http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/
首先添加key:
apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10
Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --secret-keyring /tmp/tmp.PJ6JkuPTDR --trustdb-name /etc/apt//trustdb.gpg --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg --keyserver keyserver.ubuntu.com --recv 7F0CEB10 gpg: requesting key 7F0CEB10 from hkp server keyserver.ubuntu.com gpg: keyserver timed out gpg: keyserver receive failed: keyserver error
所以需要通过SSH隧道出去:
ssh -fNL 11371:keyserver.ubuntu.com:11371 root@non-blocked-server -p 443 sudo apt-key adv --keyserver 127.0.0.1 --recv 7F0CEB10
上面的命令运行后,就建立了隧道,同时本机监听了11371端口。
然后再添加key:
apt-key adv --keyserver 127.0.0.1 --recv 7F0CEB10
现在添加成功:
--primary-keyring /etc/apt/trusted.gpg --keyserver 127.0.0.1 --recv 7F0CEB10 gpg: requesting key 7F0CEB10 from hkp server 127.0.0.1 gpg: key 7F0CEB10: public key "Richard Kreuter <[email protected]>" imported gpg: no ultimately trusted keys found gpg: Total number processed: 1 gpg: imported: 1 (RSA: 1)
里面的内容为:
echo "deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen" >> /etc/apt/sources.list.d/10gen.list
apt-get update
apt-get install mongodb-10gen
/etc/mongodb.conf
可以在其中看到数据库文件路径为:/var/lib/mongodb
日志文件路径:/var/log/mongodb/mongdb.log
服务脚本已经安装:
/etc/init.d/mongodb
mongodb已经自动启动,现在可以通过
service mongodb start|stop|restart 来控制了。
官方文档在:http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/
时不时去看一下,以防发生变化。