This section provides an overview of what raspberry-pi is {it may also be described on Stack Exchange with the shortened term of "RPi"}, and why a developer might want to use it.
It has its own dedicated Stack Exchange site here at: http://raspberrypi.stackexchange.com/.
This section provides an overview of why a developer might want to use it.
It should also mention any large subjects within raspberry-pi, and link out to the related topics. Since the Documentation for raspberry-pi is new, you may need to create initial versions of those related topics.
Usually we struggle through the process of making login in the Raspberry Pi using ssh
or other similar tools. But we can make the process more pleasent.
Once your Raspberry Pi is connected to a network it gets an IPv4 address and an IPv6 address, that is based on the NIC's MAC address. The good thing about this is that the IPv6 address doesn't change even if the network has a DHCP service.
That being said, let's discover our IPv6 address. You only need to login once using IPv4 or using a monitor (HDMI or VGA). Open a terminal and type:
ifconfig
You will see something like:
eth0 Link encap:Ethernet HWaddr 00:1C:C0:AE:B5:E6
inet addr:192.168.0.1 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::21c:c0ff:feae:b5e6/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:41620 errors:0 dropped:0 overruns:0 frame:0
TX packets:40231 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:21601203 (20.6 MiB) TX bytes:6145876 (5.8 MiB)
Interrupt:21 Base address:0xe000
As you can see your IPv4 would look like 192.168.0.1
and your IPv6 would be fe80::21c:c0ff:feae:b5e6
(notice the line that starts with inet6 addr
).
So, with this information you can login using the ssh
command with the following syntax:
ssh -6 pi@fe80::21c:c0ff:feae:b5e6%eth0
This approach seems more complicated, but the IPv6 address is defined as the link local
, and, as it is based on the MAC address, unless you change it yourself, this will always work regardless of your IPv4 address.
If you are behind a proxy and need to connect to the internet, you can use:
export http_proxy="http://username:password@host:port/"
For configuring the proxy inside apt-get
:
cd /etc/apt/apt.conf.d
Create a file named 10proxy:
sudo nano 10proxy
Without authentication add the following line:
Acquire::http::Proxy "http://yourproxyaddress:proxyport/";
Acquire::https::Proxy "http://yourproxyaddress:proxyport/";
With authentication:
Acquire::http::Proxy "http://username:password@yourproxyaddress:proxyport/";
The /
at the very end was important. Without it it does not work.
Pretext:
These are detailed instructions on how to set up a Raspberry Pi with the Raspbian operating system.
These instructions are somewhat Windows specific.
Some installation steps may apply to other operating systems as well, but keep the former in mind.
Contents
Requirements
Choosing an Operating System
Installing the Operating System
SD card
Write
Raspberry Pi
Operating System
If the OS was written correctly to the SD Card and the OS is a valid ARM Operating System, it should be installed automatically to the Raspberry Pi - with little to no interaction.
(This does however depend greatly on what kind of OS that has been chosen)
If you chose NOOBS an interface will show up and you will be able to choose what to install.
Basic Configuration
Command Line:
The command sudo raspi-config
gives you access to the Raspberry Pi configuration.
Setup Options:
1 Expand Filesystem Ensures that all of the SD card storage is available to the OS
2 Change User Password Change password for the default user (pi)
3 Enable Boot to Desktop/Scratch Choose whether to boot into a desktop environment, Scratch, or the command line
4 Internationalisation Options Set up language and regional settings to match your location
5 Enable Camera Enable this Pi to work with the Raspberry Pi camera
6 Add to Rastrack Add this Pi to the online Raspberry Pi Map (Rastrack)
7 Overclock Configure overclocking for your Pi
8 Advanced Options Configure advanced settings
9 About `raspi-config` Information about this configuration tool
Expand Filesystem
Internationalisation Options
and change the keyboard language and more.Overclock
menu as a beginner. Especially if you have the Raspberry Pi 3. The RPI 3 is known to get very hot, even if it is not overclocked.Advanced Options
menu, the credentials will be the default username and password.GUI:
Installing Raspbian Jessie automatically boots into a graphical user interface, the aforementioned options are presented in the Options menu in the top left corner.
It is recommended for beginners to keep using the GUI, but if you bought a Raspberry Pi to learn the command line. The option to boot into the command line can be found in the Settings menu.
Note
Changing settings on the Raspberry Pi usually prompts a restart which happens when you accept the changes you've made.
Extra Info
Default Username: pi
Default Password: raspberry
Shutting down your Raspberry Pi is done by pulling the USB power plug.
(Choosing shutdown in the Raspbian GUI will simply put the Raspberry Pi in a diminished state, still using power - but less)
Restarting the Raspberry Pi is done by simply plugging in the cable after unplugging it.
(Unless the reboot option is chosen in the GUI or sudo reboot
in the command line.
This is an introduction to the Hello World program example on the Raspberry Pi written in C.
The following example makes use of the command line interface and is set up as a step-by-step guide.
Along with creating a Hello World program, the reader will be introduced to simple linux command line commands.
Note: This introduction was written for beginners.
First step:
Making a directory that will contain source code.
cd
mkdir programs
cd programs
Second step:
Writing your first program.
Linux systems offer a great variety of text editors, natively you will find Vim or Nano.
This example will make use of the Nano text editor.
nano helloworld.c
The following code is the source code for the Hello World program:
/* My first program */
#include<stdio.h>
int main()
{
printf("Hello World\n");
}
ctrl + x
to exit the editor, hit y
and then enter
to save the changes.ls
to check if the file is present in your directory.Third step:
Compiling your first program.
helloworld.c
we need to use a compiler, we will use thegcc helloworld.c -o myfirstprogram.bin
The source code file is offered as an argument to the GCC compiler and -o
defines another argument expressing that we would like the compiler to output something.
In this case we want it to output a .bin
file that we named ourselves.
There is several other arguments you can use when compiling with GCC, an example would be
-wall
which enables all warnings. This gives you information about any error GCC might encounter.
Fourth step:
Running your first program.
./
in front of the name of the program that you want to run../myfirstprogram.bin
The command should execute the program and produce Hello World
in the console window.
One of the best Linux distributions currently for Raspberry Pi (from now on, "RPi") is Arch Linux. This web shows the installation for:
RPi2. ARMv7 architecture (32 bits).
RPi3. There are two options:
This tutorial advices you not to install the AArch option --- "Some of the hardware on the board may not work, or it may perform poorly".
Start by installing the OS on the MicroSD card, either NOOBS or Raspbian, both provided by the Raspberry Pi foundation, available on their site. NOOBS, which stands for New Out Of Box Software, is designed for beginners, and is the easiest to install on your SD card. You can either follow their official instructions, or see below.
Format the SD card with a single partition of FAT32, using either the system drive management tool or a third party tool, such as the SD Association's SD Formatter 4.0, or GParted. Download the NOOBS ZIP file and unzip it. next, copy the files over to the partition that you just created. Ensure that you eject it before disconnecting it.