Chapter 1: Getting Started

Richard Kenneth Eng
Learn How To Program
4 min readJun 4, 2017

--

The first thing we need to do is prepare your new Raspberry Pi 3 computer for software development. This entails assembling the device, booting up the device with NOOBS and installing the Raspbian operating system, configuring the system for various conveniences, and installing the Pharo programming tool.

Assembling the Raspberry Pi

When you receive your Raspberry Pi and case, you must assemble them together. The following video should help you understand what you’re doing:

After it’s assembled, plug in your USB keyboard and mouse (a wireless USB keyboard will work, too!), connect the Pi to your HDMI monitor, insert the NOOBS SD card into the SD slot, and insert the power adapter. Note that the Raspberry Pi does not have a power switch or on/off button. To power up the computer, you plug the power adapter into the wall outlet. To power down, you remove it from the wall outlet.

TIP: always shutdown Linux properly before you unplug the power supply.

Installing Raspbian

Now, you can power up the Raspberry Pi and begin the process of installing Raspbian. You will be presented with a number of choices for installation. Select ‘Raspbian with PIXEL’. You can also connect to your WiFi network at this time, if you have one. Otherwise, you need to connect to the Internet via Ethernet (for which you need an Ethernet cable). When you’re ready, click Install.

Once installation completes, click OK and the Raspberry Pi will reboot into your newly minted OS. At any time thereafter, you can run the Pi software configuration tool if you need to make any system changes:

sudo raspi-config

(By the way, your default login credential is username ‘pi’ and password ‘raspberry’.)

It’s a good idea to bring your system up to date with the latest software releases. Open the Terminal application and enter the following commands:

sudo apt-get update
sudo apt-get upgrade
sudo reboot

The last command reboots the Raspberry Pi.

Your digital clock will probably be wrong. You should update the timezone for your system by going into Raspberry Pi Configuration (the localisation tab) in Menu→Preferences.

If you don’t like the default web browser, you can install Firefox by following these instructions. (Just leave out ‘thunderbird’ from the installation command, unless you really want the Thunderbird email program.)

There are other things you can add or configure at this point. For example, by default, audio goes through HDMI, but if you want to use the headphone jack instead, follow these instructions.

Installing Pharo

Like most Smalltalk dialects, Pharo compiles to bytecode that runs on a virtual machine (VM). A VM provides for hardware independence and portability.

For the Raspberry Pi’s ARM processor architecture, we need a special VM that we can download from here. At the time of writing, the latest was http://files.pharo.org/vm/pharo-spur32/linux/armv6/pharo-linux-ARMv6-201705051953-b8db6de.zip.

Open the Terminal application and enter the following commands to create a Pharo folder in our home folder:

mkdir pharo
cd pharo

Then we download the Pharo VM:

wget http://files.pharo.org/vm/pharo-spur32/linux/armv6/pharo-linux-ARMv6-201705051953-b8db6de.zip
unzip pharo-linux-ARMv6-201705051953-b8db6de.zip

Also at the time of writing, V50 of the Pharo image was supported. An image of the Pharo environment runs atop of the VM. Enter the following commands to download:

wget -O- get.pharo.org/50 | bash
wget http://files.pharo.org/sources/PharoV50.sources.zip
unzip PharoV50.sources.zip
rm *.zip

The ‘-O-’ in the first command has the letter ‘O’, not the digit ‘0’. If you wish to save yourself some typing, open a text editor and copy-and-paste these commands into a shell file called tmp.sh. Then execute the command:

sh tmp.sh

To start Pharo, we enter this command:

./pharo Pharo.image &

Congratulations! We now have a working Smalltalk programming environment on the Raspberry Pi. To quit Pharo, simply close the window. You will be prompted to either save and quit, or quit without saving. Your choice. If you choose save, this will update the image with a memory snapshot of your Pharo environment.

Hopefully, you’ve acquired some understanding of computer hardware and Linux. These are staples for programmers everywhere.

We may now proceed to learn about Smalltalk and object-oriented programming (OOP). See Basic Glossary first.

Just a quick note: Google search is your friend. If you have any questions about computer hardware, or Linux, or general programming problems, just Google for an answer. Google search is one of the most indispensable tools for programmers. If the answer isn’t found in Google, there probably isn’t one.

For your first exercise, then, research how to do the following…

To start Pharo more conveniently, you want to place the commands

cd /home/pi/pharo
./pharo Pharo.image &

into a shell file that you can execute outside of Terminal. To do this, you must change the Execute permission of the shell file. Find out how to do it.

Once done, you can Execute the script from anywhere. Initially, it will prompt you for Execute options. You can bypass this by going into File Manager→Edit→Preferences→General→Behaviour and checking ‘Don’t ask options on launch executable file’.

Also, if you aren’t familiar with text editors in Linux, there are several to choose from (e.g., Text Editor, Geany, vi, nano). Research these and choose one. Personally, I very much like the Geany Programmer’s Editor.

--

--