Monday, April 13, 2020

Setup rpi

RPI Installation

  1. Download rpi imager
  2. Install and Run rpi imager.
  3. Select RASPBIAN LITE and SD card. Click Write

Setup

  1. Start rpi
  2. Login with default username - pi and password - raspberry
  3. First thing first - by default rpi comes with English-UK keyboard layout. Change it to US using below commands

    sudo raspi-config
    Localisation -> Change Keyboard Layout ->  Generic 105-Key PC (Intl.) -> English (US)
  4. Change Display resolution to highest possible
  5. Setup Wifi network
    sudo raspi-config
    Network Options -> WiFi -> Enter WiFi SSID > Enter Passphrase
    Test: ping google.com
  6. Optional change hostname. By default hostname is raspberrypi
    sudo raspi-config
    Network Options -> Hostname -> Enter desired hostname
  7. [Optional] Change pi user password. Default password is raspberry

    sudo raspi-config
    Select Change User password
  8. [Optional] Enable SSH

    sudo raspi-config
    Interfacing Options -> SSH -> Select Yes
    Test: Use putty on windows and connect to pi using hostname, username and password.
  9. Update packages
    sudo apt-get updateInstall openvpn
  10. [optional] Setup smb client. To read or backup files to flash drive mounted on router or additional pen drive.
    Install smbclient - sudo apt install smbclient
    smbclient \\\\192.168.1.1\\share -U rpi -c "cd /backup/pi; put welcome.txt"
    smbclient \\\\192.168.1.1\\share -U rpi -c "cd /backup/pi; get welcome.txt"

Quick Putty connection 

Create a shortcut on desktop to run ssh using putty 

putty.exe pi@raspberrypi

With password
putty.exe pi@raspberrypi -pw ********

Useful linux commands

ps examples

ps aux

Networking

To find IP address of each interface run ifconfig
To find open TCP connections run - sudo netstat -tulpn
To turn off network interface. sudo ifconfig wlan0 down

add/remove wifi network
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

network={
        ssid=""
        psk=""
}

Jobs

Run command in background (job) using ampersand (&) at the end of command

To list background running jobs

jobs

list jobs with PID
jobs -l

Bring a job to foreground
fg or using fg %# where is # is job id.

Kill process using run, kill PID command

To send current command to backgrount press Ctrl-Z which will also stop process. Use bg run in background.



1 comment:

Castielawasg said...

This was greatt to read