Installing CentOS on a Raspberry Pi

A while ago I wrote an article describing how to “Install Raspbian on a Raspberry Pi” (https://medium.com/@petermcd/installing-raspbian-on-a-raspberry-pi-7f75bf355043). I was recently required to install CentOS instead and thought I would rewrite the article describing how to install CentOS on an SD card ready for a Raspberry Pi.
What we will need
Raspberry Pi — This tutorial will work with any Raspberry Pi from version 2. The one you choose should really depend upon what you intend to do with the Raspberry Pi.
Micro SD Card — Anything above 4 GB should be fine but the size you need depends upon the usage you have planned for the Pi.
RJ45 (Ethernet cable) — You could use wireless but Ethernet Is always more reliable.
USB power cable — Hopefully I do not need to explain this one.
You may also need an SD card reader unless your laptop or PC has one built in.
Preparing the SD card
Prior to installing CentOS, we should ensure that we have a blank SD card and that it has been formatted correctly. We are going to ensure that the SD card is formatted using FAT32, however, this can be problematic if you have an SD card larger than 32GB. The steps we will take will overcome this.
The first tool that we are going to use is SD Card Formatter. This tool will remove any partitions on the card as well as carrying out a standard format. After downloading and installing this you should see an icon in your start menu. Open this as you normally would and you will be presented with the following screen:

SD Card Formatter GUI
Start by changing the drive that is selected (where it states “Select Card”). It is best to ensure that this has automatically selected the correct drive, if not change it. We will be wiping the drive, if you choose the wrong one you will be wiping data on the selected drive.
For formatting options select “Quick Format” this will suffice for our needs. Choosing this option will also be quicker than an “Overwrite Format”.
Lastly within “Volume Label” I personally enter “RASPBERRYPI”. You can enter anything you wish, however, it will be changed to upper case and will only actually use alphanumeric characters.
Lastly for this step click “Format”. You will receive a warning advising that the data will be lost. Simply click “Yes” to proceed.
If your card, like mine, is less than 32GB you can safely move onto the next step. If the SD card is 32GB or greater keep reading.
Now that the card is formatted, we need to format the drive again however using the FAT32 file system. For this step, we are going to use a tool called GUI Format. After going to the linked site simply click on the image to start downloading (easy to miss) alternatively click here.
This particular tool does not install onto your PC, instead, you simply run it from the location where you downloaded it, therefore locate the file, double click the icon and you will be presented with the following screen

GUI Format Interface
As the screenshot shows, the card I am formatting is only 7GB (it is actually 8) and it is already in FAT32 so there is no need to run the tool, however, if you do need to run the tool ensure that the correct card is selected. The “Volume Label” should match what you entered into SD Card Formatter.
Leave “Quick Format” ticked and press “Start”, and again you will receive a confirmation screen, click “OK”.
Once finished the SD card is now ready for CentOS.
Installing CentOS
Of course, before installing CentOS we first need to download it. CentOS has made a build specifically for the Raspberry Pi available. This can be downloaded here. Once the page loads, choose your preferred mirror and you will be presented with several files that you can download. As with Raspbian three versions to choose from specifically for the Raspberry Pi:
CentOS-Userland-7-armv7hl-RaspberryPI-GNOME-1810-sda.raw.xz — A version of CentOS with select software installed including the Gnome desktop environment and tools.
CentOS-Userland-7-armv7hl-RaspberryPI-KDE-1810-sda.raw.xz— A version of CentOS with select software installed including the KDE desktop environment and tools.
CentOS-Userland-7-armv7hl-RaspberryPI-Minimal-1810-sda.raw.xz — This is my preferred version. This installs a minimal set of tools thus reducing any bloat from unnecessary applications we do not require.
The steps we are going to carry out will work with any of the editions above. However, you should seriously consider the version you wish to use. If you will be installing resource heavy application from the command line, I would strongly suggest the Lite version as this frees any resources that the GUI would have taken up.
After deciding upon the version you wish to use, download it using your preferred method. Once downloaded you will have a file ending in xz. If you do not already have a tool that can extract this file you can use something like 7-Zip. Extract the single file contained within the archive. Although 7-Zip can further extract the containing Raw file there is no need.
We now need to burn this raw file to the SD Card. For this, we can use a tool called Etcher. After downloading the file, run this and install the software as you normally would.

Etcher GUI interface
Using “Select Image”, locate the raw file that we extracted earlier. Ensure the correct card is selected and lastly click “Flash”. You may be presented with a screen that asks if it is OK for the application to make changes to your device, select yes for this.
After a couple of minutes, you should receive confirmation that the flashing has finished.
Now simply place the SD card into the Raspberry Pi, connect the Raspberry Pi to your router or hub using the Ethernet cable and lastly plug the power cable in.
The Raspberry Pi is now up and running.
Further Steps
If you plan on working on the Raspberry Pi remotely you will first have to ascertain the IP of the device. There are several ways to do this.
If you have direct access to the Raspberry Pi, log in and type the command:
ifconfig
This will result in output such as:

ifconfig output
Alternatively if you have no access to the Raspberry Pi, another alternative would be to check the DHCP list within your router. Depending on the number of devices you may find a bit of trial and error is required. An easy way to identify the new device would be to attempt a connection via SSH using the credentials listed below. If they work you should be in business.
Unlike Rasbian, the CentOS install automatically enables SSH. Although this is handy, it can be a security risk as the password is quite generic. My first suggestion would be to log in with the below credential and change the password.
Username: root
Password: centos
To change the password, once logged in simply type the following command:
passwd
and enter the new password, it will prompt you to enter again, providing the passwords match you should be advised the password has been changed.
Conclusion
Most people default to installing Raspbian on the Raspberry Pi, however, there is now a plethora of operating systems that you can use. If Raspbian is not the ideal operating system or you would prefer to have a Red Hat based system then CentOS is a good alternative.

https://medium.com/@petermcd/installing-centos-on-a-raspberry-pi-2112e9ee68fc
_________________________