Thursday 31 August 2017

Packages

Install Package

  • Click on the Terminal icon at the top:


  • A Terminal window will open:

    • Input the following command at the terminal:
      sudo apt-get update
      This will update the list of available updates, and may take a minute or so to run.
      The pi@raspberrypi:~ $ prompt will appear once the command is finished.

    • Input the following command at the terminal:
      sudo apt-get install <package name>
      Where <package name> is the name of the package that you want to install.
      A list of packages can be found at http://www.raspberryconnect.com/raspbian-packages-list

    • The package will install, and this may take a minute or so.
      Press the Y key (followed by the return key) if you are asked if you want to continue.
      The pi@raspberrypi:~ $ prompt will appear once the command is finished.

    • So, if you want to install the gThumb package for example:

      • Input the following commands at the terminal:
        sudo apt-get update
        sudo apt-get install gThumb

      • gThumb will now download and install

      • Once gThumb has installed, an entry for it will be added to the Application menu, under the Graphics sub-menu.
        Obviously the location of the menu item will depend on what package is being installed.

Create a Desktop Shortcut for the Package

  • Right click on the desktop, select Create New... and click on Empty File.

  • A Creating... window will open:

    • Input a name for the empty file.
      The name must end in .desktop, so I usually use <package name>.desktop as the name.
      For gThumb I would use gThumb.desktop as the name.

    • Press the OK button

  • A new file will appear on the desktop.

  • Double click on the new file to open it.

  • The new file will now open into a text editor:

    • Input the following text into the file:

      [Desktop Entry]
      Name=<package name>
      Comment=<package description>
      Icon=<package icon>
      Exec=<package location>
      Type=Application
      Encoding=UTF-8
      Terminal=false
      Categories=None;

      Where:

      • <package name> is the name of the package.

      • <package description> is a description of the package.

      • <package icon> is the location of an icon for the shortcut.
        There are a number of icons that can be used in the /usr/share/pixmaps folder.

        Often, just putting the package name in lowercase will use the package icon.

      • <package location>
        Usually this will be /usr/bin/<package name>.

      Note that if you are unsure about any of these entries should be, the applications menu shortcuts menu items can be found in the /usr/share/applications folder.
      If you right click on one of these items, and click on Text Editor in the menu that appears, then the file will open in a text editor and the associated values can be copied into the desktop shortcut file.

    • So the following could be used for a desktop shortcut for gThumb:

      [Desktop Entry]
      Name=gThumb
      Comment=gThumb image viewer and browser
      Icon=gthumb
      Exec=/usr/bin/gthumb
      Type=Application
      Encoding=UTF-8
      Terminal=false
      Categories=None;

    • Save the file.

Friday 18 August 2017

Raspbian Stretch

This post will show you how to install the Raspbian Stretch operating system onto a Raspberry Pi computer.

At the end of this post, we will have a Raspberry Pi running the Raspbian Stretch operating system, that can access the internet and be remotely controlled from a windows computer.


Install Raspbian Stretch onto Micro-SD Card:

First of all, we need to install Raspbian Stretch onto an Micro-SD Card. This is done using a Windows computer.

Note that older Raspberry Pis use SD Cards rather than Micro-SD Cards. For this blog I will refer to either of them as a Micro-SD Card.

Install Image Writer for Windows:

  • Download http://sourceforge.net/projects/win32diskimager/files/latest/download onto a Windows computer.

  • Double click on the downloaded executable file (in my case this is Win32DiskImager-1.0.0-install.exe).

  • A User Account Control message may now appear:

    • press the Yes button to run the program.

  • Setup - Win32DiskImager will now start:

    • Follow the instructions to install the program.

Write Raspbian Stretch onto Micro-SD Card

  • Download the latest version of Raspbian Stretch from https://www.raspberrypi.org/downloads/raspbian (press the Download ZIP button under RASPBIAN STRETCH WITH DESKTOP).

  • Open the downloaded zip file, and extract the downloaded image file (in my case this is 2017-08-16-raspbian-Stretch.img) onto your hard drive.

  • Insert the Micro-SD Card into the Micro-SD Card reader on the Windows Computer, and note the drive letter that is assigned to it.

    Note that ALL data that is currently on the Micro-SD Card will be lost, so ensure that any important data on it is saved elsewhere.

  • Right click the Win32DiskImager.exe program in windows explorer (the default installation puts this in C:\Program Files (x86)\ImageWriter), and click on Run as administrator in the popup menu that appears.

    Note that Run as administrator is necessary for Windows 7 and later. Users of earlier versions should just be able to double-click on the application to run it.

  • A User Account Control message may now appear:

    • press the Yes button to run the program.

  • A File Error message may now appear. If so, press the OK button.

  • Win32 Disk Imager will now start:
    • Press the Select a Disk Image button .

    • A Select a Disk Image window will appear:

      • Select the img file

      • Press the Open button

    • Select the drive that is assigned to the Micro-SD Card (in this case F:\) as the device:

    • Press the Write button.

    • A Confirm overwrite message will appear:

      • Press the Yes button.

    • Wait...

    • A message will pop up to confirm that the write is complete:


    • Close Win32 Disk Imager.

  • Now Eject and Remove the Micro-SD Card from your windows computer.


