What is the command line to install mongodb?

453

Solution 1

You cannot install mongodb using:

apt-get install mongo

You need to execute following command to install mongodb on linux:

sudo apt-get install mongodb-server

Solution 2

To install mongodb run the commands:

sudo sh -c "echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' >> /etc/apt/sources.list"
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10
sudo apt-get update
sudo apt-get install mongodb-10gen

To test connection (wait at least 15 seconds to let the db start up), run the command below.

mongo

If the command exits with a error about not being able to connect, then reboot, and log back in as the admin user.

Sometimes MongoDB fails to create a network socket when it is started immediately after installation. It should automatically start

Share:
453

Related videos on Youtube

Seraph J. Lin
Author by

Seraph J. Lin

Updated on September 18, 2022

Comments

  • Seraph J. Lin
    Seraph J. Lin over 1 year

    I'd like to call a C++ function, and the function has another function as callback function.

    While in Objective-C, this is how I do:

    cpp.h
    
    typedef void (* FRAME_CALLBACK) (unsigned long, unsigned char *, unsigned long, long, long , VIDEO_B2_FRAME *);
    
    Handle MOpen( void );
    
    void MSetFrameCallback( Handle h, unsigned long param, FRAME_CALLBACK fnCallback );
    

    and then in the Objective-C code:

    objc.m
    
    Hnadle handle = MOpen();
    
    MSetFrameCallback(handle, (id)self, frameCallback);
    
    
    void frameCallback(id param, unsigned char *rawData, unsigned long dataLen, long width, long height, VIDEO_B2_FRAME *b2)
    {
        ViewController *VC = (ViewController *)param;
        [VC updateFrameWithData:rawData dataLen:dataLen width:width height:height];
    }
    

    But how should I do when this thing in the Swift code? I can't figure it out.

    I know if I want to use ObjC or C++ Class or function that I should create a bridging file. In that situation, it works fine, but the scenario above I have no idea.

    • imbaer
      imbaer about 11 years
      Are you using Ubuntu 12.04? Mongodb is a package in Ubuntu 12.10, not 12.04: packages.ubuntu.com/…
    • Mayura
      Mayura about 11 years
      Follow the proper instructions mentioned at docs.mongodb.org. Seems like you have skipped added/updated source.
    • Admin
      Admin about 11 years
      i am new in linux how to add this package in my system