How to Start Using CentOS on your Raspberry Pi?

install centos on raspberry pi

Are you tired of using Raspbian and want to try something else?
Do you use CentOS on your computer and you want it on your Raspberry Pi too?
You’re at the good place, I’ll show you how to install it and what are the differences with Raspbian

How to Start Using CentOS on your Raspberry Pi?
CentOS is a well-known Linux distribution for its stability and its respect for Linux best practices
They have a version available for Raspberry Pi and it’s working pretty well
But if you’re used to Raspbian, you must adapt yourself to some CentOS commands and operation

But don’t panic, as usual, I’ll show you step-by-step how to install CentOS on your Raspberry
And then we’ll see the differences you need to know to get the most out of this new system

In this tutorial, I’ll show you how to start with both versions: graphical and minimal
I recommend reading both as I don’t repeat everything for the second version

CentOS introduction

If you are here only to try a new thing, I need to start by introducing what is CentOS

What is CentOS?

CentOS is a free Linux distribution, coming initially from the Red Hat distribution (RHEL)
So you’ll find a lot of similarities with the Red Hat or Fedora systems

The CentOS targets are mainly company users
Thanks to its stability and predictability, CentOS often comes just after Debian in the most used Linux distributions for a company usage

CentOS versions

CentOS doesn’t push a specific user interface
You can download 3 different versions: GNOME, KDE or Minimal

The Minimal version is something like the Raspbian Lite, with no graphic interface
GNOME and KDE are two different graphic interface softwares

GNOME is close to what you know on Raspbian Desktop.
KDE is different, with the menu at the bottom and a few different softwares

Why do I need CentOS on my Raspberry Pi?

As always, you don’t really “need” to use another Linux distribution

Raspbian is built for the Raspberry Pi and it’s working well
So there is no real reason to switch to CentOS or any other distribution

But for an educational purpose or if you are used to CentOS, Red Hat or Fedora on your computers or servers, it might be worth trying

CentOS installation on Raspberry Pi

Now that the presentations are done, let’s see how to install it on a Raspberry Pi

Download CentOS

CentOS for Raspberry Pi is available directly in the CentOS repository (Make sure to select the ARM architecture)
Click on this link, choose a server close to you and download the image

There are three images versions available for Raspberry Pi:

  • GNOME
  • KDE
  • Minimal

I recommend starting with the GNOME version if you come from Raspbian
And you may move to the Minimal version later if you are at ease with the CentOS commands
The performances of the GNOME version are not optimal on Raspberry Pi as you’ll see

Make sure to take the file with “RaspberryPi” in the name
There are also ROOTFS and generic images in the same folder

Flash your SD card

The SD card creation process is always the same

  • Download and install Etcher if you don’t already have it
  • Start Etcher, you’ll have a window like this:
    etcher menu
  • Click on “Select Image” and browse to the CentOS image
  • Insert your SD card in the computer and Etcher will auto-select it
  • Then click on “Flash!” to start the SD card creation

After a few minutes, your SD card is ready, and you can move forward

First boot

The first boot is not complicated:

  • Insert the SD card in the Raspberry Pi and launch it
  • After a few seconds, you get a Welcome menu where you need to configure your settings
    centos welcome menu
  • This menu will ask you for:
    • Language
    • Keyboard layout
    • Network configuration
    • Privacy settings
    • Time zone
    • Online accounts connections (not mandatory)
  • Answer all the questions. Then you need to create the first user
  • Finally, set a password for your account (with a minimal complexity)
  • And you’re ready to go, click on “Start using CentOS Linux”

After a few seconds you arrive to the GNOME interface
You should not be lost if you are used to Raspbian, the interface is similar (maybe cleaner, more professional I think)

centos desktop
CentOS 7 Default desktop at first login

CentOS configuration (with GNOME)

Nice, CentOS is installed and working.
But if you are used to Raspbian, you may be lost in the basic usages of your new system
No worry, I’ll help you in this section

Network settings

Even if you successfully connect to a network, you may have some issues
For example, I’m connected to the WiFi but I’m unable to use Internet
My DNS server doesn’t seem to be configured

To check your network settings, follow this procedure:

  • Open the Applications menu (top left)
  • Then Go to System Tools and click on Settings
  • Then click on Wi-Fi or Network and check that everything is fine
    For the Wi-Fi you can click on the settings wheel to access all the configuration

In my case, everything is fine, but I have always this connection issue
But after disabling IPV6, setting the correct date and time (check the next paragraph), and disconnect/reconnect the WiFi, it was ok

Edit: Before the end of this tutorial, I had to move my Raspberry Pi close to an ethernet cable. The WiFi connection was absolutely not working, disconnected each 30s and could do nothing. Once plugged with a cable, everything works fine

Adjust date and time

After checking my network configuration, I noticed that my clock was not at the good time
And that’s probably why nothing worked (HTTPS needs an adjusted time on your computer)

To fix this go back to the System Settings and choose Details > Date & Time
Even if the Date & Time seems auto adjusted with Internet, it’s not working or it’s taking too much time for me

You can disable the “Automatic Date & Time” option and set the Date/Time as you want
I recommend to re-enable to “Automatic Date & Time” option after that, to keep your system at the good time

