# Raspberry Pi setup

<span style="font-weight: bold;">ISR Raspberry Pi setup</span>

<span style="font-weight: bold;">ISR Raspberry Pi setup</span>

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:

- [https://elab.hpa.edu/isr/pdf/MasterRaspberryPi-2021.pdf](https://elab.hpa.edu/isr/pdf/MasterRaspberryPi-2021.pdf)
- [https://elab.hpa.edu/isr/pdf/getting-started-with-raspberry-pi-9781449344214.pdf](https://elab.hpa.edu/isr/pdf/getting-started-with-raspberry-pi-9781449344214.pdf)
- [https://elab.hpa.edu/isr/pdf/official\_raspberry\_pi\_beginners\_guide.pdf](https://elab.hpa.edu/isr/pdf/official_raspberry_pi_beginners_guide.pdf)

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

[https://elab.hpa.edu/isr/pdf/](https://elab.hpa.edu/isr/pdf/)

<span style="font-weight: bold;">Steps:</span>

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.

<span style="font-weight: bold;">Enable SSH: </span>

1. enable ssh using the terminal command: type <span style="font-weight: bold;">sudo raspi-config</span> 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

<span style="font-weight: bold;">Finding your IP address, ping command:</span>

1. using terminal, type <span style="font-weight: bold;">sudo ifconfig</span>, or if that does not work, <span style="font-weight: bold;">sudo ip addr show</span>
2. write your IP address on the board, along with your name (email this to me as well)
3. using terminal, type <span style="font-weight: bold;">ping</span>, then one of the other addresses on the board, record this value
4. using terminal, type <span style="font-weight: bold;">ping 10.14.1.4</span>, one of our elab routers, record this
5. now <span style="font-weight: bold;">ping</span> 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

<span style="font-weight: bold;">Navigation</span>: (see also the references listed above)

1. type <span style="font-weight: bold;">pwd</span> 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 <span style="font-weight: bold;">ls</span>,  for "list" which will show you what rooms are on this floor
4. to go up one directory, type <span style="font-weight: bold;">cd ..</span>
5. you can also type cd then the name of a directory to browse, like <span style="font-weight: bold;">cd /Desktop</span>
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)

<span style="font-weight: bold;">Secure Shell:</span>

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 <span style="font-weight: bold;">ssh </span>[<span style="font-weight: bold;">pi@10.14.253.x</span>](mailto: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.

<span style="font-weight: bold;">Text files: nano, more or less</span>

1. using your super CLI powers, use terminal to navigate on your rPi to the Desktop
2. type <span style="font-weight: bold;">pwd</span> to make sure you are on the Desktop
3. type <span style="font-weight: bold;">sudo nano test</span> in the terminal window
4. a text editor will show up, type some wise words
5. type <span style="font-weight: bold;">control-o</span> (this is holding the control key while typing the o), save the file
6. <span style="font-weight: bold;">ctrl-x</span> 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, <span style="font-weight: bold;">pwd</span> and <span style="font-weight: bold;">ls</span> to find the test file you created
9. type <span style="font-weight: bold;">less test</span>
10. the content of your file should show up
11. <span style="font-weight: bold;">ctrl-z</span> to exit, or <span style="font-weight: bold;">ctrl-c </span>to cancel
12. try also with <span style="font-weight: bold;">more test</span>
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

<span style="font-weight: bold;">Updating the rPi:</span>

1. you will often be installing programs (free), and updating is part of the process
2. in the terminal, type <span style="font-weight: bold;">sudo apt-get update -y</span>
3. this should update your rPi and may take a bit of time, be patient
4. you can also upgrade your rPi using <span style="font-weight: bold;">sudo apt-get upgrade -y</span>

<span style="font-weight: bold;">Installing programs:</span>

1. install the hardinfo program using <span style="font-weight: bold;">sudo apt-get install hardinfo -y</span>
2. we put the -y at the end to say "yes" to any question
3. open the program using the terminal, type <span style="font-weight: bold;">hardinfo</span>
4. close the program using <span style="font-weight: bold;">ctrl-c</span>, 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

<span style="font-weight: bold;">Status commands: top, ps, who, last, history</span>

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


<span style="font-weight: bold;">Looking things up: DNS </span>

1. use the <span style="font-weight: bold;">nslookup</span> command to lookup the IP address of a host (like [www.apple.com](http://www.apple.com))
2. try asking different servers for their record using the command <span style="font-weight: bold;">server 8.8.8.8 </span>once you are in the nslookup window
3. type exit to escape
4. use this tool to diagnose broken network settings

<span style="font-weight: bold;">Tracing the internet: traceroute</span>

1. try the <span style="font-weight: bold;">traceroute</span> command: <span style="font-weight: bold;">traceroute </span>[<span style="font-weight: bold;">www.apple.com</span>](http://www.apple.com)
2. repeat with other sites, both named and using IP addresses

<span style="font-weight: bold;">Directory ninja tricks: Hidden files</span>

1. go to a directory of your choice on the terminal
2. type<span style="font-weight: bold;"> ls </span>and look at the list of files
3. now type <span style="font-weight: bold;">ls -la</span> 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 <span style="font-weight: bold;">ls -lha</span>  this is the human readable version

  

---

<small>Migrated from Apple Server Wiki. Original page ID: M301w8m</small>