How to Install CentOS on a Raspberry Pi

Centos On Raspberry Pi Feature

As one of the most popular single-board computers on the market, the Raspberry Pi is a mainstay in most Linux users’ homes. Whether it’s for home server applications, computers for kids, learning Linux or some other skill, you can surely find a use for the Pi. Given its popularity as a home server, we’re going to show you how to install CentOS on your Raspberry Pi to create a rock-solid home server.

Also read: Differences Between RHEL, CentOS and Fedora

Getting the CentOS Image

The specific Raspberry Pi images from the CentOS project are hidden a little bit in the downloads page. For the best experience, I recommend using CentOS 7. From the CentOS Home page, click on “CentOS Linux.”

Centos On Raspberry Pi Website

Click on “7(2003).” That version number may change over time.

Choose whichever mirror is closest to you in the mirror page, and you’ll be presented with a list of options to choose from. There are a couple that are important for this project: four at the time of writing that say “RaspberryPi” in the name. For my case, I’ll be grabbing the one that says “RaspberryPi-Minimal-4,” as I’m installing this on a Raspberry Pi 4b. Make sure to choose whichever is best suited to your particular use case.

Centos On Raspberry Pi Mirror
Centos On Raspberry Pi In Nautilus

Flashing Your SD Card

For most users, Balena Etcher is probably the best choice for flashing your Raspberry Pi SD cards. One of the key parts is that it will flash straight from the xzip archives that you download for most Raspberry Pi images.

The flashing process is easy. Launch the application, select the source file (the CentOS archive in this case), the SD card port and click “Start Flashing.”

Centos On Raspberry Pi Flashing

It’ll only be a little while before everything is finished and you can boot from your SD card on your Pi.

Also read: How to Use Pushbuttons With Raspberry Pi GPIO Pins

Booting CentOS on Your Raspberry Pi

With these images, it should be just as simple as turning it on and waiting until you get to the command prompt. If you were able to install either the KDE or the GNOME version, you’ll be bumped straight to the login screen.

The default login credentials are:

  • Username: root
  • Password: centos

An important note: change the root password and create a non-root user for yourself immediately. If you don’t do this, there’s a decent chance that someone (aka hacker) will know this and get into your system with root access. That’s not good. The commands to create a new user are as follows:

Changing your root password: passwd

Creating a new user:

useradd USERNAME -G wheel -p PASSWORD

Substitute your preferred username and password. That command will create a user in the wheel or sudo group, allowing you to fully switch users and avoid logging in as root. Once you do that, make sure to use the su command to switch users to your newly-created user like so:

su USERNAME

Substitute the username of the user you just created. From there, make sure your packages are up to date with the update command:

sudo yum update -y

Installing a Graphical Desktop Environment

This is one of the easiest parts. You can see the available software groups with the following command:

yum grouplist

Choose which one you’d like to install. I’ll be installing GNOME, but KDE Plasma is available as well.

sudo yum groupinstall "GNOME Desktop"

This seems to depend on which Raspberry Pi you’re using. On my Pi 4b, I could not get systemd to jump into the GUI even though it said it was running. Your mileage may vary.

Now that you’ve learned how to install CentOS on your Raspberry Pi, you can now create an IRC server or set up a Tor Proxy or Wi-Fi bridge. The simplest of all is to create a personal web server.

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox

John Perkins

John is a young technical professional with a passion for educating users on the best ways to use their technology. He holds technical certifications covering topics ranging from computer hardware to cybersecurity to Linux system administration.