Install packages

Like on Raspbian, there is a tool to install new packages
You can find it in the Application Menu > System Tools > Software

software installation tool centos
The software installation tool on CentOS

Enter the name of a package you want to install
Select it and click “Apply changes” to install it
It may ask you if your trust the packages, and finally your password to confirm the installation

You can also browse the packages categories to find the one you want

Update your system

To update your system, there is a similar tool in System Tools > Software Update

centos update tool
Software Update tool on CentOS 7

When the window opens, you’ll see all the packages available for update
Click on “Install updates” to install them all

I recommend rebooting your system after the update, to apply all changes

Nano

By default, nano or even vim are not installed on CentOS
If you need a text editor in your terminal, you have to install it with the Software manager

Otherwise, you have a text editor available in Applications > Accessories > Text Editor
But you’ll be stuck if you try to open a file where you don’t have the permission

SSH

As in many other systems, SSH is not enabled by default on CentOS 7
For this one I didn’t find how to do it in the interface so you have to use a command

Open a terminal (Applications > System tools > Terminal) and type this command:

sudo systemctl enable sshd
sudo systemctl start sshd

Python Libraries

If you need some specific Python libraries for Raspberry Pi, it will be a little more complex than on Raspbian
By default they are not installed neither available in the repository

I finally found how to install them, here is what you can do:

  • Create a new file to add the EPEL repository
    sudo nano /etc/yum.repos.d/epel.repo
  • Paste these lines in the file
    [epel]
    name=Epel rebuild for armhfp
    baseurl=https://armv7.dev.centos.org/repodir/epel-pass-1/
    enabled=1
    gpgcheck=0
  • Save and exit (CTRL+O, CTRL+X)
    The EPEL repository is now available
  • Use yum to install the python packages
    yum is the package manager on CentOS (like apt or apt-get on Debian systems)
    yum install python34 python34-pip
  • You can now install any Python library as usual
    For example:
    pip3.4 install picamera

CentOS configuration (Minimal version)

If your are a warrior and dare to try CentOS with the Minimal version, here is what you need to know to start

First boot

The SD card preparation is the same as with GNOME, but with another image

On the first boot, you’ll come directly to a login prompt
The default credentials are:

  • Login: root
  • Password: centos

Network configuration (Ethernet)

Then the first thing to do is to check that you have an IP address on the network
To do this, you can use ifconfig to display your network cards settings:

ifconfig

centos ip address

On the second line, you can see my current IP address: 192.168.1.15

If you need to set your network settings manually, you can use the same tool as for the Wifi connection (check the next paragraph)

Network configuration (WiFi)

I don’t recommend trying the WiFi connection on CentOS minimal as I had an issue with it on GNOME I suppose it will be the same.

But if you really need it, here is how to configure it:

  • In the terminal, start the network manager tool:
    nmtui
  • In the menu, choose “Activate a connection”
  • Your wired connection appears in the first place, but just below you have the Wifi
    You can select the SSID you want to use in the list and then enter your pass phrase

SSH

On the Minimal version, SSH is enabled by default
So as soon as you have the network working, I recommend switching to an SSH connection for the following

This will avoid keyboard localization issues and save you time if you don’t have a good keyboard for the Raspberry Pi

Install Packages

This time you don’t have a tool to manage your packages, so you have to do it with yum directly
But it’s easy

For example, to install nano:

yum install nano

You don’t need to use “sudo” with the minimal version as you’re already root

If you need to find a package name, the “search” command is also available
The same way as apt search on raspbian:

yum search python-dev

It will give you a list of matching packages on both title and description
Bonus tip: Most of the time, the <package>-dev package on Raspbian are named <package>-devel on Red Hat systems like CentOS (python-devel for example)

Update your system

Same thing for the system update
The software update tool is not here, but yum is doing the same thing:

yum update

This will download and install all the needed updates for your system
I recommend doing this on a fresh install and then regularly to keep your system up to date

Related Question

How to install packages manually on CentOS? On Debian/Raspbian, you can download and install packages manually with the dpkg command. On Red Hat systems, you have to use the rpm command. For example: rpm -I package.rpm
That’s another big difference with Raspbian

Conclusion

That’s it, you now know how to install and use CentOS on Raspberry Pi
There are some differences with Raspbian, but it’s a cool thing to try, mainly if you are used to Fedora/CentOS/Red Hat on other systems

Personally, I find the GNOME version very slow. It doesn’t seem to be well adapted for the Raspberry Pi.
If you need a graphical interface, you probably have to stay on Raspbian
But the minimal version is fine
Did you try the KDE version? How is it working?

Let me know if you are using CentOS in your projects and why do you prefer it among other distributions

Also, if you are just curious and want to try all the Raspberry Pi distributions, here is a good list of the best Raspberry Pi distributions you can check 🙂

 

7 comments

  1. Kos Reply

    I want to know how to use gpio pin and UDP of raspberry pi when installing centos.

  2. cous Reply

    I installed the centos in the raspberry pi.
    But I couldn’t install things like drbd, mariadb.
    Tell me why and how.

Leave a Reply

Your email address will not be published. Required fields are marked *