Installing Raspbian on Raspberry Pi

**These directions were done using Linux Mint. They can be done in Windows and Mac but will need to research equivalent commands.

  1. Make sure current SD card is clean and current partitions deleted. Format it using Gparted or command line if needed.
  2. Download latest Raspbian OS .zip file from https://www.raspberrypi.org/downloads/raspbian/
  3. Transfer the image onto your SD card.

You will need to extract the files from the .zip file you downloaded and then use Etcher SD Card Image Utility to burn the image onto your SD card.

Go to https://www.raspberrypi.org/learning/software-guide/quickstart/ and follow the instructions.

A summary of the link above:

$ chmod a+x Etcher-linux-x64.AppImage
  • Execute:
$ ./Etcher-linux-x64.AppImage

Etcher will automatically set the boot to Desktop.

Windows has an equivalent called Win32DiskImager. See here for Windows instructions: https://www.raspberrypi.org/documentation/installation/installing-images/windows.md

  1. Remove SD card and insert into Raspberry Pi. Connect a monitor to the Pi and then plug in the power to turn it on. You will need to connect the keyboard as well. If the keyboard is on when you plug in the power, you may need to turn it off and then on to get it to work.
  1. The Raspbian OS install will take some time. Once it finishes, it will take you to the OS desktop. Open the terminal from the top panel.
  1. Open Raspbian Configuration using Terminal
$ sudo raspi-config

To navigate, use the up/down arrow keys. When finished, use the left/right arrow keys. To select, press ENTER.

  • Press ENTER when Expand Filesystem is highlighted.

Ensures that all of the SD card storage is available to the OS.
Need to reboot for changes to take effect.

  • Change User Password

This will apply to default user ‘pi’

  • Internationalisation Options

Change Timezone

Change Keyboard

Change Language

    • Advanced Options

6.1 Overscan (will allow you to expand the screen to encompass monitor size. Only needed if you see black bars top, right, bottom, and/or left).

You can also set the overscan from the terminal by typing:

$ sudo nano /boot/config.txt

nano is the name of the terminal text editor

Information on how to use nano can be found here: http://www.howtogeek.com/howto/42980/the-beginners-guide-to-nano-the-linux-command-line-text-editor/

6.2 Change Hostname

6.3 SSH (enable)

  • Use right arrow to navigate to Finish and hit ENTER

Description of some of the menu items can be found here: http://www.howtogeek.com/138281/the-htg-guide-to-getting-started-with-raspberry-pi/2/

  1. Make sure Raspbian is updated with latest drivers:
$ sudo apt-get update
$ sudo apt-get upgrade
  1. Set up wireless connection to your Wi-Fi network
  • Open wpa_supplicant.conf file to add the username and password information if not already there:
$ sudo nano /etc/wpa-supplicant/wpa_supplicant.conf
  • Type in your necessary network information.

Press F3 to save your changes.

Press ENTER to save the changes to current file.

Press CTRL-x to exit from nano editor.

  • Reboot to have changes take effect:
$ sudo reboot

Instructions here: https://thepihut.com/blogs/raspberry-pi-tutorials/16018016-how-to-setup-wifi-on-the-raspberry-pi-raspbian

  • Check that changes were saved:
$ sudo ifconfig

Look for wlan0. This is the wireless network information. If there is an IP address listed, then it worked. Write down the IP address to set up SSH in step 9 (if needed).

  1. How to remote into the Pi from your personal computer.

SSH should be enabled from step 6.3. If not, follow steps in step 6 to enable it.

  • On personal computer, open terminal and type:
$ ssh pi@127.0.0.1

format is: $ ssh username@ip_address

It will prompt you for password to username ‘pi’

  1. Disable screen-saver.

Install xscreensaver.

 $ sudo apt-get install xscreensaver
 $ sudo reboot

Navigate to the ‘Start’ menu and click Preferences > Screensaver.

In the drop down, you can select ‘Disable Screensaver’.

  1. Install Raspbian version of Firefox called Iceweasel
$ sudo apt-get install iceweasel
  1. Open Firefox from ‘Start’ menu > Internet
  • Navigate to the website you want to display
  • Bookmark and set as home page

More info here:

https://support.mozilla.org/en-US/kb/what-does-your-connection-is-not-secure-mean#w_what-to-do-if-you-see-this-error

  1. Make browser full-screen

https://support.mozilla.org/en-US/kb/how-make-firefox-and-websites-go-full-screen

Kill a Program in Linux

