Do you have a Raspberry Pi 2 or 3? Are you trying to figure out how to install CentOS on it? You are not alone. Many users who have reached out to me to help them with this and I have gladly obliged.
This article will give you step-by-step instructions so that CentOS installation on Raspberry Pi does not seem daunting to anyone. Let’s go through the steps now:
Gather everything you need
You are going to need your Raspberry Pi and its SD card. You will also need another device that comes with a SD card reader.
Download the media
Get online and download CentOS media or image. Make sure you acquire the latest, updated image. Once you download it, you must also extract it.
Transfer the media to the SD card
Take the SD card for Raspberry Pi, connect it to your system, and copy the CentOS image to it. It is very important that you choose the appropriate SD card (the one that works with Raspberry Pi) because, otherwise, you will run into a lot of trouble through the process.
fdisk -l /dev/mmcblk0 Disk /dev/mmcblk0: 14.9 GiB, 15931539456 bytes, 31116288 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0x00000000 Device Boot Start End Sectors Size Id Type /dev/mmcblk0p1 8192 31116287 31108096 14.9G c W95 FAT32 (LBA)
I also recommend that you check twice before going to the next step. The command that will help you check is as follows:
if you are sure that everything is going smoothly, you can go ahead.
dd if=centos.img of=/dev/mmcblk0 bs=4M
Check by connecting a keyboard
You will now need a keyboard and a device with HDMI input to see if everything is working fine. Connect the SD card to your Raspberry Pi and check the working. You don’t really require a display here so don’t worry about it. If everything is okay, the SSHD will try to reach out for a DCHP address.
Remember, the root password is usually centos and the eth0 setting is DHCP.
uname -a Linux skidmarks.funcamp.net 4.1.11-v7+ #822 SMP PREEMPT Fri Oct 23 16:22:18 BST 2015 armv7l armv7l armv7l GNU/Linux
Time to resize your disk
Use a root resizing tool to use the SD card’s space properly. CentOS itself comes with this tool so that you don’t bother wasting time looking for one or doing it manually.
touch /.rootfs-repartition systemctl reboot
Reboot the Raspberry Pi
For the changes to appear you will need to reboot your Raspberry Pi. After this process, you will start using all the space in the SD card without compromise.
Setup the NTP manually now
Since NTP is not setup for you, you must work towards doing it manually.
yum install chrony systemctl start chronyd
You will need to do this manually because Python-Pip is not included for CentOS.
curl https://dl.fedoraproject.org/pub/epel/7/x86_64/p/python-pip-7.1.0-1.el7.noarch.rpm > python-pip-7.1.0-1.el7.noarch.rpm
yum localinstall python-pip-7.1.0-1.el7.noarch.rpm -y
If you are looking to install additional noarch packages you may need to download yum-utils
yum install yum-utils -y yumdownloader python-pip
If you have done everything right and are still unable to install CentOS on Raspberry Pi, there may be a few issues to look into. Let’s assess the possible, common problems:
1) Too much memory usage: This can be because of the irqbalance process. Simply restart every day to keep this bug at bay.
cat > /etc/cron.daily/irqbalance <<EOF #!/bin/sh /bin/systemctl restart irqbalance.service EOF
2) Loose or wrong connection: Sometimes the reason is as simple as a bad connection. It is rampant when using Raspberry Pi because it is quite limited in the use of USB cables. Changing the USB could be the solution to your troubles!
3)Lack of packages: It may be difficult to find the packages you are looking for because official EPEL repositories don’t exist. You may end up compiling them yourself.
Have your say
I hope this guide was clear enough and was able to help you understand the entire process without hassle. I would love to hear from you once you have installed the CentOS. Please free to write to me and I will help you out with anything else that you need.