MongoDB - Installing MongoDB on Linux
1. 下载最新稳定版本的安装包。
[huey@huey mongodb]$ wget -c --no-check-certificate https://fossies.org/linux/misc/mongodb-linux-x86_64-3.2.11.tgz
2. 解压安装包。
[huey@huey mongodb]$ tar -zxvf mongodb-linux-x86_64-3.2.11.tgz
3. 设置环境变量。
[huey@huey ~]$ export PATH=/home/huey/mongodb/mongodb-linux-x86_64-3.2.11/bin:$PATH
4. 创建数据目录。
[huey@huey ~]$ mkdir -p ~/data/db
5. 启动服务。
[huey@huey ~]$ mongod --dbpath ~/data/db & [1] 16529 [huey@huey ~]$ 2016-11-30T11:01:24.214+0800 I CONTROL [initandlisten] MongoDB starting : pid=16529 port=27017 dbpath=/home/huey/data/db 64-bit host=huey 2016-11-30T11:01:24.215+0800 I CONTROL [initandlisten] db version v3.2.11 2016-11-30T11:01:24.215+0800 I CONTROL [initandlisten] git version: 009580ad490190ba33d1c6253ebd8d91808923e4 2016-11-30T11:01:24.215+0800 I CONTROL [initandlisten] allocator: tcmalloc ......
6. 运行 MongoDB Shell
[huey@huey ~]$ mongo MongoDB shell version: 3.2.11 connecting to: test ... > 1 + 1 2 >