-
-
Save BionicClick/4dfd7c26b746931ec374af2ef3bfdece to your computer and use it in GitHub Desktop.
http://mylearning9.com/?p=24 | |
Install and configure CentOS 7 on a Raspberry Pi 3 | |
Author kingwindPublished on June 14, 2016Leave a comment | |
I just bought the Raspberry Pi 3 from Amazon.com CanaKit Raspberry Pi 3 Complete Starter Kit - 32 GB EditionOpens in a new window. It seems the Amazon One Day delivery never worked for me, last time my order with one day delivery got cancelled, and this time better it took two days :). | |
I don't want to use the default Raspbian OS and instead CentOS 7 is preferred, which is the version I'm using for daily work. The installation is pretty straight forward with help from Google. Basically you need find the correct disk id, download the image, unzip it and copy it the USB MicroSD with your Mac. There is one MicroSD reader included in above Kit. | |
$ diskutil list | |
/dev/disk0 (internal, physical): | |
.... | |
/dev/disk1 (internal, virtual): | |
.... | |
/dev/disk2 (external, physical): | |
#: TYPE NAME SIZE IDENTIFIER | |
0: FDisk_partition_scheme *31.4 GB disk2 | |
1: Windows_FAT_16 RECOVERY 1.2 GB disk2s1 | |
2: Linux 33.6 MB disk2s5 | |
1 | |
2 | |
3 | |
4 | |
5 | |
6 | |
7 | |
8 | |
9 | |
10 | |
11 | |
$ diskutil list | |
/dev/disk0 (internal, physical): | |
.... | |
/dev/disk1 (internal, virtual): | |
.... | |
/dev/disk2 (external, physical): | |
#: TYPE NAME SIZE IDENTIFIER | |
0: FDisk_partition_scheme *31.4 GB disk2 | |
1: Windows_FAT_16 RECOVERY 1.2 GB disk2s1 | |
2: Linux 33.6 MB disk2s5 | |
$ wget http://buildlogs.centos.org/centos/7/isos/armhfp/CentOS-Userland-7-armv7hl-Minimal-1602-RaspberryPi3.img.xz | |
$ unxz CentOS-Userland-7-armv7hl-Minimal-1602-RaspberryPi3.img.xz | |
$ diskutil unmountDisk /dev/disk<#diskid> | |
$ sudo dd bs=1m if=CentOS-Userland-7-armv7hl-Minimal-1602-RaspberryPi3.img of=/dev/disk<#diskid> | |
1 | |
2 | |
3 | |
4 | |
$ wget http://buildlogs.centos.org/centos/7/isos/armhfp/CentOS-Userland-7-armv7hl-Minimal-1602-RaspberryPi3.img.xz | |
$ unxz CentOS-Userland-7-armv7hl-Minimal-1602-RaspberryPi3.img.xz | |
$ diskutil unmountDisk /dev/disk<#diskid> | |
$ sudo dd bs=1m if=CentOS-Userland-7-armv7hl-Minimal-1602-RaspberryPi3.img of=/dev/disk<#diskid> | |
The copy of dd will take a few minutes. | |
Now insert the SD card to the RespberryPi 3 and boot, then use root/centos to login. | |
After login we will immediately find that wireless doesn't work, actually wlan0 device is not recognized by OS. | |
[root@centos-rpi3 ~]# nmcli d | |
DEVICE TYPE STATE CONNECTION | |
eth0 ethernet connected eth0 | |
lo loopback unmanaged -- | |
1 | |
2 | |
3 | |
4 | |
[root@centos-rpi3 ~]# nmcli d | |
DEVICE TYPE STATE CONNECTION | |
eth0 ethernet connected eth0 | |
lo loopback unmanaged -- | |
In order to setup the wireless connection, we have to connect to wire connection first and make sure we have internet access. If you want, you can ssh root@<ip> to the Raspberry Pi from you Mac, with the ip address by run ifconfig from the Raspberry Pi. | |
Now we need first make sure the time is correct by setting up the ntp service, otherwise download later will fail with error complaining certificate error. | |
# yum install -y ntp | |
# systemctl enable ntpd | |
# systemctl start ntpd | |
1 | |
2 | |
3 | |
# yum install -y ntp | |
# systemctl enable ntpd | |
# systemctl start ntpd | |
Verify the date is correct now: | |
[root@centos-rpi3 ~]# date | |
Fri Jun 17 04:20:43 UTC 2016 | |
1 | |
2 | |
[root@centos-rpi3 ~]# date | |
Fri Jun 17 04:20:43 UTC 2016 | |
Then we need download updated firmware from github, update it, then reboot. | |
# yum -y install git | |
# git clone https://github.com/RPi-Distro/firmware-nonfree.git | |
# mv /lib/firmware/brcm{,.org} | |
# cp -R firmware-nonfree/brcm80211/brcm /lib/firmware/brcm | |
1 | |
2 | |
3 | |
4 | |
# yum -y install git | |
# git clone https://github.com/RPi-Distro/firmware-nonfree.git | |
# mv /lib/firmware/brcm{,.org} | |
# cp -R firmware-nonfree/brcm80211/brcm /lib/firmware/brcm | |
# curl -L --output /usr/bin/rpi-update https://raw.githubusercontent.com/Hexxeh/rpi-update/master/rpi-update | |
# chmod +x /usr/bin/rpi-update | |
# rpi-update | |
# reboot | |
1 | |
2 | |
3 | |
4 | |
# curl -L --output /usr/bin/rpi-update https://raw.githubusercontent.com/Hexxeh/rpi-update/master/rpi-update | |
# chmod +x /usr/bin/rpi-update | |
# rpi-update | |
# reboot | |
After reboot finished, the wlan0 interface will be available. | |
[root@centos-rpi3 ~]# nmcli d | |
DEVICE TYPE STATE CONNECTION | |
eth0 ethernet connected eth0 | |
wlan0 wifi disconnected -- | |
lo loopback unmanaged -- | |
1 | |
2 | |
3 | |
4 | |
5 | |
[root@centos-rpi3 ~]# nmcli d | |
DEVICE TYPE STATE CONNECTION | |
eth0 ethernet connected eth0 | |
wlan0 wifi disconnected -- | |
lo loopback unmanaged -- | |
Now find the SSID of your wifi connection point, and connect to it. | |
[root@centos-rpi3 ~]# nmcli d wifi | |
* SSID MODE CHAN RATE SIGNAL BARS SECURITY | |
kobuk Infra 5 54 Mbit/s 60 ▂▄▆_ WPA2 | |
-- Infra 1 54 Mbit/s 20 ▂___ WPA1 WPA2 | |
..... | |
[root@centos-rpi3 ~]# nmcli d wifi connect <your_uuid> password <your_pwd> | |
[root@centos-rpi3 ~]# nmcli d | |
DEVICE TYPE STATE CONNECTION | |
eth0 ethernet connected eth0 | |
wlan0 wifi connected <your_uuid> | |
lo loopback unmanaged -- | |
1 | |
2 | |
3 | |
4 | |
5 | |
6 | |
7 | |
8 | |
9 | |
10 | |
11 | |
12 | |
[root@centos-rpi3 ~]# nmcli d wifi | |
* SSID MODE CHAN RATE SIGNAL BARS SECURITY | |
kobuk Infra 5 54 Mbit/s 60 ▂▄▆_ WPA2 | |
-- Infra 1 54 Mbit/s 20 ▂___ WPA1 WPA2 | |
..... | |
[root@centos-rpi3 ~]# nmcli d wifi connect <your_uuid> password <your_pwd> | |
[root@centos-rpi3 ~]# nmcli d | |
DEVICE TYPE STATE CONNECTION | |
eth0 ethernet connected eth0 | |
wlan0 wifi connected <your_uuid> | |
lo loopback unmanaged -- | |
Now confirm the wifi connection state and with the ip address we can remove the wire network connection. | |
root@centos-rpi3 ~]# nmcli d show wlan0 | |
GENERAL.DEVICE: wlan0 | |
GENERAL.TYPE: wifi | |
GENERAL.HWADDR: B8:27:EB:6F:DF:97 | |
GENERAL.MTU: 0 | |
GENERAL.STATE: 100 (connected) | |
GENERAL.CONNECTION: .... | |
GENERAL.CON-PATH: /org/freedesktop/NetworkManager/ActiveConnection/2 | |
IP4.ADDRESS[1]: 192.168.1.56/24 | |
IP4.GATEWAY: 192.168.1.1 | |
IP4.DNS[1]: 192.168.1.1 | |
IP4.DOMAIN[1]: hsd1.wa.comcast.net | |
IP6.ADDRESS[1]: .... | |
IP6.GATEWAY: | |
1 | |
2 | |
3 | |
4 | |
5 | |
6 | |
7 | |
8 | |
9 | |
10 | |
11 | |
12 | |
13 | |
14 | |
root@centos-rpi3 ~]# nmcli d show wlan0 | |
GENERAL.DEVICE: wlan0 | |
GENERAL.TYPE: wifi | |
GENERAL.HWADDR: B8:27:EB:6F:DF:97 | |
GENERAL.MTU: 0 | |
GENERAL.STATE: 100 (connected) | |
GENERAL.CONNECTION: .... | |
GENERAL.CON-PATH: /org/freedesktop/NetworkManager/ActiveConnection/2 | |
IP4.ADDRESS[1]: 192.168.1.56/24 | |
IP4.GATEWAY: 192.168.1.1 | |
IP4.DNS[1]: 192.168.1.1 | |
IP4.DOMAIN[1]: hsd1.wa.comcast.net | |
IP6.ADDRESS[1]: .... | |
IP6.GATEWAY: | |
Published on June 14, 2016Author kingwindCategories SoftwareTags CentOS, Raspberry Pi |
Followed all the steps above, however, I had an issue connecting to any services exposed on RPi's WiFi interface. Discovered the mode of the WiFi interface was set to DORMANT.
[pi@raspberrypi ws0]$ ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
link/ether b8:27:eb:00:92:8d brd ff:ff:ff:ff:ff:ff
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DORMANT group default qlen 1000
link/ether b8:27:eb:55:c7:d8 brd ff:ff:ff:ff:ff:ff
And changed the mode to DEFAULT with the following command
[pi@raspberrypi ws0]$ sudo ip link set wlan0 mode default
Hey!
Found out that https://github.com/RPi-Distro/firmware-nonfree.git does not contain brcm80211directory,
so the procedure will not allow copy the files to /lib/firmware/brcm
[root@centos-rpi3 ~]# cp -R firmware-nonfree/brcm80211/brcm /lib/firmware/brcm
cp: cannot stat 'firmware-nonfree/brcm80211/brcm': No such file or directory
[root@centos-rpi3 ~]#
Instead I used:
[root@centos-rpi3 ~]# git clone https://github.com/rhertzog/firmware-nonfree
Cloning into 'firmware-nonfree'...
remote: Counting objects: 3746, done.
remote: Total 3746 (delta 0), reused 0 (delta 0), pack-reused 3746
Receiving objects: 100% (3746/3746), 42.05 MiB | 1.98 MiB/s, done.
Resolving deltas: 100% (2509/2509), done.
Checking out files: 100% (633/633), done.
[root@centos-rpi3 ~]#
[root@centos-rpi3 ~]#
[root@centos-rpi3 ~]#
[root@centos-rpi3 ~]# mv /lib/firmware/brcm{,.org}
[root@centos-rpi3 ~]# cp -R firmware-nonfree/brcm80211/brcm /lib/firmware/brcm
[root@centos-rpi3 ~]#
[root@centos-rpi3 ~]#