Tuesday, 29 December 2015

Install LAMP on Linux

Following is the step by step procedure to install Apache MySQL and PHP on Linux.Together these are called LAMP.

First of all you need to make sure that you are logged in as the root user.

#apt-get install update #apt-get install apache2

Install php using following command.

#apt-get install php5 libapache2-mod-php5

After installation, you need to make certain changes as follows.

#gedit /var/www/html/phpinfo.php

Next step is to install mysql-server.

#apt-get install mysql-server

During the installation there will be several prompts.

set the password for MYSQL “root” user.
#apt-get install libapache2-mod-auth-mysql php5-mysql phpmyadmin

select the server as apache2 when prompted.
again there will be prompts for password ; make it the same as before
There are few changes to make in the configuration file apache2.conf

#echo -e “\nInclude /etc/phpmyadmin/apache.conf” >>/etc/apache2/apache2.conf

And you are all set to create your php website.

Arduino in Linux : Some common errors

I wanted to run Arduino IDE in ubuntu 14.04. Though it earlier looked simple but while I wrote a simple blinky program following error occured.
avrdude: ser_open() : can’t open device “/dev/ttyUSB0” : Permission Denied 
ioctl(“TIOCMGET”): Inappropriate ioctl for device
Note the device name “/dev/ttyUSB0” is a kind of module that caters to the connectivity and serial communication of the arduino board here.

So I began googling and after few searches I found the solution for the problem.

On the command line I wrote:
~$sudo usermod -a -G dialout <username>
~$sudo chmod a+rw /dev/ttyUSB0
where <username> is the name of your username in ubuntu. 

Send File via Bluetooth in Linux

A simple way to transfer file in Linux :

1. Search for the devices :

~$hcitool scan

Scanning …
CC:FE:3C:FB:91:8D Arun
64:27:37:D9:4B:34 VIPUL

Make sure that your bluetooth device is ON. I wanted to send an image “left.png” to “Arun” with Bluetooth unique address as CC:FE:3C:FB:91:8D

2. Check for the services available on the device:

~$sdptool search OPUSH CC:FE:3C:FB:91:8D

Inquiring …
Searching for OPUSH on 64:27:37:D9:4B:34 …
Searching for OPUSH on CC:FE:3C:FB:91:8D …
Service Name: Object Push
Service RecHandle: 0x10003
Service Class ID List:
“OBEX Object Push” (0x1105)
Protocol Descriptor List:
“L2CAP” (0x0100)
“RFCOMM” (0x0003)
Channel: 3
“OBEX” (0x0008)
Profile Descriptor List:
“OBEX Object Push” (0x1105)
Version: 0x0102

We’ll be using OBEX service for “OBject Exchange” via channel 3.

3. Install obexftp utility :

~$sudo apt-get install obexftp

4. Finally, send the file:

~$obexftp –nopath –noconn –uuid none –bluetooth CC:FE:3C:FB:91:8D –channel 3 -p left.png
Suppressing FBS.
Connecting..\done
Tried to connect for 104ms
Sending “left.png”…-done
Disconnecting..\done

Windows’ drives access in Ubuntu

 Accessing windows drives in Ubuntu:
1. Create a folder say ‘sample’ in the home directory.
2. On the terminal type: ‘ sudo mount /dev/sda2 sample.
3. The drives in windows are named as ‘sdax’ in Linux system. To know the drives type in the following command: ‘sudo blkid’.
4. Now you can access the drives by opening the ‘sample’ folder.

Simple USB Charger

Ever found a broken USB cable and wondered what to do with it?Well I found one and tried to find what could be done. When you hack into the internal structure of the USB cable, you find out four wires. Two of them (usually green and white) are data lines D+ and D- . The other two (usually red and black) are power and ground lines respectively. For making USB charger the data lines are not required. All we need to do is just take these wires and connect them to a 6-9V battery in reverse polarity. Happy charging!