Once again I have to setup my pi. Because I mainly use it in headless config its quite annoying to connect it to display for setup. So anyone else having same trouble here is a small tutorial how to setup you Raspberry pi sd card for running pi headlessly with wifi. No need for monitors or keyboards on pi.

After configuring your sd card you just connect the power and ssh into your pi.

 

  1.  Download Raspbian Jessie Lite from: https://www.raspberrypi.org/downloads/raspbian/
  2. Format your micro SD card into FAT32 .
  3. Extract the .zip of Raspbian Jessie Lite.
  4. Install the .img file onto your clean micro SD card. ( I use default Linux Disks tool)
  5. Open SD card Linux partition and open file: /etc/network/interfaces
    After editing the content should look like:

    auto lo
    iface lo inet loopback
    
    allow-hotplug eth0
    iface eth0 inet dhcp
    
    allow-hotplug wlan0
    iface wlan0 inet manual
        wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
        post-up ifdown eth0
    allow-hotplug wlan1
    iface wlan1 inet manual
        wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
        post-up ifdown eth0

     

  6.  Content of  /etc/wpa_supplicant/wpa_supplicant.conf :
    ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
    update_config=1
    
    network={
        ssid="YOUR_SSID_HERE"
        psk="YOUR_SECRET_PASSPHRASE_HERE"
        id_str="SOME_DESCRIPTIVE_NAME"
    }

     

  7.  Place a file named ‘ssh’, without any extension, onto the boot partition of the SD card. When the Pi boots, it looks for the ‘ssh’ file; if it is found, SSH is enabled and then the file is deleted. The content of the file doesn’t matter: it could contain either text or nothing at all.
  8.  Insert the microSD card to pi and power the pi.(Pi should automatically connect to your wifi network).
  9. Open terminal and ssh pi@[your pi-s ip] examp: ssh pi@192.168.1.10  You can check your pi-s ip address from routers settings/info page.

*Tutorial on Linux version 4.4.50/ Raspbian v. 8 (jessie)