Raspberry Pi : Arch Linux - System Setup

From Wiki³
Revision as of 16:49, 23 June 2014 by Kyau (talk | contribs) (Created page with "{{DISPLAYTITLE:Raspberry Pi : Arch Linux - System Setup}} <div id="tocalign">__TOC__</div> The following tutorial is a collection of notes on how to install the Arch Linux di...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

The following tutorial is a collection of notes on how to install the Arch Linux distribution on the Raspberry Pi hobbyist device. This tutorial is essentially a replica of my normal Arch Linux: System Installation guide with RPi (Raspberry Pi) specific notes included. As always we will follow the Arch Linux philosophy, meaning these tutorials are geared at being simple and efficient.

Image SD Card

For use in the creation of this tutorial I used the following environment:

IconIcon Raspberry Pi Model B Icon ArchLinuxARM-2014-06-rpi.img

Download and image your SD Card with the image located at Arch Linux ARM.

Linux

If you are using a Linux machine you can simply search for the device node of the SD card you have inserted with the fdisk -l command. Then you can format your SD card with the image using the following command, filling in the path of the downloaded image and replacing the device node with the device node you found with fdisk (e.g. /dev/sdd).

# # dd bs=1M if=/path/to/ArchLinuxARM-2014-06-rpi.img of=<device node>

Windows

Download and install Win32DiskImager. Then proceed to use it to format your SD card with the image you downloaded. Be sure to specify the correct device before hitting the Write button.

Initial Boot & Configuration

Go ahead and plug the SD Card back into the RPi and boot it up. You will eventually be greeted with the Arch Linux login prompt. Login to the system using the root account with the default password of root.

System Update

First, run pacman(8) to update the system. After this it is safe to reboot to enact the changes.

# [root@alarmpi ~]$ pacman -Syu

...

[root@alarmpi ~]$ systemctl reboot

With the system is up to date, edit the /etc/pacman.d/mirrorlist in order to select an Arch Linux ARM (ALARM) download mirror that is closest to your location. I have found that the default auto-selection based off geo-IP data doesn't work all that well. Uncomment the mirror that best suits your location.

# [root@alarmpi ~]$ vi /etc/pacman.d/mirrorlist
&#151;&#151;&#151;
# Server = http://mirror.archlinuxarm.org/$arch/$repo

...

Server = http://wa.us.mirror.archlinuxarm.org/$arch/$repo
&#151;&#151;&#151;

You can also take this time to enable the Color option in the /etc/pacman.conf if you like.

# [root@alarmpi ~]$ vi /etc/pacman.conf
&#151;&#151;&#151;
# Misc options
#UseSyslog
Color
#TotalDownload
CheckSpace
#VerbostPkgLists
&#151;&#151;&#151;

Next, install packer and update the RPi firmware/kernel to the latest version. In addition to this we will be installing arm-mem which are ARM-accelerated versions of selected functions from string.h. Then again reboot the machine to enact the changes.

# [root@alarmpi ~]$ pacman -S packer arm-mem-git linux-raspberrypi-latest linux-raspberrypi-latest-headers vim

...

[root@alarmpi ~]$ systemctl reboot

Configuration

With the system updated to the latest kernel it is not time to configure the system for our needs. We can first start with the network.

Network

After you have the RPi running the Linux kernel 3.x you will now have 8188eu wireless support built into the kernel. You can use an 8188eu USB NIC or the built-in wired NIC that comes with the RPi.

Wired

For a wired network card first copy a template and then edit the template to modify your IP address and your chosen DNS server.

# [root@alarmpi ~]$ cd /etc/netctl
[root@alarmpi ~]$ cp examples/ethernet-static eth0
[root@alarmpi ~]$ vim eth0
&#151;&#151;&#151;
IP=static
Address=('192.168.1.30/24')
Gateway='192.168.1.1'
DNS=('4.2.2.1' '4.2.2.2')
ExecUpPost='/usr/bin/ntpd -gq || true'
&#151;&#151;&#151;

Wireless

If you wish to use wireless instead it is pretty much the same process except we use a different template. The only difference is to make sure you secure the file if it contains your wireless password.

# [root@alarmpi ~]$ cd /etc/netctl
[root@alarmpi ~]$ cp examples/wireless-wpa eth0
[root@alarmpi ~]$ vim eth0
&#151;&#151;&#151;
IP=static
Address=('192.168.1.30/24')
Gateway='192.168.1.1'
DNS=('4.2.2.1' '4.2.2.2')
ESSID='MyWirelessNetworkSSID'
Key='MyWirelessPassword'
#Hidden=yes
ExecUpPost='/usr/bin/ntpd -gq || true'
&#151;&#151;&#151;
[root@alarmpi ~]$ chmod 640 eth0

Feel free to change either of these to IP=dhcp in order to use DHCP instead of a static address. Also regardless of which you chose you will need to enable the profile with netctl.

# [root@alarmpi ~]$ netctl enable eth0

Hostname

Set the hostname for use with networks, I will be using the hostname hex.kyau.net.

# [root@alarmpi ~]$ hostnamectl set-hostname hex.kyau.net

Timezone

Set the timezone, for me this is US/Pacific as I am located on the west coast of the United States. Then enable ntpd for internet time syncing capabilities.

# [root@alarmpi ~]$ timedatectl set-timezone US/Pacific
[root@alarmpi ~]$ systemctl enable ntpd

Locale

Setup the appropriate locale. First edit /etc/locale.gen and uncomment the lines that correspond to your language selection, generate the needed locales, set your keymap and finally set the language with the system.

# [root@alarmpi ~]$ vim /etc/locale.gen
&#151;&#151;&#151;
en_US ISO-8859-1
en_US.UTF-8
&#151;&#151;&#151;
[root@alarmpi ~]$ locale-gen
Generating locales...
 en_US.UTF-8
 en_US.ISO-8859-1
Generation complete.
[root@alarmpi ~]$ localectl set-keymap us
[root@alarmpi ~]$ localectl set-locale LANG="en_US.UTF-8"

User Management

With the system configuration out of the way it is time to create a user account, install sudo, give the user full access to sudo and then relog into your new account. I will be using the username kyau for the extent of this tutorial. Finally we can change the default root password.

# [root@alarmpi ~]$ useradd -m -g users -s /bin/bash kyau
[root@alarmpi ~]$ passwd kyau
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
[root@alarmpi ~]$ pacman -S sudo

...

[root@alarmpi ~]$ visudo
&#151;&#151;&#151;
root ALL=(ALL) ALL
kyau ALL=(ALL) ALL
&#151;&#151;&#151;
[root@alarmpi ~]$ passwd
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
[root@alarmpi ~]$ systemctl reboot