Introduction

Quite recently I decided to migrate my Raspberry Pi 3 Model B from Raspbian to CentOS 7. This article is documenting the installation process of CentOS 7 on Raspberry Pi 3 Model B.

Contents:

Prerequisites
Write the OS to the microSD card
Troubleshoot networking issues
Update the system
Some notes on security



Prerequisites


In order to install CentOS on Raspberry Pi 3, you will first need to download the armv7hl version of the Operating System. Use this link to download the image: CentOS ARM

To download it, use the following commands:

cd Downloads
wget -c http://mirror.centos.org/altarch/7/isos/armhfp/CentOS-Userland-7-armv7hl-Minimal-1708-RaspberryPi3.img.xz

Keep in mind that the root user for new operating system is root and the password is centos.

 

Top



Write the OS to the microSD card


Now, you will have to use a microSD card that is at least 8 GB in size. I would recommend a 16GB size microSD card. Insert it into your computer and use the lsblk to find out under what name is the card mounted and to unmount the partitions. In my case it is under /dev/sdb, yours might be different.

lsblk
umount /dev/sdb1
umount /dev/sdb2

Once the partitions are unmounted, we will write the image to the card using the dd command. We will use the absolute path to the image, which in my case it is /home/alexandru/Downloads:

sudo dd bs=4M if=/home/alexandru/Downloads/CentOS-Userland-7-armv7hl-Minimal-1708-RaspberryPi3.img of=/dev/sdb conv=fsync

Take into consideration that this installation will not use the entire card. If you would like to extend the root partition to the entire disk, you should follow the instruction that are inside the README file on the card. Basically, it says that you should run the following commands to extend the root partition (run as root user):

touch /.rootfs-repartition
systemctl reboot

On a side, you can also run the following command (as root):

/usr/bin/rootfs-expand

After reboot you will be able to use the entire size of the microSD card.

 

Top



Troubleshoot networking issues


Insert the card in your Raspberry Pi and boot it up. If you remember what I wrote earlier, you should log in with the user root and password centos. Be aware that you should change this ASAP.

First thing to do is to enlarge the root filesystem with the command (as root):

/usr/local/bin/rootfs-expand

After expanding the filesystem, you should run the systemctl command and observe that networking and kdump services are failing to run. In order to start them, you will need to do the following. Add the NETWORKING=yes line to the /etc/sysconfig/network file and then start the networking service with the systemctl command.

echo "NETWORKING=yes" >> /etc/sysconfig/network
systemctl start network.service
systemctl enable network.service

If it still doesn’t work, do a reboot after you edit the file and then start and enable the service:

sudo reboot now
systemctl status network.service
systemctl start network.service
systemctl enable network.service

NOTE!!! Please take into consideration that Wifi and Bluetooth are not working under CentOS 7, thus you will have to have your Raspberry Pi 3 connected to a Ethernet cable. BUT, do not connect your Pi to the Ethernet before setting up the networking service.


In the case of kdump, you can disable the service (as it might not be supported by the kernel) using the command:

systemctl disable kdump

You can also disable Wifi and Bluetooth if you don’t need them, using the following commands:

vi /etc/modprobe.d/raspi-blklst.conf

inside the file, add the following lines:

#wifi
blacklist brcmfmac
blacklist brcmutil

#bluetooth
blacklist btbcm
blacklist hci_uart

and disable the wpa_suplicant service with the command:

systemctl disable wpa_supplicant.service

You could now reboot the system!!!

References for disabling Wifi and Bluetooth:
https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=138610
https://raspberrypi.stackexchange.com/questions/43720/disable-wifi-wlan0-on-pi-3#43721

 

Top



Update the system


Now that the networking is running, and system is rebooted, you can run an initial system update using the command:

yum update

After update, you can install your preferred packages. In my case, I always install vim and yum utility packages.

yum install yum-utils vim deltarpm

To see the available repositories, you an use the yum repolist command. As for EPEL, you should take into consideration that it is not yet supported “officialy” but it does exist in the form of a automatic rebuild of the original repository.

 

Top



Some notes on security

On Raspberry Pi 3, SELinux can run in “enforcing” mode. This is a good thing, really! More, Firewalld is installed by default thus you will have to work with it instead of iptables.

 

Top