1. 下载最新稳定版本的安装包。
[[email protected] mongodb]$ wget -c --no-check-certificate https://fossies.org/linux/misc/mongodb-linux-x86_64-3.2.11.tgz
2. 解压安装包。
[[email protected] mongodb]$ tar -zxvf mongodb-linux-x86_64-3.2.11.tgz
3. 设置环境变量。
[[email protected] ~]$ export PATH=/home/huey/mongodb/mongodb-linux-x86_64-3.2.11/bin:$PATH
4. 创建数据目录。
[[email protected] ~]$ mkdir -p ~/data/db
5. 启动服务。
[[email protected] ~]$ mongod --dbpath ~/data/db & [1] 16529 [[email protected] ~]$ 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
[[email protected] ~]$ mongo MongoDB shell version: 3.2.11 connecting to: test ... > 1 + 1 2 >
时间: 2024-10-04 18:17:31