Home > Database > Mysql Tutorial > body text

Ubuntu下单机安装MongoDB并测试

WBOY
Release: 2016-06-07 17:05:51
Original
1025 people have browsed it

1.下载mongodb-linux-i686-1.8.2.tgz放在目录/home/nh/Downloads/下并解压得到mongodb-linux-i686-1.8.22.在/home/nh/Downloads/

1.下载mongodb-linux-i686-1.8.2.tgz放在目录/home/nh/Downloads/下并解压得到mongodb-linux-i686-1.8.2

2.在/home/nh/Downloads/mongodb-linux-i686-1.8.2下新建目录data1, 在 /home/nh/Downloads/mongodb-linux-i686-1.8.2/log1目录下新建文件log1.log 

3.@linuxidc:~/Downloads/mongodb-linux-i686-1.8.2/bin$ ./mongod -dbpath /home/nh/Downloads/mongodb-linux-i686-1.8.2/data1 -logpath /home/nh/Downloads/mongodb-linux-i686-1.8.2/log1/log1.log

4.@linuxidc:~/Downloads/mongodb-linux-i686-1.8.2/bin$ ./mongo 55Ubuntu:27017(在另一个命令行窗口中执行该命令,55ubuntu是你的主机名)

5.> db.test.save({a:1})(在shell中执行)

6.> db.test.findOne()(查看刚才的保存的文档{a: 1},会出现一下结果,说明可用)
{ "_id" : ObjectId("4e8ff5cd7a348a89a3b2dc3f"), "a" : 1 }

linux

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!