下载地址
http://www.mongodb.org/downloads
下载
curl -O -L https://fastdl.mongodb.org/linux/mongodb-linux-i686-3.0.2.tgz
解压安装
tar -xvzf mongodb-Liunix-xxxxx.tgz mv mongodb-linux-i686-3.0.2 /usr/local/mongodb
创建目录
mkdir /usr/local/mongodb/data mkdir /usr/local/mongodb/data/mongodb_log touch /usr/local/mongodb/data/mongodb_log/mongodb.log
启动脚本
./mongod --dbpath=/usr/local/mongodb/data/mongodb_data/ --logpath=/usr/local/mongodb/data/mongodb_log/mongodb.log --logappend&
报错,如下操作:
./mongod: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory yum whatprovides libstdc++.so.6 Loaded plugins: security libstdc++-4.4.7-16.el6.i686 : GNU Standard C++ Library Repo : base Matched from: Other : libstdc++.so.6 yum install libstdc++-4.4.7-16.el6.i686
安装完成,再运行
./mongod --dbpath=/usr/local/mongodb/data/mongodb_data/ --logpath=/usr/local/mongodb/data/mongodb_log/mongodb.log --logappend& ./mongo MongoDB shell version: 3.0.2 connecting to: test
成功了
测试
netstat -lanp | grep "27017"
tcp 0 0 0.0.0.0:27017 0.0.0.0:* LISTEN 19556/./mongod unix 2 [ ACC ] STREAM LISTENING 131807 19556/./mongod /tmp/mongodb-27017.sock
访问
http://127.0.0.1:27017/
时间: 2024-11-05 15:17:09