Raspberry Pi 4 Kit Hookup Guide
Configuring the Pi
This section goes over configuring the keyboard, wired, and wireless internet.
The Raspbian distribution comes defaulted to European hardware. With US keyboards, the " (quotation mark) symbol is replaced by @ (commercial at) and our number sign # is replaced by the European pound sign £. This can make it aggravating when trying to #define
things.
PIXEL Desktop (GUI)
The easiest method of configuring the Pi is using the PIXEL desktop. For those that need to adjust the settings again after the initial setup, check below!
Configuring the Keyboard Layout
To configure the keyboard layout again, head to the Task Bar Menu by clicking the Pi Start Menu > Preferences > Raspberry Pi Configuration > Localisation > Set Keyboard....
Configuring the Internet Interfaces
Raspbian does a good job of configuring wireless networks automatically. By default, DHCP is configured so that the Pi will receive an IP address when a network cable is plugged it to the Ethernet port or when a wireless network is connected.
To use the graphical network tool, right click on the icon on the right side of the task bar, and click "WiFi Networks (dhcpcdui) Settings". Then, select the interface desired (wlan0 or eth0) to disable the DHCP and set your own IP, if necessary.
To connect to a wireless network, click on the icon, select the desired network, and enter the password.
Hovering over the icon will bring up a status of wlan0 and eth0 that also shows the IP address.
Command Line Interface (CLI)
For advanced users using the command line, you can use the CLI to adjust the settings. Open a Terminal Window to configure the Raspberry Pi.
Configuring the Keyboard Layout
Invoke the config tool with the following command in the command line:
language:bash
sudo raspi-config
Then take the following actions to change the keyboard settings. We'll change the settings to US in the following example. If you are in another region, just select the option that best fits your preferences:
- Set the default locale for the system
- Select "Internationalisation Options"
- Select "Change Locale"
- Deselect en_GB.UTF-8 UTF-8
- Select en_US.UTF-8 UTF-8, (Ok)
- Set default to en_US.UTF-8, (Ok)
- Change the keyboard layout -- from the Internationalisation Options menu,
- Change Keyboard Layout
- Leave set as: Generic 105-key (Intl) PC (Ok)
- Select Other (Ok)
- Select English (US) (Ok)
- Select English (US) (Ok)
- Select default (Ok)
- Select No compose key (Ok)
- Set Ctrl+Alt+Bksp function (Ok)
- Finish with the dialog and get back to the shell
- Try the " and # keys at the prompt.
We recommend restarting the Pi at this point to ensure that the changes take effect.
Changing Your Password
Type the following command to change the password.
language:bash
sudo passwd
You will be prompted to enter your new password. Type in your new password, and your Pi will be that much more secure from unwanted visitors.
Configuring the Internet Interfaces
At this time, the network configuration works out of the box so there's really nothing to configure, but in case something goes awry, here's the basics of what can be played with and a known-working configuration to compare with.
A configuration file, interfaces
, configures both wired and wireless devices. Enter the following command into a terminal to edit the interfaces file.
language:bash
sudo nano /etc/network/interfaces
Replace "nano" with "leafpad" if you prefer graphics. Here's what our Pi 3 is using:
language:bash
# interfaces(5) file used by ifup(8) and ifdown(8)
# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'
# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d
auto lo
iface lo inet loopback
iface eth0 inet manual
allow-hotplug wlan0
iface wlan0 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
allow-hotplug wlan1
iface wlan1 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
By default, this file is set up to get its configuration from /etc/wpa_supplicant/wpa_supplicant.conf
, which is really the proper place for wifi information. Here are the contents:
language:bash
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="myNetworkSSID"
psk="mySuperSecurePassword"
key_mgmt=WPA-PSK
}
Applying the Changes
Sometimes the link should be cycled for a new configuration to take. Rather than shutting down the pi and restarting, use ifdown
and ifup
to bring the link down and back up.
For wireless connections, use
language:bash
sudo ifdown wlan
and
language:bash
sudo ifup wlan0
For wired connections, use
language:bash
sudo ifdown eth0
and
language:bash
sudo ifup eth0
Updating Software
Software packages are constantly updated. Luckily, Linux uses a package manager. All we have to do is tell our package manager to update everything, and then sit back and watch. Make sure to update the image so that we have the latest distribution. Enter the following commands in the command line individually to update your image.
language:bash
sudo apt-get update
This will go fetch the latest package information and tell the package manager what needs to be updated.
language:bash
sudo apt-get upgrade
This will download and upgrade all the packages. Please note that this upgrade will take a while. It will also prompt you if this is really what you want to do, the correct answer is "Y".
upgrade
to dist-upgrade
, the apt-get tool will automatically update or remove any unnecessary dependencies.
sudo apt-get dist-upgrade
If needed, type the following command to restart.
language:bash
sudo reboot
What's the difference between apt
vs apt-get
?
The apt-get
command is older and has more functionality. It's meant for system use, low level interfaces, or scripts. The tool is backward compatible and predictable.
The
apt
command is newer, user friendly, and includes a progress bar as the packages are installed. The apt
command combines commonly used functions from apt-get
, apt-cache
, and apt-config
into one simplified tool. There may be additional options and output. It's meant to be for the Linux user and high level interfaces. The tool is continually being developed and commands may change in the future.
Overall, both
apt
and apt-get
function the same. However, the syntax is slightly different between the two.
Over time, you'll start accumulating old packages during updates. To save space and remove unnecessary packages that were automatically installed that are no longer needed, you can enter the following command. It will also prompt you if this is really what you want to do, the correct answer is "Y".
language:bash
sudo apt-get autoremove
Then clear the package cache by entering the following command.
language:bash
sudo apt-get clean
Other Useful Linux Commands
A few other useful commands for use in the terminal command line:
pwd
- Print Working Directory, if you're not sure what folder you are in this will tell you where you are in the filesystem.ls
- List, this will show you the contents of the folder. To show all files, including hidden ones, typels -a
to show all files/folders. Alternatively, typingls -al
will show you all files/folders as well as their permission settings.cd
- this is how you change directories.cd foldername
- will move you to that folder.cd ..
- will back you up one level.cd ~
- will take you back to your home directory.
passwd
- this will allow you to change your passwordman
- this stands for manual. Type man before a command to get a summary of how to use it.nano
- this will open a basic text editor that is fairly easy to use.
At this point you should be interacting with your Raspberry Pi like you would any other computer. You can teach yourself the finer points of Linux, learn Python, program the GPIO pins, setup a minecraft server, build a network storage system, game console, or media center, or just surf the web.