Start up the Raspberry Pi

  • Plug the following items into the Raspberry Pi (do NOT plug the power lead in yet):
    • USB Mouse
    • USB Keyboard
    • HDMI Lead (connected to a TV)
    • Micro-SD Card

    For older Raspberry Pi models (1 and 2) a WiFi dongle should also be connected to it now (a USB hub might need to be used for this).

  • Now plug the power lead in.

  • Switch on the TV (if it doesn't automatically) and select the Raspberry Pi input.

  • Wait for Raspbian Stretch to start.


Update Password

The default user for the Raspberry Pi is pi, with the password respberry.

For security reasons especially if you are going to connect to the internet, it is a good idea to change the password, which is what I will describe here.
  • Open the Applications Menu (at the top left of the screen), select Preferences, and click on Raspberry Pi Configuration in the menu that appears

  • A Raspberry Pi Configuration window will appear:

    • Select the System tab.

    • Press the Change Password... button.

    • A Change Password window will open:

      • Input a new password into both the Enter new password and Confirm new password input boxes.

      • Press the OK button.

    • A Password Changed message will appear:

      • Press the OK button.

    • Press the OK button to close the Raspberry Pi Configuration window.


Connect to WiFi

  • Click on the network icon at the top right of the screen and then on the WiFi name that you want to connect to.

  • The <wifi name> window will open:

    • Input the WiFi passcode into the Pre Shared Key input box.

    • Press the OK button.

  • Wait for the WiFi icon to stop flashing

Install a Firewall

  • Click on the Terminal icon at the top:


  • A Terminal window will open:

    • Input the following command at the terminal:
      sudo apt-get update
      This will update the list of available updates, and may take a minute or so to run.
      The pi@raspberrypi:~ $ prompt will appear once the command is finished.

    • Input the following command at the terminal:
      sudo apt-get install ufw
      This will install ufw (Uncomplicated Fire-wall), and may take a minute or so to run.
      The pi@raspberrypi:~ $ prompt will appear once the command is finished.

    • Input the following command at the terminal:
      sudo ufw enable
      This will activate ufw, the response will state that Firewall is active, and enabled on system startup.

    • Input the following command at the terminal:
      sudo ufw status
      The response will state that Status: active.


Control Raspberry Pi from a Windows Computer

Raspberry Pi Setup

  • Open the Applications Menu (at the top left of the screen), select Preferences, and click on Raspberry Pi Configuration in the menu that appears.

  • A Raspberry Pi Configuration window will appear:

    • Select the Interfaces tab.

    • Set VNC to Enabled.

    • Press the OK button to close the Raspberry Pi Configuration window.

  • A VNC icon will appear in the taskbar.

  • Click on the Terminal icon at the top:


  • A Terminal window will open:

    • Input the following command at the terminal:
      sudo ufw allow from any to any port 5900
      This will update the firewall (ufw, which we installed previously) to allow connections to the VNC server.

    • Input the following command at the terminal:
      exit
      This will close the terminal.

  • Click on the VNC icon in the taskbar (top right).

  • A VNC Server window will open:

    • Note the IP Address (e.g. 192.168.1.67) that is displayed under Connectivity.

Windows Setup

  • Download and install the VNC Viewer application from https://www.realvnc.com/en/connect/download/viewer.

  • Start the VNC Viewer application.

  • Input the IP Address that was got from the VNC Server window in the Raspberry Pi) into the Enter a VNC Server address or search input box, and press the return key.

  • An Identity Check (VNC Server Not Recognised) message might appear:

    • Press the Continue button.

  • An Authentication window will now appear:

    • Input pi as the Username input box (pi is the default user name on Raspbian Stretch).

    • Input your Raspberry Pi password (you changed this earlier) into the Password input box.

    • Press the OK button.

  • VNC viewer will now connect to the Raspberry Pi.


Wednesday 16 August 2017

Raspbian Jessie

This post will show you how to install the Raspbian Jessie operating system onto a Raspberry Pi computer.

At the end of this post, we will have a Raspberry Pi running the Raspbian Jessie operating system, that can access the internet and be remotely controlled from a windows computer.


Install Raspbian Jessie onto SD Card:

First of all, we need to install Raspbian Jessie onto an SD Card. This is done using a Windows computer.

Install Image Writer for Windows:

  • Download http://sourceforge.net/projects/win32diskimager/files/latest/download onto a Windows computer.

  • Double click on the downloaded executable file (in my case this is Win32DiskImager-1.0.0-install.exe).

  • A User Account Control message may now appear:

    • press the Yes button to run the program.

  • Setup - Win32DiskImager will now start:

    • Follow the instructions to install the program.

