Install MongoDB in Ubuntu and how to start it by yourself

Source: Internet
Author: User
Tags install mongodb
The Mongodb database is installed under Ubuntu13.10. Now write down the installation method and the automatic start method:

I installed the Mongodb database in Ubuntu 13.10. Now I want to write down the installation method and the automatic start method:

I installed the Mongodb database in Ubuntu 13.10. Now I want to write down the installation method and the automatic start method:

1. apt-get update Software 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/mongodb
Vi/etc/init. d/mongodb
DATA =/www/mongodb
Mkdir/www/mongodb/
Chown-R mongodb: nogroup/www/mongodb/

4. Start Mongodb
/Etc/init. d/mongodb start, which is started by default at the beginning. You do not need this step.

5. Check whether the startup is successful.
Netstat-antup
Cat/var/log/mongodb. log

6. Test the mongo client.
Mongo
Db. foo. save ({a: 1 })
Db. foo. findOne ()

7. The Mongodb service is automatically started in the background.

Enter/usr/bin/and enter the following command:
./Mongod -- dbpath/var/lib/mongodb/-- logpath/var/log/mongodb. log -- logappend &
Background running program

At this step, the Mongodb database has been installed.

Note:

How can I enable Mongodb extension in PHP?
1. install php mongo
Sudo pecl install mongo
2. Enable the module
Vi/etc/php5/cli/conf. d/mongodb. ini
Extension = mongo. so
3. Check whether the installation is successful.
Php-m
4. Restart Apache

Complete.

Related reading:

Set MongoDB to boot automatically in Linux

CentOS compilation and installation of MongoDB

CentOS compilation and installation of php extensions for MongoDB and mongoDB

CentOS 6 install MongoDB and server configuration using yum

Install MongoDB2.4.3 in Ubuntu 13.04

MongoDB beginners must read (both concepts and practices)

MongoDB authoritative Guide (The Definitive Guide) in English [PDF]

MongoDB details: click here
MongoDB: click here

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.