O'Reilly logo

PHP and MongoDB Web Development by Rubayeet Islam

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action - downloading and running MongoDB on Linux

Now, we are going to learn how to download and run the MongoDB server on a Linux box:

  1. Fire up the terminal program. Type in the following command and hit Enter
    wget http://fastdl.mongodb.org/linux/mongodb-linux-i686-1.8.3.tgz > mongo.tgz
    
    
  2. Extract the downloaded archive by using the following command:
    tar xzf mongo.tgz
    
    
  3. Rename the extracted directory by using the following command:
    mv mongodb-linux-i686-1.8.3 mongodb
    
    
  4. Create the data directory /data/db by using the following command:
    sudo mkdir -p /data/db
    sudo chown `id -u` /data/db
    
  5. Startup the server by running the following command:
    ./mongodb/bin/mongod
    
    
  6. Open another tab in the terminal and run the next command:
    ./mongodb/bin/mongo
    
    
  7. Type

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required