Write Raspbian Jessie onto SD Card

  • Download the latest version of Raspbian Jessie from https://www.raspberrypi.org/downloads/raspbian/ (press the Download ZIP button under Raspbian Jessie).

  • Open the downloaded zip file, and extract the downloaded image file (in my case this is 2017-07-05-raspbian-jessie.img) onto your hard drive.

  • Insert the SD Card into the SD Card reader on the Windows Computer, and note the drive letter that is assigned to it.

    Note that ALL data that is currently on the SD Card will be lost, so ensure that any important data on it is saved elsewhere.

  • Right click the Win32DiskImager.exe program in windows explorer (the default installation puts this in C:\Program Files (x86)\ImageWriter), and click on Run as administrator in the popup menu that appears.

    Note that Run as administrator is necessary for Windows 7 and later. Users of earlier versions should just be able to double-click on the application to run it.

  • A User Account Control message may now appear. If so, press the Yes button to run the program.

  • A File Error message may now appear. If so, press the OK button.

  • Win32 Disk Imager will now start:

    • Press the Select a Disk Image button .

  • Select the drive that is assigned to the SD Card (in this case D:\) as the device:


  • Press the Write button.

  • A Confirm overwrite message will appear:

    • Press the Yes button.

  • Wait...

  • A message will pop up to confirm that the write is complete:


  • Close Win32 Disk Imager.

  • Now Eject and Remove the SD Card from your windows computer.


  • Start up the Raspberry Pi

    • Plug the following items into the Raspberry Pi (do NOT plug the power lead in yet):
      • USB Mouse
      • USB Keyboard
      • HDMI Lead (connected to a TV)
      • SD Card

      For older Raspberry Pi models (1 and 2) a WiFi dongle should also be connected to it now (a USB hub might need to be used for this).

    • Now plug the power lead in.

    • Switch on the TV (if it doesn't automatically) and select the Raspberry Pi input.

    • Wait for Raspbian Jessie to start.


    Update Password

    The default user for the Raspberry Pi is pi, with the password respberry.

    For security reasons especially if you are going to connect to the internet, it is a good idea to change the password, which is what I will describe here.
    • Open the Applications Menu (at the top left of the screen), select Preferences, and click on Raspberry Pi Configuration in the menu that appears

    • A Raspberry Pi Configuration window will appear:

      • Select the System tab.

      • Press the Change Password... button.

      • A Change Password window will open:

        • Input raspberry into the Current password input box.

        • Input a new password into both the Enter new password and Confirm new password input boxes.

        • Press the OK button.

      • A Password Changed message will appear:

        • Press the OK button.

      • Press the OK button to close the Raspberry Pi Configuration window.


    Connect to WiFi

    • Click on the network icon (this is one of the icons at the top right of the screen) and then on the WiFi name that you want to connect to.

    • The <wifi name> window will open:

      • Input the WiFi passcode into the Pre Shared Key input box.

      • Press the OK button.


    Install a Firewall

    • Click on the Terminal icon at the top.

    • A Terminal window will open:

      • Input the following command at the terminal:
        sudo apt-get update
        This will update the list of available updates, and may take a minute or so to run.
        The pi@raspberrypi:~ $ prompt will appear once the command is finished.

      • Input the following command at the terminal:
        sudo apt-get install ufw
        This will install ufw (Uncomplicated Fire-wall), and may take a minute or so to run.
        The pi@raspberrypi:~ $ prompt will appear once the command is finished.

      • Input the following command at the terminal:
        sudo ufw enable
        This will activate ufw, the response will state that Firewall is active, and enabled on system startup.

      • Input the following command at the terminal:
        sudo ufw status
        The response will state that Status: active.


    Control Raspberry Pi from a Windows Computer

    Raspberry Pi Setup

    • Click on the Terminal icon at the top.

    • A Terminal window will open:

      • Input the following commands at the terminal:
        sudo apt-get update
        sudo apt-get install realvnc-vnc-server
        sudo apt-get install realvnc-vnc-viewer
        This will install the VNC (Virtual Network Computing) onto your Raspberry Pi.

      • Input the following command at the terminal:
        sudo ufw allow from any to any port 5900
        This will update the firewall (ufw, which we installed previously) to allow connections to the VNC server.

    • Open the Applications Menu (at the top left of the screen), select Preferences, and click on Raspberry Pi Configuration in the menu that appears.

    • A Raspberry Pi Configuration window will appear:

      • Select the Interfaces tab.

      • Set VNC to Enabled.

      • Press the OK button to close the Raspberry Pi Configuration window.

    • Double click on the VNC icon in the taskbar (top right).

    • A VNC Server window will open:

      • Note the IP Address (e.g. 192.168.1.67) that is displayed under Connectivity.

    Windows Setup

    • Download and install the VNC Viewer application from https://www.realvnc.com/en/connect/download/viewer.

    • Start the VNC Viewer application.

    • Input the IP Address that was got from the VNC Server window in the Raspberry Pi) into the Enter a VNC Server address or search input box, and press the return key.

    • VNC viewer will now connect to the Raspberry Pi.