CentOS 7 running on Raspberry Pi 2

CentOS 7 running on Raspberry Pi 2

Finaly, here is very simple guide how to run CentOS 7 on Raspberry Pi2 🙂 enjoy & have a good time with it. This is the very first part of setting up home monitoring machine for other production servers, which I have. First tutorial is only setting up raspberry running in default mode, with http server and some tweaks.

 

And of course, all of steps will be soon available as installable automated bash script, as well as fully automated script bundle built for raspberry.

 

All what we need is:

  1. Raspberry Pi 2 model B (Quad-core, 1GB RAM)
  2. At least 1,5A power adapter
  3. 8GB or more MicroSDHC (SDXC) Class 10 (UHS-I in the best) card
  4. Windows/Linux/OSX desktop to create SD card
  5. Of course keyboard and display, ethernet cable, hdmi cable (other external storrage is needed), internet access (but not neccesary for first setup)
  6. And at least a little bit of brain and knowledge of CentOS is a plus 🙂
  7. Downloaded image from here (direct download link)

 

Some words before we start

The default settings for the image are :

  • root password : centos 
  • eth0 setting : dhcp 
  • selinux status : permissive or disabled (board/kernel specific)

 

Creating bootable SD card

 

The first what we need is to create SD card with operating system. There is a lot of ways, for windows, linux or OSX.  If you are using windows, there is the best to use GUI utility called win32disimager (direct link to sourceforge), in Linux and OSX, there is system utility called „dd“.

For the very first step, we need to have sd card formated into fat32. we can do it with one simple command:

mkfs.fat32 /dev/sdb1

You can find which device you need with this command:

fdisk /dev/sd*

after formatting the card, we can continue with copying files onto sd card. In the best, we can use dd with this command:

dd if=/tmp/CentOS-Userland-7-armv7hl-Minimal-1511-RaspberryPi2.img of=/dev/sdb1
After you have created your first bootable sd card, you need to do first configure.

 

Booting up and setting up the system

while CentOS 7 have support of armv7 cpu’s, there is no doubt that system will run as well, but in fact, the whole system isn’t ready for raspberry out of the box, so we need to do some steps. Depending on the SD card size you used, you probably want to expand the RootFS (/) to the maximum capacity of the underlying SD card. For your convenience, there is utility called rootfs-resize tool, packaged as rpm and also available through the Extras repository for armv7hl.

In the short – we need to setup chronyd, resize partitions on sd card and switch selinux to the right status. All what you need to do is follow these few command:
yum install chrony
systemctl start chronyd

/etc/sysconfig/selinux : change from "permissive" to "enforcing"
/boot/extlinux/extlinux.conf : change the "enforce=0" to "enforce=1"

touch /.autorelabel
touch /.rootfs-repartition
systemctl reboot

Your board will reboot, load kernel/initrd, expand the partition, resize it and reboot. Another reboot will evoke chronyd synchro and system apply changes in selinux. Once done, you’ll be using your whole SD card. 

Setting up and running the httpd server

for httpd server, we need to create just few steps, starting with update the whole system. This is case from case, but the first update can take about 20-30 minutes.

yum -y update

yum -y install httpd

Allow the default HTTP and HTTPS port, ports 80 and 443, through firewalld:

firewall-cmd --permanent --add-port=80/tcp

firewall-cmd --permanent --add-port=443/tcp

And reload the firewall:

firewall-cmd --reload

Configure Apache to Start on Boot
edit /etc/httpd/conf/httpd.conf and change line starting with „#ServerName…“

ServerName localhost:80

And then start Apache:

sudo systemctl start httpd

Be sure that Apache starts at boot:

sudo systemctl enable httpd

 

if all goes well, we will see this page:

 

Snímek obrazovky 2016-02-29 v 10.21.20

No comments yet, be first!

Add new comment

Your email address will not be published.

Tento web používá k poskytování služeb, personalizaci a anláze návštěvnosti soubory Cookie. Více informací

Cookie je krátký textový soubor, který navštívená webová stránka odešle do prohlížeče. Umožňuje webu zaznamenat informace o vaší návštěvě, například preferovaný jazyk a další nastavení. Příští návštěva stránek tak může být snazší a produktivnější. Soubory cookie jsou důležité. Bez nich by procházení webu bylo mnohem složitější. Soubory cookie slouží k celé řadě účelů. Používáme je například k ukládání vašich nastavení bezpečného vyhledávání, k výběru relevantních reklam, ke sledování počtu návštěvníků na stránce, k usnadnění registrace nových služeb a k ochraně vašich dat.

Nesouhlasím