MongoDB installation in Ubuntu 14.04

We’ll be seeing how to install MongoDB and get it working with PHP.

If you had followed the step of installing mongo PECL extension you can undo it by doing the following, as this will be provided by the php5-mongo package, including the required changes in the php configuration, which we’ll be installing shortly afterwards.

  • Removing any entry in the php.ini file that you made for mongo extension.
  • Remove the PECL extension by:
sudo pecl uninstall mongo

Now do the following steps to complete the installation:

sudo apt-key adv --keyserver hkp:// --recv 7F0CEB10
echo "deb "$(lsb_release -sc)"/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list
sudo apt-get update

sudo apt-get install -y mongodb-org
sudo apt-get install php5-mongo

After this restart your computer, only after that the MongoClient class will be available for use.


How to get an undetected android phone mounted in Ubuntu 14.04

Usually for the older Android phones, Ubuntu 14.04 detects the devices out-of-the-box in most cases, but for some recent devices that is not the case. If you’re one of those guys like me, who had tried to connect your Android phone to Ubuntu 14.04, and didn’t see any reaction in the Ubuntu File Manager(Nautilus), worry no more, there is a solution to this.

First find the device as detected by Linux’s USB system, by using the following command:

$ lsusb

See the sample output below:

saji@geeklap:~$ lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 003: ID 0bda:0139 Realtek Semiconductor Corp. 
Bus 001 Device 004: ID 0489:e00d Foxconn / Hon Hai 
Bus 002 Device 003: ID 04f2:b272 Chicony Electronics Co., Ltd Lenovo EasyCamera
Bus 002 Device 011: ID 05c6:9039 Qualcomm, Inc. 

The line that is of interest to us is the bottom-most one(in this case), which is the Android phone:

Bus 002 Device 011: ID 05c6:9039 Qualcomm, Inc.

In the sample, the device is a Yu Yureka (AO5510). Usually you can make out the device entry from the listed name. In the output the most relevant part is: 05c6:9039

Of that, 05c6 is the Vendor id and 9039 is the Product id.

We now have to create the file: /lib/udev/rules.d/69-mtp.rules with the following content:

# Yu Yureka
ATTR{idVendor}=="05c6", ATTR{idProduct}=="9039", SYMLINK+="libmtp-%k", ENV{ID_MTP_DEVICE}="1", ENV{ID_MEDIA_PLAYER}="1"

The line starting with the hash(#) is a comment, so you can out any descriptive, understandable line there. Depending on your device, the Vendor id and the Product id will differ, just use the relevant values to create this file. Now disconnect and reconnect your device.

Presto! The device should now be shown in the File manager.

The android device has now been detected in the file manager.

Android phone detected in file manager

Note: If it still does not work for you, try enabling the USB debug option, in the Developer Tools Menu of your android phone. I have already enabled it to get my phone detected properly.