Tuesday, October 6, 2015

Raspberry Pi 2 Model B Basic Configuration Part 1

The Raspberry Pi is a credit-card sized general purpose Linux computer designed and manufactured by the Raspberry Pi Foundation, a non-profit organization dedicated to making computers and programming instruction as accessible as possible to the widest number of people. Just recently I installed at home to play with it. There are already lots of resources available from Internet. This post and others are used to record all steps I did for making it useful to my daily work.

1. Install Raspberry Pi Software

After you hooked up power cable, HDMI cable, mouse and keyboard, you will see the following screen:
Choose Raspbian [RECOMMENDED] then click Install  on the right top corner. After around 25 minutes, OS will be installed successfully.


2. Run Raspberry Pi Software Configuration Tool

After you installed OS, the first time system will show you Raspberry Pi Software Configuration Tool to do some basic configuration such as change password, enable camera, etc.
The Raspberry Pi Software Configuration Tool
Also you can run the Raspberry Pi Software Configuration Tool whenever you want by running the following command after you logged into device:

sudo raspi-config


During installation, the screen will notify you, by default, the user name is pi and password is raspberry.


2. Enable SSH

From Raspberry Pi Software Configuration Tools Setup Option 8 Advanced Options:




After enabled SSH, you should be able to use SecreCRT or Putty this kind of tool to access it remotely. 

3. Enable Wireless

My package has a usb wireless card. Followed instruction below, I was able to enable it.

From SSH session, you can check your network configuration:

Linux raspberrypi 3.18.7-v7+ #755 SMP PREEMPT Thu Feb 12 17:20:48 GMT 2015 armv7l

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Mon Oct  5 00:54:54 2015 from 192.168.2.216
[email protected] ~ $ ifconfig






To scan for WiFi networks, use the command

[email protected] ~ $ sudo iwlist wlan0 scan
wlan0     Scan completed :
          Cell 01 - Address: C4:09:38:70:BB:DE
                    ESSID:"Bobby"
                    Protocol:IEEE 802.11bgn
                    Mode:Master
                    Frequency:2.437 GHz (Channel 6)
                    Encryption key:on
                    Bit Rates:144 Mb/s
                    Extra:wpa_ie=dd1c0050f20101000050f20202000050f2040050f20201000050f2020c00
                    IE: WPA Version 1
                        Group Cipher : TKIP
                        Pairwise Ciphers (2) : CCMP TKIP
                        Authentication Suites (1) : PSK
                    Extra:rsn_ie=30180100000fac020200000fac04000fac020100000fac020c00
                    IE: IEEE 802.11i/WPA2 Version 1
                        Group Cipher : TKIP
                        Pairwise Ciphers (2) : CCMP TKIP
                        Authentication Suites (1) : PSK
                    Quality=100/100  Signal level=100/100
          Cell 02 - Address: 84:94:8C:91:1D:28
                    ESSID:"Rogers02520"
                    Protocol:IEEE 802.11bgn
                    Mode:Master
                    Frequency:2.422 GHz (Channel 3)
                    Encryption key:on
                    Bit Rates:300 Mb/s
                    Extra:wpa_ie=dd1a0050f20101000050f20202000050f2020050f20401000050f202
                    IE: WPA Version 1
                        Group Cipher : TKIP
                        Pairwise Ciphers (2) : TKIP CCMP
                        Authentication Suites (1) : PSK
                    Extra:rsn_ie=30180100000fac020200000fac02000fac040100000fac020000
                    IE: IEEE 802.11i/WPA2 Version 1
                        Group Cipher : TKIP
                        Pairwise Ciphers (2) : TKIP CCMP
                        Authentication Suites (1) : PSK
                    IE: Unknown: DD270050F204104A000110104400010210470010BC329E00F1DD7F11B2F8600F84948C91103C000101
                    Quality=0/100  Signal level=42/100
          Cell 03 - Address: 84:94:8C:C3:73:E8
                    ESSID:"SnowWhite"
                    Protocol:IEEE 802.11bgn
                    Mode:Master
                    Frequency:2.412 GHz (Channel 1)
                    Encryption key:on
                    Bit Rates:300 Mb/s
                    Extra:rsn_ie=30180100000fac020200000fac02000fac040100000fac020000
                    IE: IEEE 802.11i/WPA2 Version 1
                        Group Cipher : TKIP
                        Pairwise Ciphers (2) : TKIP CCMP
                        Authentication Suites (1) : PSK
                    IE: Unknown: DD270050F204104A000110104400010210470010BC329E00F1DD7F11B2F8600F84948CC3103C000101
                    Quality=81/100  Signal level=44/100  

Adding your scanned wireless information to Raspberry Pi

Open the wpa-supplicant configuration file in nano:

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

Go to the bottom of the file and add the following:

network={
    ssid="Bobby"
    psk="password12345"
}

In a couple of seconds, your Pi will join into SSID you entered and got the ip address



[email protected] ~ $ ifconfig
eth0      Link encap:Ethernet  HWaddr b8:27:eb:1c:f4:ae
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:8 errors:0 dropped:0 overruns:0 frame:0
          TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:1104 (1.0 KiB)  TX bytes:1104 (1.0 KiB)

wlan0     Link encap:Ethernet  HWaddr 74:da:38:41:33:35
          inet addr:192.168.2.218  Bcast:192.168.2.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3767 errors:0 dropped:10 overruns:0 frame:0
          TX packets:816 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:553750 (540.7 KiB)  TX bytes:222808 (217.5 KiB)


4. Assign Static IP Address:


[email protected] ~ $sudo nano /etc/network/interfaces


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 default inet static
address 192.168.2.250
netmask 255.255.255.0
network 192.168.2.0
broadcast 192.168.2.255
gateway 192.168.2.1


Reference:

Installation Instructions for Raspberry Pi
How to Configure Your Raspberry Pi for Remote Shell, Desktop, and File Transfer
VNC (VIRTUAL NETWORK COMPUTING)








No comments:

Post a Comment