0
votes

I am new to mongodb, cant understand how i can install MongoDB 3.2.3 in Ubuntu 14.04.

Also i have downloaded https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1404-3.2.3.tgz and extracted files from that directory, now how i can add it with php?

when i go to the bin directory and run mongod then this error occurs:

vagrant@vagrant-ubuntu-trusty-64:/vagrant/mongodb/mongodb/bin$ ./mongod

2016-02-23T16:59:47.366+0000 I CONTROL [initandlisten] MongoDB starting : pid=8246 port=27017 dbpath=/data/db 64-bit host=vagrant-ubuntu-trusty-64

2016-02-23T16:59:47.366+0000 I CONTROL [initandlisten] db version v3.2.3

2016-02-23T16:59:47.367+0000 I CONTROL [initandlisten] git version: b326ba835e1b70f6f31ece7937

2016-02-23T16:59:47.367+0000 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.1f 6 Jan 2014

2016-02-23T16:59:47.367+0000 I CONTROL [initandlisten] allocator: tcmalloc

2016-02-23T16:59:47.367+0000 I CONTROL [initandlisten] modules: none

2016-02-23T16:59:47.367+0000 I CONTROL [initandlisten] build environment:

2016-02-23T16:59:47.367+0000 I CONTROL [initandlisten] distmod: ubuntu1404

2016-02-23T16:59:47.368+0000 I CONTROL [initandlisten] distarch: x86_64

2016-02-23T16:59:47.368+0000 I CONTROL [initandlisten] target_arch: x86_64

2016-02-23T16:59:47.368+0000 I CONTROL [initandlisten] options: {}

2016-02-23T16:59:47.384+0000 E NETWORK [initandlisten] Failed to unlink socket file /tmp/mongodb- 27017.sock errno:1 Operation not permitted

2016-02-23T16:59:47.384+0000 I - [initandlisten] Fatal Assertion 28578

2016-02-23T16:59:47.385+0000 I - [initandlisten]

***aborting after fassert() failure

4

4 Answers

1
votes

we first have to import they key for the official MongoDB repository.

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10

After successfully importing the key you will see:

gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)

Next, we have to add the MongoDB repository details so APT will know where to download the packages from.

Issue the following command to create a list file for MongoDB.

echo "deb http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list

After adding the repository details, we need to update the packages list.

sudo apt-get update

Now we can install the MongoDB package itself.

sudo apt-get install -y mongodb-org

After package installation MongoDB will be automatically started. You can check this by running the following command.

service mongod status

If MongoDB is running, you'll see an output like this (with a different process ID).

mongod start/running, process 1611

You can also stop, start, and restart MongoDB using the service commands. To stop MongoDB use

service mongod stop

To start MongoDB use

service mongod start
0
votes

It can be done more easily using MongoDB apt repository: Run this commands on the terminal:

  1. sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927
  2. echo "deb http://repo.mongodb.org/apt/debian wheezy/mongodb-org/3.2 main" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list
  3. sudo apt-get update
  4. sudo apt-get install -y mongodb-org=3.2.3 mongodb-org-server=3.2.3 mongodb-org-shell=3.2.3 mongodb-org-mongos=3.2.3 mongodb-org-tools=3.2.3
0
votes

**** in your home create folder

mkdir mongodb

cd mongodb

curl -O https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.2.3.tgz

tar -xvzf mongodb-linux-x86_64-3.2.3.tgz

cd /opt

sudo mkdir mongodb

cd mongodb/

sudo cp -R ~/mongodb/mongodb-linux-x86_64-3.2.3/* .

*****dot (.) for current folder

cd /var/lib

sudo mkdir mongodb

****now try mongodb by running mongod in opt/mongodb/bin folder

cd /opt/mongodb/bin

sudo ./mongod --dbpath /var/lib/mongodb

0
votes

Alternatively, instead of cluttering the OS and dealing with file(dependency) management manually, try using the docker container.

  1. Install docker

  2. Start a container, listening on the default port, 27017, directly:
    docker run --net=host --name some-mongo -d mongo

  3. You can pass all the regular mongod command line parameters after -d mongo as well as the version, i.e.:

    docker run --net=host --name some-mongo -d mongo --storageEngine wiredTiger --smallfiles --auth ...