Installation and self-startup method under Mongodb Ubuntu
Today, I took some time to install the Mongodb database under Ubuntu 13.10. Now I write down the installation operation method and the automatic startup method:
1. apt-get update Update Library 2. apt-get install mongodb
3. After installation, you need to modify the relevant configuration file to modify the data storage path
vi /etc/mongodb.conf dbpath=/www/mongodbvi /etc/init.d/mongodb DATA=/www/mongodbmkdir /www/mongodb/ chown -R mongodb:nogroup /www/mongodb/
4. Start Mongodb
/etc/init.d/mongodb start,
It is started by default when it is installed at the beginning. This step is not required.
5. Confirm if startup is successful
netstat -antup cat /var/log/mongodb/mongodb.log
6. Testing the mongo client
mongo db.foo.save({a:1}) db.foo.findOne()
7. Operation Mongodb service background automatic start
Enter the following command under/usr/bin/
./ mongod --dbpath /var/lib/mongodb/ --logpath /var/log/mongodb/mongodb.log --logappend &
background running program
At this point, the Mongodb database is installed.
Additional information:
How to open Mongodb extensions in PHP?
1. Install php mongo
sudo pecl install mongo
2. enablement module
vi /etc/php5/cli/conf.d/mongodb.ini
extension=mongo.so
3. Confirm successful installation
php -m
4. restart Apache
Done!