I came across a really simple problem while using my Linux OS. I am used to the CTRL+ALT+DEL in Windows to open the Task Manager to close programs. I wasn’t sure how to do the same in a Linux environment.

To close a program in Linux from the command line, there are two options:

If you don’t know the name of the application, you can use this one. It will prompt you to click on the window of the application you are trying to close.
After clicking on it, the program will immediately close.

$ sudo xkill

If you know the name of the application, you can type:
$ sudo killall <name of application>
For example: $ sudo killall firefox

Creating Cron Job on RHEL7

Found a great resource for creating cron jobs in Red Hat Enterprise Linux 7:

https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/ch-Automating_System_Tasks.html

(Yes it is from the creator’s website!) How cron jobs are laid out in /etc/crontab:

SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/
# For details see man 4 crontabs
# Example of job definition:
# .---------------- minute (0 - 59)
# | .------------- hour (0 - 23)
# | | .---------- day of month (1 - 31)
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# | | | | |
# * * * * * username  command to be executed

So for example, if you want to create a cron job that will start XAMPP Apache server every weekday:

0 8 * * mon,tue,wed,thu,fri root /opt/lampp/laampp start

If you aren’t sure if you have cron or anacron available on your machine, you can run:

$ rpm -q cronie cronie-anacron

If you have cron packages installed, the command above will list them.

Dual Boot Ubuntu and Windows 10

I am on a Toshiba Satellite L55 and wanted to install a Linux operating system alongside my Windows 10 OS.

Here is a great YouTube video that explains how to allow both operating systems to work alongside each other:

I had trouble creating a partition using the Windows 10 Disk Management so I downloaded this EaseUS Partition Manager program to help me set aside a big enough partition manually.

Instead of saving the Ubuntu image .iso file onto a DVD, I used a USB. There are some tutorials online on how to change some settings in your BIOS to be able to boot from a USB drive. On my Toshiba Satellite, I didn’t have to alter anything in my computer BIOS and was able to just press F12 on computer start-up and choose USB as my boot source.

Installing Vagrant, Virtualbox

Vagrant is used to manage your Virtualbox images

Virtualbox is used to create customized development environments. You can create a Linux or Mac environment on a Windows machine with Virtualbox.

Here’s how to get started with Vagrant on Windows.

I installed Vagrant onto my Windows 10 OS first.

Then I installed Virtualbox

Setting up your Virtualbox

I ran the Virtualbox and selected the blue ‘New’ button to create a new virtual machine (which I named Ellen’s Linux). I kept all the values to their defaults and created a 5gb hard disk that is dynamic.

Unnamed QQ Screenshot20151221214033

Go here to download Ubuntu OS. I downloaded the 14.04.3 version.

Then go to your Settings>Display
Click on the CD icon (which should say Empty)
Then click on the CD icon on the right under Attributes>Optical Drive to select the Choose Virtual Optical Disk File
Find your Ubuntu OS .iso file and select it.

Unnamed QQ Screenshot20151221220339

Click the OK button and Run your new virtual machine.

If you get this error in your Virtualbox:

This kernel requires an x86-64 CPU, but only detects an i686 CPU, unable to boot

Go to General> Basic Settings and change the Ubuntu(32-bit) to Ubuntu(64-bit)

Unnamed QQ Screenshot20151221220256.jpg

If you notice your Ubuntu environment running super slow, go to Settings> Display

Check the ‘Enable 3D acceleration’ box in your virtual machine

Unnamed QQ Screenshot20151221220316

Setting up your Vagrant

After installing Vagrant, open your terminal and run this:

$ vagrant box add precise32 http://files.vagrantup.com/precise32.box
$ vagrant init precise32

If you get this error in your terminal:

Vagrant failed to initialize at a very early stage:

The plugins failed to load properly. The error message given is
shown below.

The RubyEncoder loader is not installed. Please visit the http://www.rubyencoder.com/loaders/ RubyEncoder site to download the required loader for 'mingw' and unpack it into 'C:/HashiCorp/Vagrant/embedded/rgloader' directory to run this protected script.

Then go here to download the RubyEncoder (MinGW). Unzip the folder ‘rgloader’ into HashiCorp/Vagrant/embedded/

If you’re prompted, replace any files with the same name.

Create a directory anywhere on your computer and test your Vagrant.
$ mkdir vagrant-test
$ cd vagrant-test
$ vagrant up

Done!

Get into an instance:
$ vagrant ssh

Helpful links:
Ubuntu Vagrant Install and Getting Started/

Getting Started Vagrant Windows

Ubuntu