Setting up wifi



  1. Open terminal and ssh into your pi or connect your pi to a monitor and keyboard.


  2. Open the /etc/network/interfaces file
        sudo nano /etc/network/interfaces



  3. Change the file to the following::
     auto lo
    
    iface lo inet loopback
    iface eth0 inet dhcp
    
    allow-hotplug wlan0
    iface wlan0 inet manual
    wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
    
    iface school inet static
    address <school address>
    gateway <school gateway>
    netmask <school netmask>
    
    iface home inet static
    address <home address>
    gateway <home gateway>
    netmask <home netmask>
     



  4. CTRL+X,Y,RETURN


  5. Open the wpa_supplicant.conffile
    sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
            



  6. Add the following:
        ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
    update_config=1
    network={
        ssid="SCHOOLS NETWORK NAME"
        psk="SCHOOLS PASSWORD"
        proto=WPA
        key_mgmt=WPA-PSK 
        pairwise=TKIP
        auth_alg=OPEN
        id_str="school"
    }
    
    network={
        ssid="HOME NETWORK NAME"
        psk="HOME PASSWORD"
        proto=WPA
        key_mgmt=WPA-PSK 
        pairwise=TKIP
        auth_alg=OPEN
        id_str="home"
    }
            



  7. CTRL+X,Y+RETURN


  8. Avahi comes installed on the Raspberry Pi. But update before you do anything:
    sudo apt-get update 



  9. "Zeroconf is 'a set of techniques that automatically creates a usable Internet Protocol (IP) network without manual operator intervention or special configuration servers.'

    Avahi is an implementation of zeroconf which 'ships with most Linux and *BSD distributions', but not the Pi's Debian distro. Zeroconf will be familiar to Apple users as Bonjour, and is pretty clever tech which means that things Just Work when sharing stuff across computers on a network. In this context, it means that once [you've] set it up on the Pi, [you'll] be able to address it as:
    raspberrypi.local

    regardless of what IP address it's been assigned on your local network. This is handy if its IP is likely to change regularly, and even means we'll continue to be able to address it if we're on a different network (say, shuffling between home & work networks)."

    Install avahi with the following commands on the Pi:
    sudo apt-get install avahi-daemon
    



  10. Type:
    sudo insserv avahi-daemon



  11. Create a config file for Avahi at /etc/avahi/services/multiple.service. I did this with the following command:
    sudo nano /etc/avahi/services/multiple.service



  12. The contents of this file should be something like the following, courtesy of aXon on the Rasperry Pi forums:
    <?xml version="1.0" standalone='no'?>
    <!DOCTYPE service-group SYSTEM "avahi-service.dtd">
    <service-group>
            <name replace-wildcards="yes">%h</name>
            <service>
                    <type>_device-info._tcp</type>
                    <port>0</port>
                    <txt-record>model=RackMac</txt-record>
            </service>
            <service>
                    <type>_ssh._tcp</type>
                    <port>22</port>
            </service>
    </service-group>



  13. CTRL+X, Y, RETURN


  14. Restart Avahi to apply the new configuration
    sudo /etc/init.d/avahi-daemon restart



  15. The Pi should now be addressable from other machines as raspberrypi.local, for example:
    ssh pi@raspberrypi.local


  16. Create a config file for Avahi You need to open the config file
        sudo nano /etc/avahi/avahi-daemon.conf
            



  17. Navigate to where you see [server]. Uncomment #host-name=foo and set the host-name to something that makes sense
       host-name=liz-pi
            



  18. Press CTRL+X, Y and RETURN


  19. Shutdown


  20. Install Wireless module and restart.


  21. I'm using IP Scanner to find my pi. If all went well I should find li pi, an IP and a mac address.


  22. You should be able to now log in like this:
       ssh pi@liz-pi.local
            



  23. If you try to log in and see:
    offending_key.png Do this:

      # perl -pi -e 's/\Q$_// if ($. == 6);' ~/.ssh/known_hosts
            

    Change the number to the line number shown in the message





Transfering Files

You can use SFTP to transfer content to the Pi.

Download FileZilla onto your computer as your SFTP client.

  1. Open the application


  2. Click File > Site Manager


  3. In the General tab fill out the relevant connection details:
    • Host:ip of your pi
    • Protocol: select SFTP-SSH File Transfer Protocol
    • Logon Type: set to normal
    • User: specify the user (pi)
    • Password: Specify the current password for the chosen account



  4. Click connect


  5. Navigate to /var/www


  6. Drag and drop any ontent into the target pi directory in FileZilla


  7. Click Disconnect on the toolbar to end the session