<< Summary
Setup the Raspberry PI 
Sep-2013.
We assume that you already have a Raspberry PI, along with its power supply (AC or DC, whatever).
We will show how to setup everything on the Raspberry PI to get started. This is actually a list of the steps I went through to get started with mine.
We will need to edit several configuration files and other scripts. You can use any editor you wish, "nano" can do the job, I myself prefer "vi". At the end of the day, that's the same, only the result is important. gedit
is also working just fine on the Raspberry PI, in a graphical environment.
Requirements
First, flash the SD card, as explained here.
I used the Raspbian (NOOBS) image. It comes with Java. It works like a charm.
Next, we will require several softwares to be installed on the Raspberry PI, some are necessary, others are convenient.
An FTP server
This one will be very convenient when you will need to transfer files on you Raspberry PI.
To install, type:
Prompt> sudo apt-get install vsftpd
Then edit (sudo edit) /etc/vsftpd.conf
:
anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
allow_writeable_chroot=YES
chroot_local_user=YES
user_sub_token=$USER
local_root=/home/$USER/ftp
Important: If there is a problem, try removing the 2, or 3 last lines.
If you're still having problems, you can try this config file.
Start this ftp as a service on the PI:
Prompt> sudo service vsftpd restart
Inmportant note: scp
does the same job. And there is nothing to install...
From Windows, use WinSCP
.
Interestingly, if scp
is good enough for you, you can forget about ftp
.
Install RXTX Java libraries
Read this good article.
Just type:
Prompt> sudo apt-get install librxtx-java
Fing
A very cool utility. Combination of Find and Ping.
Prompt> wget http://www.overlooksoft.com/packages/download?plat=arm
Prompt> sudo dpkg -i overlook-fing-2.3.deb
Prompt> sudo apt-get install libpcap*
and finally:
Prompt> sudo fing
Create an ad-hoc network, from the Raspberry PI
Read this good article.
Make a backup:
Prompt> sudo cp /etc/network/interfaces /etc/network/interfaces_backup
Then edit (sudo edit) /etc/network/interfaces
:
auto lo
iface lo inet loopback
iface eth0 inet dhcp
auto wlan0
iface wlan0 inet static
address 192.168.1.1
netmask 255.255.255.0
wireless-channel 1
wireless-essid RPiOnTheBoat
wireless-mode ad-hoc
In the lines above, RPiOnTheBoat
will be the name of your ad-hoc network.
Restart wlan0
(wlan0 is the name of the wireless network interface).
Prompt> sudo ifdown wlan0
Prompt> sudo ifup wlan0
(reboot in case you have an error message)
Then we might need a DHCP Server:
Prompt> sudo apt-get update
Prompt> sudo apt-get install dhcp3-server
Then edit (sudo edit) /etc/dhcp/dhcpd.conf
ddns-update-style interim;
default-lease-time 600;
max-lease-time 7200;
authoritative;
log-facility local7;
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.5 192.168.1.150;
}
Reboot..., all should be all set!
There is a good atricle about the Raspberry PI connections here.
Setup the Raspberry PI as a wireless Access point
See here.
This setup allows any device to connect to the Raspberry PI (other Raspberry PIs, Android devices, etc).
Wiring PI, PI4J, I2C
You install WiringPI as explained here.
You need to install PI4J, as explained here.
This would install PI4J in /opt/pi4j
. It might be a good idea to set the PI4J_HOME
variable in your .bashrc
file.
export PI4J_HOME=/opt/pi4j
You need to enable I2C, as described here.
A Note about the screens, HDMI or RCA
If you have an HDMI screen connected to the Raspberry PI the first time you boot your system, you might experience some problem when trying to use an RCA monitor in the future.
The way to fix that is to edit (sudo edit) the file /boot/config.txt
, and to comment the NOOBS autogenerated section at the end of the file.
Next time you reboot, the problem is gone, you can use an RCA screen.
Some more utilities
Chromium
Chromium (Chrome for Linux) works fine on the Raspberry PI.
Prompt> sudo apt-get install chromium-browser
gedit
Some non-vi savvy people like editors in a graphical environment. gedit
works great.
Prompt> sudo apt-get install gedit
dos2unix
If you are working on Windows, this utility will turn the scripts you ftp from Windows in a way they can run on Linux.
Prompt> sudo apt-get install dos2unix
VNC Server
Remote graphical desktop.
Prompt> sudo apt-get install tightvncserver
System monitor
A graphical system monitoring application
Prompt> sudo apt-get install gnome-system-monitor
Keyboard config
The keyboard if by default configured for en_GB. To change that, like to a US keyboard, edit the file named /etc/default/keyboard
, and change the XKBLAYOUT
property from "gb"
to "us"
.
Prompt> sudo vi /etc/default/keyboard
Reboot will be required after that.
Console font size
Depending on the screen you work with (2.8" touchscreen, car rear view camera screen - 4.3" or 7", etc), you might need to change the size of the font of the console, in order to be able to read it.
To do so, use the following command, from the console:
Prompt> sudo dpkg-reconfigure console-setup
I choose UTF-8
, Guess optimal character set
, Terminus
, and then choose your font size. All work fine for me.
Init, banners, and others
-
Whatever executable
script
is dropped in the /etc/init.d
directory will be executed at startup. If it contains echo
or printf
commands, they will be executed when the machine boots.
-
The content of
/etc/issue
will be displayed before the user logs in.
-
The content of
/etc/motd
will be displayed after the user logs in.
You can make cool banners (like 30+ years ago) at http://www.network-science.de/ascii/.
Oliv did it