Install and configure mongodb under linux Step 1: Download the file
For 32-bit linux$ curl http://downloads.mongodb.org/linux/mongodb-linux-i686-1.4.4.tgz > mongo .tgz$ tar xzf mongo.tgz for 64-bit linux$ curl http://downloads.mongodb.org/linux/mongodb-linux-x86_64-1.4.4.tgz > mongo.tgz$ tar xzf mongo.tgz
If you do not install curl First install apt-get install curl Step 2: Create a data folder By default, MongoDB will store data in /data/db/folder, this folder needs to be created manually. Created by:
$ adduser mongodb$ passwd mongodb$ sudo mkdir -p /data/db/$ sudo chown `id -u` /data/db$ chown -R mongodb:mongodb /data
Of course Specify the MongoDB to store data in a separate directory with the --dbpath command. Step 3: Let the database run in the console:
$ nohup ./mongodb-xxxxxxx/bin/mongod &$ ./mongodb-xxxxxxx/bin/mongo> db.foo.save( { a : 1 } ) > db.foo.find() or ./mongodb-linux-x86_64-1.4.4/bin/mongod
Add vim /etc/rc.local to the boot entry and add the following code to save:
#add mongonDB service/usr/local/webserver/mongodb/bin/mongod –dbpath /data/db –logpath /data/mongodb_log/mongodb.log –logappend –rest &
Note: Use mongo as a system command to make it available in any directory:
cp /usr/local/webserver/mongodb/bin/mongo /usr/bin/
Install MongoDB PHP
Extensions to download PHP extensions according to your own PHP version: http://github.com/mongodb/mongo-php-driver/downloads, tips: 1. VC6 is suitable for Apache and VC9 for IIS; 2. Thread safe is suitable for PHP to run with modules. The way, Non-thread safe is suitable for CGI operation. Modify php.ini, add: extension=php_mongo.dll, restart the web server.
Test with PHP program, success!
$conn = new Mongo("192.168.12.129:27017");$db = $conn->selectDB("test");//$db = $conn->test;$collection = $db->shicai;$rows = $collection->find();print_r($rows); exit;
Whether you are a Linux command line newbie or a veteran, these tips can help you improve, save time
This tutorial gives examples of how to provide messages/dialogs in Bash Shell scripts using tools l
#ls -l | Wc -l Note: The total usage also takes 1 row, so the statistics are 14 instead of 13 Other
I. Overview: Adding a program to the Linux kernel requires the following three tasks: 1. Copy the s
Usage of $(), $(()), and ${} in Shell
Linux server operating system: foreign + domestic
Linux command line literacy most basic command application
Find Out Server CPU Architecture(32 bit or 64 bit) in Linux
Linux How to prohibit root from using ssh to log in and modify ssh port
Linux to view memory commands and their interpretation of the command display
Df and du commands using basic tutorials
What is the difference between Linux process priority NI and PR?
20 years later, Microsoft finally fixed the Windows system BadTunnel vulnerability, including Win10
Windows 8 system is recognized by Steam platform players.
How to use winhex with winhex tutorial
Win10 Preview 9901 How to unlock the new time application
Win8.1 how to share Wifi Win8.1 set Wifi hotspot tutorial
Gulp error under Linux Error: What should I do with ENOSPC?
How to make English Windows8 system display Chinese documents normally
How to set transparent gradient on Windows7 desktop background?