Engineering Innovation Center Intro to Raspbian Popup Course 2017
Intro to Raspbian Popup Course – Requirements / Recommendations The Raspberry Pi + appropriate power cables 8gb (minimum) FAT32 formatted microSD card Any USB adapter for the microSD card A functioning, internet-enabled computer that you can: Download the needed software (NOOBS) Format microSD card as FAT32 Copy files from your computer to the microSD card
Intro to Raspbian Popup Course – Downloading NOOBS, the OS installer Visit the official Raspberry Pi downloads page here and download NOOBS (Offline and network install), an official operating system installer which contains Raspbian. Direct link to NOOBS (Offline and network install). It is recommended to format your microSD card as FAT32 before continuing. If your microSD card is above 32gb you may need to try multiple tools before you are successful.
Official tools for formatting microSD cards: Intro to Raspbian Popup Course – Formatting your microSD card on Windows Official tools for formatting microSD cards: FAT32 Format (no installation necessary) SD Formatter I recommend using the FAT32 Format tool first and if any problems persist, try using the SD Formatter. Make sure to UNSELECT the ‘quick format’ option. You will instead want to select ‘overwrite format’ if there is an option for it.
Intro to Raspbian Popup Course – Formatting your microSD card on MacOS No need to download any software, you should already have utilities that can handle the formatting for you. Open the Disk Utility application Find your microSD card in the left side of the window. It will most likely be named something similar to ‘NO NAME’ or ‘UNTITLED’. Click the ERASE tab in the middle of the window Next, click on the FORMAT dropdown menu. Select MS-DOS (FAT). Agree to confirmation
Intro to Raspbian Popup Course – Formatting your microSD card on Linux While there are various ways to accomplish this through bash, we will instead be gearing this towards beginners and only cover how to do it via graphical interfaces. For this tutorial, we will be using a popular Linux distribution, Linux Mint to partition the partition on the card. Open Disks utility. It should be installed by default. Select the SD card on the left, then click the gear icon under the partition on the SD card (on the right). This will then open a context menu in which you will select Format. This will open a dialog box. Change the settings and select Format. Erase: Select any overwrite existing data option (no quick formatting) Type: Compatible with all systems and devices (FAT) Name: Any name you wish for the SD card
Intro to Raspbian Popup Course – Moving files to microSD card Once your microSD card has been formatted, you will want to extract all the files from the NOOBS zip file and put them on the root directory of your microSD card. The contents of your microSD card should now look something like this.
Intro to Raspbian Popup Course – First Boot On the Raspberry Pi, please insert your microSD card, keyboard, mouse, and HDMI monitor cables. Once you have done so, finally plug the power cable into your Pi. Upon booting, a window will appear with a list of different operating systems that you can install. We recommend and will be using Raspbian. Select the box next to Raspbian and click on Install. The installation process will then proceed and can take awhile. Upon completion, the Raspberry Pi configuration menu (raspi-config) will load. Adjust settings to your liking. You can return to this menu at any time. For now we will just select Finish.
Intro to Raspbian Popup Course – Logging in/Root User The default root user/login for Raspbian is: Username: pi Password: raspberry If you are unfamiliar with Linux, you should note that when typing passwords, no writing will appear. This is expected behavior as it is a security feature in Linux. Just enter the password as usual and hit enter.
Intro to Raspbian Popup Course – Configuring your Raspberry Pi After you have logged into you Raspberry Pi, you will need to open your terminal which can be easily found in the taskbar. Once the terminal is open, enter the command ‘sudo raspi-config’. Here you can change a plethora of settings. I recommend changing your password from the default, setting your date/timezone/etc, and enabling ssh. Here you also have the option to change what environment you want your Pi to boot to (Desktop GUI vs. Command Line).
Intro to Raspbian Popup Course – Updating your Raspberry Pi Again, open a terminal. In your terminal, you will enter the following commands to update your Raspberry Pi: sudo apt-get update This will update your system’s package list. sudo apt-get dist-upgrade This will upgrade all your installed packages to their latest versions. Note: you can use ‘sudo apt-get upgrade’ instead but it won’t intelligently handle changing dependencies.
Intro to Raspbian Popup Course – Securing your Raspberry Pi Change your root password if you have not done so already. This can be done through raspi-config or by typing the command ‘passwd’ in your terminal and following the prompts. Create a new, main, admin user to use instead of the default ‘pi’ user. In the terminal enter the command: ‘sudo useradd –m <your desired username> -G sudo’ Followed by the command to set that user’s password: ‘sudo passwd <same username you used before> Disable the default ‘Pi’ account. ‘sudo passwd -- lock pi’ (double-dash lock)
Intro to Raspbian Popup Course – SSH Config You can use ssh to remotely connect to your raspberry pi You can configure your ssh settings by editing /etc/ssh/sshd_config sudo nano /etc/ssh/sshd_config More information here: http://raspi.tv/2012/how-to-set-up-keys-and-disable-password-login-for-ssh-on-your-raspberry-pi https://www.raspberrypi.org/documentation/remote-access/ssh/
Intro to Raspbian Popup Course – Useful BASH commands ‘cd’ Stands for “change directory” Usage: to change your current working directory (current folder) in a terminal ‘cd ..’ to move up a level to the parent working directory ‘cd <new directory>’ to enter a new folder inside of the current directory
Intro to Raspbian Popup Course – Useful BASH commands ‘ls’ Stands for “list” Usage: to list everything in your current working directory ‘ls’ for simple listing of files in your cwd ‘ls –l’ for more information on the list of files in your cwd ‘ls <specified directory>’ for a listing of file in a directory other than your cwd
Intro to Raspbian Popup Course – Useful BASH commands ‘cat’ Stands for “concatenate” Usage: many uses, ranging from creating files, viewing contents of a file, concatenating files, and redirecting outputs General Syntax: ‘cat <Option> <File>’ For now we will only focus on viewing the contents of a file: ‘cat <filename>’
Intro to Raspbian Popup Course – Useful BASH commands ‘history | grep <search term>’ History command gives you recent history of all commands the user has used. You can use this as a standalone or search these with the above command.
Intro to Raspbian Popup Course – Useful BASH commands ‘vim’ Isn’t a bash command, but instead a standard text editor to create or edit a file. ‘vim helloworld.py’ would open the file helloworld.py to edit or would create the file if it did not exist in the cwd. Vim has many commands and can be a powerful editor but we will only focus on the main ones for now such as inserting and saving.
Intro to Raspbian Popup Course – Vim basics ‘i’ to start insert mode to begin typing ‘(SHIFT + Z) + (SHIFT + Z)’ exits and saves ‘:w + ENTER’ writes changes to file ‘:q + ENTER’ quits If changes have occurred and you do NOT want to save them, you must add the override: ‘:q! + Enter’ Can be combined into “:wq + ENTER” to write changes and quit Escape key exits any current mode. Must do this before attempting to save or quit.
Intro to Raspbian Popup Course – Installing C++ Compiler In an open terminal type the command ‘sudo apt-get install g++’ This will install the g++ compiler if you don’t have it already. This can then be used to compile C++ code with the command: ‘g++ <filename.cpp>’ That command will then create an executable program called “a.out” by default. This executable can then be run with the command: ‘./a.out’ More information on the g++ compiler here.
Intro to Raspbian Popup Course – Installing Python (2 Intro to Raspbian Popup Course – Installing Python (2.7) and Pip Package Manager If python is not already installed on your device, in an open terminal window, use the following command to install python: ‘sudo apt-get install python-dev’ To run a python script, simply use the command format: ‘python <python file.py>’ To install the python package manager, pip, use the following commands: ‘curl –O https://bootstrap.pypa.io/get-pip.py’ ‘sudo python get-pip.py’ Once this is done, you can easily install python packages using the command format: ‘sudo pip install <python package name>’
Engineering Innovation Center 2017 – Jim Wilson