Installing CentOS on the Raspberry Pi 2
Continuing with the Raspberry Pi Server and Mini Cluster project, the first step to installing the current CentOS Linux AltArch Arm32 version on the Raspberry Pi 2 was to download the latest release. I’ll come back to this operating system (OS) image later.
1. Backing Things Up – Always, Always, Always
My Raspberry Pis came bundled with a nice 8 GB micro SD card preloaded with NOOBS. In case I want to revert to this image later on, I created a cloned image of the SD card. Though installing NOOBS is pretty straight forward, I still backed this up just, cause I can.
SD Disk Identifier
First, I needed to know which disk had the preloaded NOOBS install to clone from, and in the next step used to write the CentOS image to using
dd. With the micro SD card inserted, listing all partitions with
diskutil list, I found disk6 was my SD card.
$ diskutil list ...... /dev/disk6 (internal, physical): #: TYPE NAME SIZE IDENTIFIER 0: FDisk_partition_scheme *8.0 GB disk6 1: Windows_FAT_16 RECOVERY 858.8 MB disk6s1 2: Linux 33.6 MB disk6s3
Clone the Original Raspian OS Image
$ sudo dd if=/dev/disk6 of=~/Developer/Software/raspbian.img bs=5m Password: 1520+0 records in 1520+0 records out 7969177600 bytes transferred in 598.163875 secs (13322733 bytes/sec)
Great, now I have a backup image of Raspian on my computer and I can set up the SD cards.
2. Setting Up the Micro SD Cards
Since I want to install CentOS 7 rather than Raspbian for my project, I needed to format the SD cards.
This can be done with the Disk Utility application by selecting the SD card and hitting ‘Erase‘ at the top. The only important thing here was to make sure to select MAS-DOS (FAT) format.
Always doing things within the command line interface (CLI) instead, I used the
$ diskutil unmountDisk disk6 $ diskutil eraseDisk "MS-DOS FAT32" CENTOS disk6 Started erase on disk6 Unmounting disk Creating the partition map Waiting for the disks to reappear Formatting disk6s2 as MS-DOS (FAT32) with name CENTOS 512 bytes per physical sector /dev/rdisk6s2: 15121536 sectors in 1890192 FAT32 clusters (4096 bytes/cluster) bps=512 spc=8 res=32 nft=2 mid=0xf8 spt=32 hds=255 hid=411648 drv=0x80 bsec=15151104 bspf=14768 rdcl=2 infs=1 bkbs=6 Mounting disk Finished erase on disk6
With a clean, reformatted micro SD card, now I was able to proceed with the CentOS installation!
3. Install CentOS 7
Using the latest CentOS 7 image download (as of this writing, release 1511), I followed the series of steps below to get the OS on the micro SD card.
Extract and Copy the CentOS 7 Image
$ xz -d CentOS-Userland-7-armv7hl-Minimal-1511-RaspberryPi2.img $ diskutil unmountDisk disk6 $ sudo dd if=CentOS-Userland-7-armv7hl-Minimal-1511-RaspberryPi2.img of=/dev/rdisk6 bs=4m Password: 768+0 records in 768+0 records out 3221225472 bytes transferred in 244.235138 secs (13189034 bytes/sec)
Important parameters on the
dd command were the
bs and the rdisk. Specifying
bs=4m instead of
bs=1m sped things up, and using rdisk6 instead of disk6 significantly increased the write speed!
Repeating for each Pi, the 4 SD cards were ready to go! They all have the latest CentOS 7 Linux AltArch Arm32 version and are ready to be put to work on the Raspberry Pis.
Cloned the disk image and installed CentOS 7 on the micro SD cards for each Raspberry Pi. OS is booting on each Pi, but further configuration is needed.
Developer | Bioinformatician – Decoding the world, one line at a time.
Highly motivated developer predominantly working in Linux and developing software tools. All about open source software and fascinated by working with multitudes of technologies and languages. Striving to make a positive impact in this world.