Karena sering kali lupa saat meng-install ulang Raspberry Pi, jadi tulisan kali ini akan membahas cara meng-install Raspbian Jessie dan setting WiFi pada Raspberry Pi 3.
Download Raspbian Jessie
OS Raspbian Jessie dapat didownload di website resmi Raspberry Pi yaitu di link berikut ini https://www.raspberrypi.org/downloads/raspbian/. Dalam contoh berikut ini, saya menggunakan OS yang dirilis pada 2016-05-27. Sedangkan Operating System laptop yang saya gunakan adalah Ubuntu 14.04 (perlu diupdate sebenarnya).
Unzip Raspbian Jessie yang telah didownload
Setelah proses download selesai, langkah berikut adalah mengekstrak Raspbian Jessie, seperti pada contoh di bawah ini (pastikan direktori terminal anda berada di direktori yang sama dengan Raspbian Jessie)
wawan@wawan-HP:/media/wawan/C89EB1DD9EB1C46A/0. WAWAN$ unzip 2016-05-27-raspbian-jessie.zip
Archive: 2016-05-27-raspbian-jessie.zip
inflating: 2016-05-27-raspbian-jessie.img
Menulis Raspbian Jessie pada microSD
Sebelum menuliskan pada microSD, pastikan anda mengetahui nama dari microSD yang terbaca di laptop anda menggunakan perintah lsblk.
wawan@wawan-HP:/media/wawan/C89EB1DD9EB1C46A/0. WAWAN$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 465.8G 0 disk
├─sda1 8:1 0 199M 0 part
├─sda2 8:2 0 287.8G 0 part /media/wawan/C89EB1DD9EB1C46A
├─sda3 8:3 0 923M 0 part
├─sda4 8:4 0 1K 0 part
├─sda5 8:5 0 15.6G 0 part [SWAP]
├─sda6 8:6 0 51.9G 0 part /
└─sda7 8:7 0 109.4G 0 part /home
sr0 11:0 1 1024M 0 rom
mmcblk0 179:0 0 7.4G 0 disk
└─mmcblk0p1 179:1 0 7.4G 0 part
Seperti yang terlihat pada contoh di atas, microSD terbaca dengan nama mmcblk0 dengan ukuran 7.4G. Kemudian lanjutkan dengan menuliskan Raspbian Jessie pada microSD menggunakan perintah dd.
wawan@wawan-HP:/media/wawan/C89EB1DD9EB1C46A/0. WAWAN$ sudo dd bs=4M if=./2016-05-27-raspbian-jessie.img of=/dev/mmcblk0
[sudo] password for wawan:
1004797952+0 records in
1004797952+0 records out
4019191808 bytes (4.0 GB) copied, 1930.91 s, 2.1 MB/s
Setelah penulisan pada microSD telah selesai, keluarkan microSD anda dari laptop kemudian masukkan kembali pada laptop anda dan jalankan perintah lsblk lagi.
wawan@wawan-HP:/media/wawan/C89EB1DD9EB1C46A/0. WAWAN$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 465.8G 0 disk
├─sda1 8:1 0 199M 0 part
├─sda2 8:2 0 287.8G 0 part /media/wawan/C89EB1DD9EB1C46A
├─sda3 8:3 0 923M 0 part
├─sda4 8:4 0 1K 0 part
├─sda5 8:5 0 15.6G 0 part [SWAP]
├─sda6 8:6 0 51.9G 0 part /
└─sda7 8:7 0 109.4G 0 part /home
sr0 11:0 1 1024M 0 rom
mmcblk0 179:0 0 7.4G 0 disk
├─mmcblk0p1 179:1 0 63M 0 part /media/wawan/boot
└─mmcblk0p2 179:2 0 3.7G 0 part /media/wawan/2f840c69-cecb-4b10-87e4-0
Seperti yang terlihat di atas, mmcblk0 terbagi menjadi dua partisi yang pertama 63M dan 3.7G. Jika kalian sadar akan hasil di atas bahwa sekitar 3.7G tidak terbaca pada microSD. Tapi tidak perlu khawatir, cukup lanjutkan saja pada tahap berikutnya dari tutorial ini.
SSH ke Raspberry Pi
Pastikan anda sudah memasukkan microSD ke Raspberry Pi dan kabel LAN juga pastikan sudah terhubung pada router anda.
Dari terminal anda, dengan menggunakan perintah hostname, cek ip address dari laptop anda seperti pada contoh di bawah ini,
wawan@wawan-HP:~$ hostname -I
192.168.10.102
Kemudian gunakan perintah nmap untuk menemukan ip address dari Raspberry Pi. (untuk menginstall nmap cukup dengan mengetik sudo apt-get install nmap di terminal anda).
wawan@wawan-HP:~$ nmap -p 22 192.168.10.*
Starting Nmap 6.40 ( http://nmap.org ) at 2016-07-18 04:03 JST
Nmap scan report for aterm.me (192.168.10.1)
Host is up (0.015s latency).
PORT STATE SERVICE
22/tcp closed ssh
Nmap scan report for 192.168.10.102
Host is up (0.000097s latency).
PORT STATE SERVICE
22/tcp open ssh
Nmap scan report for 192.168.10.108
Host is up (0.021s latency).
PORT STATE SERVICE
22/tcp open ssh
Nmap done: 256 IP addresses (3 hosts up) scanned in 15.82 seconds
Seperti terlihat pada contoh di atas, terdapat tiga ip address dimana salah satunya yakni 192.168.10.108 adalah milik Raspberry Pi. Untuk konek ke Raspberry Pi menggunakan perintah ssh, perhatikan contoh di bawah ini.
wawan@wawan-HP:~$ ssh pi@192.168.10.108
The authenticity of host '192.168.10.108 (192.168.10.108)' can't be established.
ECDSA key fingerprint is a5:fc:0f:e4:8f:a4:15:46:b3:02:a6:75:77:fb:cb:d1.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.10.108' (ECDSA) to the list of known hosts.
pi@192.168.10.108's password:
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: Fri May 27 11:50:36 2016
pi@raspberrypi:~ $
Jangah lupa username adalah pi dan password adalah raspberry. Seperti terlihat dari contoh di atas, akhirnya akses dari Raspberry Pi berhasil didapat.
Cek ukuran atau kapasitas dari microSD
Seperti pada contoh sebelumnya, kita akan menggunakan perintah lsblk untuk mengetahui kapasitas dari microSD.
pi@raspberrypi:~ $ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
mmcblk0 179:0 0 7.4G 0 disk
|-mmcblk0p1 179:1 0 63M 0 part /boot
`-mmcblk0p2 179:2 0 7.3G 0 part /
Pada contoh sebelumnya, mmcblk0 hanya berukuran 3.7G tapi pada hasil di atas kembali menjadi 7.3G. Ini menunjukkan bahwa secara default Raspbian Jessie akan meng-expand kapasitas microSD.
Setting WiFi pada Raspberry Pi 3
Sebelum ke pengaturan WiFi, ketika kita menjalankan perintah hostname, kita akan mendapatkan satu ip address yang berati bahwa kita sedang terhubung hanya dengan kabel LAN.
pi@raspberrypi:~ $ hostname -I
192.168.10.108
Langkah selanjutnya yaitu masukkan nama SSID dari WiFi yang anda tuju beserta password-nya seperti pada contoh di bawah ini.
pi@raspberrypi:~ $ wpa_passphrase wawan-local wawan-password | sudo tee -a /etc/wpa_supplicant/myoffice.conf
network={
ssid="wawan-local"
#psk="wawan-password"
psk=481b9332ec690b74a36612b448ed0830c2ea5dfd45c48af08c6cb72d1a6d2ca7
}
Setelah menjalankan perintah seperti pada contoh di atas, buka file /etc/network/interfaces dan modifikasi seperti pada contoh di bawah ini
pi@raspberrypi:~ $ sudo nano /etc/network/interfaces
File interfaces sebelum dimodifikasi dan sesudah dimodifikasi akan tampak seperti di bawah ini.
SEBELUM:
# interfaces(5) file used by ifup(8) and ifdown(8)
# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'
# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d
auto lo
iface lo inet loopback
iface eth0 inet manual
allow-hotplug wlan0
iface wlan0 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
allow-hotplug wlan1
iface wlan1 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
SESUDAH:
# interfaces(5) file used by ifup(8) and ifdown(8)
# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'
# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d
auto lo
iface lo inet loopback
iface eth0 inet manual
allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa_supplicant/myoffice.conf
allow-hotplug wlan1
iface wlan1 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
kemudian restart network anda agar dapat terhubung ke SSID dari WiFi yang anda tuju.
pi@raspberrypi:~ $ sudo service networking restart
pi@raspberrypi:~ $ hostname -I
192.168.10.108
Jika setelah restart network namun masih tidak terhubung, coba reboot Raspberry Pi anda dan konek kembali dengan ssh via kabel LAN.
pi@raspberrypi:~ $ sudo reboot
wawan@wawan-HP:~ $ ssh pi@192.168.10.108
pi@192.168.10.108's password:
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: Sun Jul 17 19:27:16 2016
pi@raspberrypi:~ $ hostname -I
192.168.10.108 192.168.10.115
Jika dengan menggunakan hostname muncul dua ip address seperti contoh di atas, ini berarti setting WiFi pada Raspberry Pi 3 anda telah berhasil.
Sekian dulu.
wawan@wawan-HP:/media/wawan/C89EB1DD9EB1C46A/0. WAWAN$ unzip 2016-05-27-raspbian-jessie.zip
Archive: 2016-05-27-raspbian-jessie.zip
inflating: 2016-05-27-raspbian-jessie.img
Menulis Raspbian Jessie pada microSD
Sebelum menuliskan pada microSD, pastikan anda mengetahui nama dari microSD yang terbaca di laptop anda menggunakan perintah lsblk.
wawan@wawan-HP:/media/wawan/C89EB1DD9EB1C46A/0. WAWAN$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 465.8G 0 disk
├─sda1 8:1 0 199M 0 part
├─sda2 8:2 0 287.8G 0 part /media/wawan/C89EB1DD9EB1C46A
├─sda3 8:3 0 923M 0 part
├─sda4 8:4 0 1K 0 part
├─sda5 8:5 0 15.6G 0 part [SWAP]
├─sda6 8:6 0 51.9G 0 part /
└─sda7 8:7 0 109.4G 0 part /home
sr0 11:0 1 1024M 0 rom
mmcblk0 179:0 0 7.4G 0 disk
└─mmcblk0p1 179:1 0 7.4G 0 part
Seperti yang terlihat pada contoh di atas, microSD terbaca dengan nama mmcblk0 dengan ukuran 7.4G. Kemudian lanjutkan dengan menuliskan Raspbian Jessie pada microSD menggunakan perintah dd.
wawan@wawan-HP:/media/wawan/C89EB1DD9EB1C46A/0. WAWAN$ sudo dd bs=4M if=./2016-05-27-raspbian-jessie.img of=/dev/mmcblk0
[sudo] password for wawan:
1004797952+0 records in
1004797952+0 records out
4019191808 bytes (4.0 GB) copied, 1930.91 s, 2.1 MB/s
Setelah penulisan pada microSD telah selesai, keluarkan microSD anda dari laptop kemudian masukkan kembali pada laptop anda dan jalankan perintah lsblk lagi.
wawan@wawan-HP:/media/wawan/C89EB1DD9EB1C46A/0. WAWAN$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 465.8G 0 disk
├─sda1 8:1 0 199M 0 part
├─sda2 8:2 0 287.8G 0 part /media/wawan/C89EB1DD9EB1C46A
├─sda3 8:3 0 923M 0 part
├─sda4 8:4 0 1K 0 part
├─sda5 8:5 0 15.6G 0 part [SWAP]
├─sda6 8:6 0 51.9G 0 part /
└─sda7 8:7 0 109.4G 0 part /home
sr0 11:0 1 1024M 0 rom
mmcblk0 179:0 0 7.4G 0 disk
├─mmcblk0p1 179:1 0 63M 0 part /media/wawan/boot
└─mmcblk0p2 179:2 0 3.7G 0 part /media/wawan/2f840c69-cecb-4b10-87e4-0
Seperti yang terlihat di atas, mmcblk0 terbagi menjadi dua partisi yang pertama 63M dan 3.7G. Jika kalian sadar akan hasil di atas bahwa sekitar 3.7G tidak terbaca pada microSD. Tapi tidak perlu khawatir, cukup lanjutkan saja pada tahap berikutnya dari tutorial ini.
SSH ke Raspberry Pi
Pastikan anda sudah memasukkan microSD ke Raspberry Pi dan kabel LAN juga pastikan sudah terhubung pada router anda.
Dari terminal anda, dengan menggunakan perintah hostname, cek ip address dari laptop anda seperti pada contoh di bawah ini,
wawan@wawan-HP:~$ hostname -I
192.168.10.102
Kemudian gunakan perintah nmap untuk menemukan ip address dari Raspberry Pi. (untuk menginstall nmap cukup dengan mengetik sudo apt-get install nmap di terminal anda).
wawan@wawan-HP:~$ nmap -p 22 192.168.10.*
Starting Nmap 6.40 ( http://nmap.org ) at 2016-07-18 04:03 JST
Nmap scan report for aterm.me (192.168.10.1)
Host is up (0.015s latency).
PORT STATE SERVICE
22/tcp closed ssh
Nmap scan report for 192.168.10.102
Host is up (0.000097s latency).
PORT STATE SERVICE
22/tcp open ssh
Nmap scan report for 192.168.10.108
Host is up (0.021s latency).
PORT STATE SERVICE
22/tcp open ssh
Nmap done: 256 IP addresses (3 hosts up) scanned in 15.82 seconds
Seperti terlihat pada contoh di atas, terdapat tiga ip address dimana salah satunya yakni 192.168.10.108 adalah milik Raspberry Pi. Untuk konek ke Raspberry Pi menggunakan perintah ssh, perhatikan contoh di bawah ini.
wawan@wawan-HP:~$ ssh pi@192.168.10.108
The authenticity of host '192.168.10.108 (192.168.10.108)' can't be established.
ECDSA key fingerprint is a5:fc:0f:e4:8f:a4:15:46:b3:02:a6:75:77:fb:cb:d1.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.10.108' (ECDSA) to the list of known hosts.
pi@192.168.10.108's password:
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: Fri May 27 11:50:36 2016
pi@raspberrypi:~ $
Jangah lupa username adalah pi dan password adalah raspberry. Seperti terlihat dari contoh di atas, akhirnya akses dari Raspberry Pi berhasil didapat.
Cek ukuran atau kapasitas dari microSD
Seperti pada contoh sebelumnya, kita akan menggunakan perintah lsblk untuk mengetahui kapasitas dari microSD.
pi@raspberrypi:~ $ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
mmcblk0 179:0 0 7.4G 0 disk
|-mmcblk0p1 179:1 0 63M 0 part /boot
`-mmcblk0p2 179:2 0 7.3G 0 part /
Pada contoh sebelumnya, mmcblk0 hanya berukuran 3.7G tapi pada hasil di atas kembali menjadi 7.3G. Ini menunjukkan bahwa secara default Raspbian Jessie akan meng-expand kapasitas microSD.
Setting WiFi pada Raspberry Pi 3
Sebelum ke pengaturan WiFi, ketika kita menjalankan perintah hostname, kita akan mendapatkan satu ip address yang berati bahwa kita sedang terhubung hanya dengan kabel LAN.
pi@raspberrypi:~ $ hostname -I
192.168.10.108
Langkah selanjutnya yaitu masukkan nama SSID dari WiFi yang anda tuju beserta password-nya seperti pada contoh di bawah ini.
pi@raspberrypi:~ $ wpa_passphrase wawan-local wawan-password | sudo tee -a /etc/wpa_supplicant/myoffice.conf
network={
ssid="wawan-local"
#psk="wawan-password"
psk=481b9332ec690b74a36612b448ed0830c2ea5dfd45c48af08c6cb72d1a6d2ca7
}
Setelah menjalankan perintah seperti pada contoh di atas, buka file /etc/network/interfaces dan modifikasi seperti pada contoh di bawah ini
pi@raspberrypi:~ $ sudo nano /etc/network/interfaces
File interfaces sebelum dimodifikasi dan sesudah dimodifikasi akan tampak seperti di bawah ini.
SEBELUM:
# interfaces(5) file used by ifup(8) and ifdown(8)
# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'
# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d
auto lo
iface lo inet loopback
iface eth0 inet manual
allow-hotplug wlan0
iface wlan0 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
allow-hotplug wlan1
iface wlan1 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
SESUDAH:
# interfaces(5) file used by ifup(8) and ifdown(8)
# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'
# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d
auto lo
iface lo inet loopback
iface eth0 inet manual
allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa_supplicant/myoffice.conf
allow-hotplug wlan1
iface wlan1 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
kemudian restart network anda agar dapat terhubung ke SSID dari WiFi yang anda tuju.
pi@raspberrypi:~ $ sudo service networking restart
pi@raspberrypi:~ $ hostname -I
192.168.10.108
Jika setelah restart network namun masih tidak terhubung, coba reboot Raspberry Pi anda dan konek kembali dengan ssh via kabel LAN.
pi@raspberrypi:~ $ sudo reboot
wawan@wawan-HP:~ $ ssh pi@192.168.10.108
pi@192.168.10.108's password:
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: Sun Jul 17 19:27:16 2016
pi@raspberrypi:~ $ hostname -I
192.168.10.108 192.168.10.115
Jika dengan menggunakan hostname muncul dua ip address seperti contoh di atas, ini berarti setting WiFi pada Raspberry Pi 3 anda telah berhasil.
Sekian dulu.