Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Draft: Raspberry Pi 102

Draft: Raspberry Pi 102

Raspberry Pi 102 for the Artificial Intelligence Club for Gender Minorities, 2nd November 2017 at Monzo, London.

Brian Linuxing

November 02, 2017
Tweet

More Decks by Brian Linuxing

Other Decks in Technology

Transcript

  1. Raspberry Pi 102 for the Artificial Intelligence Club for Gender

    Minorities, 2nd November 2017 at Monzo, London. Raspberry Pi 102 by Brian Byrne. Twitter: @BrianLinuxing Email: [email protected]
  2. Brian Byrne is a freelance IT manager, a thinker and

    do-er for hire. He started coding around 1971, over time he has written programs in 14+ languages, although Turbo Pascal remains one of his favourites. Brian organises Linuxing In London, co-organises London JavaScript Community and Covent Garden Pi Jam. He likes tea and speaking poor Spanish. He prefers community management to being a boring IT Manager and know-all! NB: Brian speaks in paragraphs. Raspberry Pi 102 by Brian Byrne. Twitter: @BrianLinuxing Email: [email protected]
  3. Congratulate yourself! You have a working Raspberry Pi. Now we

    have to learn how to manage it. Raspberry Pi 102 by Brian Byrne. Twitter: @BrianLinuxing Email: [email protected]
  4. Brief agenda: Post installation, what must be done and what

    should be done. How to operate a Linux system, what to do and what to avoid, covering the Linux command-line extensively. Raspberry Pi 102 by Brian Byrne. Twitter: @BrianLinuxing Email: [email protected]
  5. What this class is not: An MSc in computer science.

    The last word on everything about Linux. But, it will provide: A basic Raspberry 102, a hands-on approach to managing a Raspberry Pi system with Linux, and many of the gotchas! It will be the start of your journey to learnt about Linux. Raspberry Pi 102 by Brian Byrne. Twitter: @BrianLinuxing Email: [email protected]
  6. What we will do: Perform post-installation tasks. Learn about command

    line software installation. The power of the cli, basic commands, key files, performance tuning, etc Finally, you will be master of your own Raspberry Pi. NB: These commands should apply on almost any Debian or Ubuntu derived system, AWS, GCP etc but read the manual. Raspberry Pi 102 by Brian Byrne. Twitter: @BrianLinuxing Email: [email protected]
  7. Prerequisites 1. A working Raspberry Pi and a terminal session

    via SSH. 2. Pen and paper. 3. Concentration. Raspberry Pi 102 by Brian Byrne. Twitter: @BrianLinuxing Email: [email protected]
  8. A word of warning: Linux is not Windows, don’t treat

    it as if it were. Raspberry Pi 102 by Brian Byrne. Twitter: @BrianLinuxing Email: [email protected]
  9. 1. Gotchas, security and what not to do. [NB: all

    Linux commands should be in lowercase, Linux is case sensitive] A word about normal users and root access. Normally users can not, generally, break a Linux system but root (or superuser) can. sudo <command> sudo -i for a longer session but take extra care. Gotcha: Don’t CTRL-C system updates/upgrades etc or you’ll end up with a broken package management system, treat Linux with respect or it will bite back. Raspberry Pi 102 by Brian Byrne. Twitter: @BrianLinuxing Email: [email protected]
  10. 2. Expand the filesystem via raspi-config sudo raspi-config Enter password

    7 Advanced Options -> A1 Expand Filesystem Do changes and reboot NB: Best not be too smart with raspi-config, eg. Don’t overclock or you might break something and fry your Raspberry Pi! Raspberry Pi 102 by Brian Byrne. Twitter: @BrianLinuxing Email: [email protected]
  11. 3. Perform a complete system upgrade (think Play Store or

    App Store) sudo -i apt-get update && apt-get -V dist-upgrade Watch the output very carefully, initially Take a break, but remember don't interrupt apt-get or it might break your Linux system. A word on dependency management and libraries. Raspberry Pi 102 by Brian Byrne. Twitter: @BrianLinuxing Email: [email protected]
  12. 4. Change defaults and create your own user account 4.1

    Type, passwd Pick a new password for the default pi account. 4.2 sudo -i passwd root 4.3 Type, adduser <your new username> Fill in 4.4 adduser <your new username> sudo Verify new user account has access to sudo, by logging out and logging in again, then type sudo -i from your new account. If in doubt check /etc/sudoers Raspberry Pi 102 by Brian Byrne. Twitter: @BrianLinuxing Email: [email protected]
  13. 5. More basics software installation with apt-get apt-get update –

    are we online? Give me an up to date feel of all of the packages. apt-get –V install <package> Eg. apt-get –y –V glances apt-cache search chess >file more file grep <text> file apt-get is a frontend to dpkg and ALWAYS the best way, but dpkg -l (L) is useful. Raspberry Pi 102 by Brian Byrne. Twitter: @BrianLinuxing Email: [email protected]
  14. 6. The command line and the shell Recall buffer and

    CTRL-R The history command Writing the history buffer to a file history –w whatihavejustdone.txt history –c Raspberry Pi 102 by Brian Byrne. Twitter: @BrianLinuxing Email: [email protected]
  15. 7. Some basic Linux commands for file management (think MS-DOS)

    ls – list files, eg. ls -alh mkdir – make a directory cd - change to a directory pwd - where am I cd $HOME – take me to the top level directory more – type something to the console mv – really renames files, use with care cp – copy files tail – the bottom of a file, eg. tail 200 nano – a simple editor rm – erases files, be careful, particularly when in root. rmdir – removed an empty directory diff – compare two files, eg. diff –y –w132 <file1> <file2> Raspberry Pi 102 by Brian Byrne. Twitter: @BrianLinuxing Email: [email protected]
  16. 8. Key files and how not to break Linux Don’t

    touch anything in /etc unless you have to. Don’t delete anything from /usr/bin or /usr/sbin/ If you need to remove a package use apt-get purge <package> ls –rtcl /var/log is handy tail /var/log/syslog dmesg – watch like a hawk, use -T to make sense of time Raspberry Pi 102 by Brian Byrne. Twitter: @BrianLinuxing Email: [email protected]
  17. 9. Performance monitoring with top and free Tuning systems is

    very, very involved and a full time job. top – watch Tasks, topleft and free memory, q quits, h for help free – shows free memory, more readable with free –m df - look at your devices, e.g. df -h When you run out of memory Linux will start killing processes, run only what you need to execute. If in doubt, use glances, it is very good. Raspberry Pi 102 by Brian Byrne. Twitter: @BrianLinuxing Email: [email protected]
  18. 10. Shutting down, doing it properly sudo shutdown –h 5

    - halts the system sudo shutdown –r 2 - reboots the system sudo shutdown –c - cancel the shutdown Use these instead of the halt and reboot commands. Don’t just unplug the power! Raspberry Pi 102 by Brian Byrne. Twitter: @BrianLinuxing Email: [email protected]
  19. 11. Clever things with Linux, using the GUI remotely X

    clients and X servers (1984 - MIT, now seen as X11 - version 11) ssh to the server with the -XC options from Linux then invoke synaptic or firefox. Windows systems need to have an X client running (Xming or Cygwin). Macs might need security options fixing, for more modern systems see XQuartz project. The process load is on the Raspberry Pi, not your PC/laptop etc Raspberry Pi 102 by Brian Byrne. Twitter: @BrianLinuxing Email: [email protected]
  20. 12. Lost your Raspberry Pi? Do this only on your

    home network, not anywhere else. apt-get update && apt-get –y –V install zenmap nmap –sP <IP range/24) eg. nmap -sP 192.168.1.0/24 Find your own IP address by typing, ifconfig Raspberry Pi 102 by Brian Byrne. Twitter: @BrianLinuxing Email: [email protected]
  21. 13. Finally turning off the GUI and using it A

    headless Raspberry Pi doesn't need a GUI (Graphical User Interface) X can be used if needed, as above. Turning off the desktop (GUI) frees up memory and the Raspberry Pi should go a bit faster. Networking a hassle? Just plug straight into your router with an RJ45 cable (no password setup required, it will be issued with an IP address on power up) Turn off and on X via raspi-config sudo raspi-config 3 Boot Options->B1 Desktop /CLI-> [your choice] Raspberry Pi 102 by Brian Byrne. Twitter: @BrianLinuxing Email: [email protected]
  22. Fini For additional material and answers see the FAQs Raspberry

    Pi 102 by Brian Byrne. Twitter: @BrianLinuxing Email: [email protected]
  23. Frequently asked questions (FAQs): Q: Where are the slides kept?

    A: These are just draft ones, but the final version will always be at GitHub’s speakerdeck as BrianLinuxing. https://speakerdeck.com/brianlinuxing Q: How does TCP/IP work? A: TCP/IP is an immensely complex network protocol, but from our point of view we just need to know if you plug in a device it will request a TCP/IP address. That address is supplied by a DHCP server. In most instances that will be your home or office router. Q: What does DHCP mean? A: Dynamic Host Configuration Protocol Raspberry Pi 102 by Brian Byrne. Twitter: @BrianLinuxing Email: [email protected]
  24. FAQs continued: Q: Where can I learn more? The Pi

    Foundation site is a good starting place, although many of the articles are over elaborate for beginners. Equally, the forums can be useful at times. Q: Isn't Linux too complicated to learn? Learning Linux is no more complicated than becoming familiar with another language or mastering the art of car driving. It takes patience, a degree of persistence but the rewards are immense. Raspberry Pi 102 by Brian Byrne. Twitter: @BrianLinuxing Email: [email protected]
  25. FAQs continued: Q: Where can I buy my Pi equipment?

    Pimoroni Pi Borg The Pi Hut Pi Supply Again, the Pi Foundation site has a list. Q: Are there any courses I can do to learn about Raspberry Pis and Linux A: The Pi Foundation offers special courses to teachers etc and the Linux Foundation has various basic Linux courses too. Raspberry Pi 102 by Brian Byrne. Twitter: @BrianLinuxing Email: [email protected]
  26. FAQs continued: Q: What should I do now? Spent time

    reading, tinkering and if you ruin the Raspberry Pi's file structure then you can always recreate it using the instructions in Raspberry Pi 101. Q: My commands never work under Linux on the command line. A: Linux is case sensitive, take extra care. Q: What does && and all of those funny Linux symbols do? A: They are called chaining operators, see https://www.tecmint.com/chaining-operators-in-linux-with-practical-examples/ Raspberry Pi 102 by Brian Byrne. Twitter: @BrianLinuxing Email: [email protected]
  27. FAQs continued: Q: I need help, what do I do?

    A: Type, man <linux command> as a starter or typically <linux command> --help Q: You didn’t answer my question. A: Linux is complex operating system and can’t be rushed! Self study is always useful :) Q: I have many, many more questions where should I go? A: Let Google be your friend in this case :) Raspberry Pi 102 by Brian Byrne. Twitter: @BrianLinuxing Email: [email protected]