Skip to main content

Raspberry Pi setup

ISR Raspberry Pi setup


ISR Raspberry Pi setup


Your goal today is to setup a complete Raspberry Pi (rPI) computer including cloning the SD card, powering the unit, keyboard, mouse and monitor.

You might find these references handy, depending on your interest level:

These are all in a directory with many, many things here:

https://elab.hpa.edu/isr/pdf/

Steps:

  1. setup power, keyboard, mouse, video adapter, HDMI monitor (monitors are in the workshop)
  2. clone SD card with the latest raspian operating system (an rPi version of Debian LInux, developed by a guy named Ian, married to Deborah: Deb-Ian)
  3. there is an SD card writer on the acoustics laptop, use the Balena etcher program to clone the raspian 64 bit image
  4. pick an rPi unit, either the 400 (red) ones or one of the rPi4 units (smaller)
  5. startup your rPi, go through setup screens
  6. leave network as wireless, elab2, the usual password
  7. keep the username as pi, and the login password to papaya77
  8. Once your Pi is setup, customize the screens, and make sure you can find the terminal app. 


Enable SSH: 

  1. enable ssh using the terminal command: type sudo raspi-config in the terminal window
  2. go to interfacing options, select ssh and enable
  3. please also name your rPi in the hostname field with your first name


Finding your IP address, ping command:

  1. using terminal, type sudo ifconfig, or if that does not work, sudo ip addr show
  2. write your IP address on the board, along with your name (email this to me as well)
  3. using terminal, type ping, then one of the other addresses on the board, record this value
  4. using terminal, type ping 10.14.1.4, one of our elab routers, record this
  5. now ping something outside our elab, any address will do, like www.apple.com or other
  6. leave your rPi powered up when you leave, I'll check on your settings remotely


Navigation: (see also the references listed above)

  1. type pwd in the terminal
  2. this shows the "present working directory", which you can think of like looking around once you get out of an elevator, it shows you what level you are on (also known as "print working directory")
  3. type ls,  for "list" which will show you what rooms are on this floor
  4. to go up one directory, type cd ..
  5. you can also type cd then the name of a directory to browse, like cd /Desktop
  6. find the app called File Manager, open it
  7. navigate using this app, as well as the terminal until you can use both to go up and down through directories (floors) and look around (ls command)
  8. the terminal is what is called the "command line" and what you have been using is called the CLI or "command line interface"
  9. CLI gives you super powers, including the ability to control other computers at a distance (great for evil folks, also for system administrators)


Secure Shell:

  1. secure shell (ssh) is a command that lets you enter another computer, once this access is enabled (you did so above)
  2. you are ONLY to use ssh on the rPi units in our classroom, any other use can get you booted out of HPA (yes, this has happened)
  3. using ssh, find one of the IP addresses on the board
  4. ASK the person running that rPi if you can ssh into their computer, don't ssh until you have confirmation this is ok
  5. in the terminal, enter the command ssh pi@10.14.253.x  where x is the last number in their address
  6. enter your password
  7. you are now "inside" their computer
  8. browse around using the CLI, it should be structured like yours
  9. try using the ping command to ping your own computer from theirs
  10. try pinging other computers from their computer (hackers use this to cover their tracks)
  11. a "ping flood attack" is one version of a denial of service, where you ping repeatedly, effectively disabling their computer, this is disabled in raspian by default, please do not try using this for now.


Text files: nano, more or less

  1. using your super CLI powers, use terminal to navigate on your rPi to the Desktop
  2. type pwd to make sure you are on the Desktop
  3. type sudo nano test in the terminal window
  4. a text editor will show up, type some wise words
  5. type control-o (this is holding the control key while typing the o), save the file
  6. ctrl-x to exit
  7. look on your desktop, you should see a file there, if not, try again
  8. in the command line, navigate to the Desktop again, pwd and ls to find the test file you created
  9. type less test
  10. the content of your file should show up
  11. ctrl-z to exit, or ctrl-c to cancel
  12. try also with more test
  13. try reading the test file on another persons computer using ssh (always ask first)
  14. now try creating a (clean) file on another computer, using ssh
  15. ask them to read your file


Updating the rPi:

  1. you will often be installing programs (free), and updating is part of the process
  2. in the terminal, type sudo apt-get update -y
  3. this should update your rPi and may take a bit of time, be patient
  4. you can also upgrade your rPi using sudo apt-get upgrade -y


Installing programs:

  1. install the hardinfo program using sudo apt-get install hardinfo -y
  2. we put the -y at the end to say "yes" to any question
  3. open the program using the terminal, type hardinfo
  4. close the program using ctrl-c, or just close the terminal window
  5. open the program from the applications menu (upper left) and see if it looks the same
  6. try installing wavemon and test it out


Status commands: top, ps, who, last, history

  1. try the following commands:
    1. top is the top processes
    2. ps is the process list
    3. who tells you who is currently logged in (it should be you, if not, someone is invading)
    4. last is the list of the last login (again, this should be you, if not, you may have been hacked)
    5. history is a list of the commands you have entered (very handy for recording your work)


Looking things up: DNS 

  1. use the nslookup command to lookup the IP address of a host (like www.apple.com)
  2. try asking different servers for their record using the command server 8.8.8.8 once you are in the nslookup window
  3. type exit to escape
  4. use this tool to diagnose broken network settings


Tracing the internet: traceroute

  1. try the traceroute command: traceroute www.apple.com
  2. repeat with other sites, both named and using IP addresses 


Directory ninja tricks: Hidden files

  1. go to a directory of your choice on the terminal
  2. type ls and look at the list of files
  3. now type ls -la and see what else shows up
  4. any file with a . in front is invisible
  5. you can create invisible files this way, or modify hidden files (like license files)
  6. try again using ls -lha  this is the human readable version




Migrated from Apple Server Wiki. Original page ID: M301w8m