First please, download the CentOS 7.6 image file from the website below.
http://isoredirect.centos.org/altarch/7/isos/armhfp
In my case, I downloaded the 'CentOS-Userland-7-armv7hl-RaspberryPI-Minimal-1810-sda.raw.xz' file. Because GUI Environment consumes too much memory.
If you download complete, please prepare the micro SD and SD reader. Then combine them and connect them to your computer.
Unfortunately, the .raw extension file is not available in the Rufus program. So I used CentOS 7 virtual machine with a USB controller in VMware Workstation Pro.
After virtual machine booting, please run the following commands for installation.
[root@centos76 ~]# lsblk /dev/sdb
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sdb 8:16 1 29.8G 0 disk [root@centos76 ~]# cd /mnt/hgfs/CentOS\ 7.6/ [root@centos76 CentOS 7.6]# ls CentOS-Userland-7-armv7hl-RaspberryPI-Minimal-1810-sda.raw.xz [root@centos76 CentOS 7.6]# xz -d CentOS-Userland-7-armv7hl-RaspberryPI-Minimal-1810-sda.raw.xz [root@centos76 CentOS 7.6]# dd if=CentOS-Userland-7-armv7hl-RaspberryPI-Minimal-1810-sda.raw of=/dev/sdb bs=1M 2712+0 records in 2712+0 records out 2843738112 bytes (2.8 GB) copied, 427.279 s, 6.7 MB/s |
When the installation is complete, run the following commands to resize the partition of the root filesystem.
[root@centos76 CentOS 7.6]# parted /dev/sdb unit mb print free
Model: Mass Storage Device (scsi)
Disk /dev/sdb: 32011MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
0.03MB 1.05MB 1.02MB Free Space
1 1.05MB 701MB 700MB primary fat32 boot, lba
2 701MB 1213MB 512MB primary linux-swap(v1)
3 1213MB 2713MB 1499MB primary ext4
2713MB 32011MB 29298MB Free Space
[root@centos76 CentOS 7.6]# parted /dev/sdb rm 3
Information: You may need to update /etc/fstab.
[root@centos76 CentOS 7.6]# parted /dev/sdb unit mb mkpart primary ext4 1213 32011
Information: You may need to update /etc/fstab.
[root@centos76 CentOS 7.6]# parted /dev/sdb print
Model: Mass Storage Device (scsi)
Disk /dev/sdb: 32.0GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1 1049kB 701MB 700MB primary fat32 boot, lba
2 701MB 1213MB 512MB primary linux-swap(v1)
3 1213MB 32.0GB 30.8GB primary ext4
|
After resizing the partition, run the following commands to expand the root filesystem.
[root@centos76 CentOS 7.6]# e2fsck -f /dev/sdb3
e2fsck 1.42.9 (28-Dec-2013)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
_/: 24455/91584 files (0.6% non-contiguous), 243184/366080 blocks
[root@centos76 CentOS 7.6]# resize2fs /dev/sdb3
resize2fs 1.42.9 (28-Dec-2013)
Resizing the filesystem on /dev/sdb3 to 7518976 (4k) blocks.
The filesystem on /dev/sdb3 is now 7518976 blocks long.
[root@centos76 CentOS 7.6]# mkdir /rasp
[root@centos76 CentOS 7.6]# mount /dev/sdb3 /rasp
[root@centos76 CentOS 7.6]# df -Ph /rasp
Filesystem Size Used Avail Use% Mounted on
/dev/sdb3 29G 899M 28G 4% /rasp
|
Finally, create a swap file and set it.
[root@centos76 CentOS 7.6]# mkdir /rasp/swapfile
[root@centos76 CentOS 7.6]# dd if=/dev/zero of=/rasp/swapfile/swapfile1 bs=1M count=1024
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB) copied, 147.71 s, 7.3 MB/s
[root@centos76 CentOS 7.6]# mkswap /swapfile/swapfile1
Setting up swapspace version 1, size = 1048572 KiB
no label, UUID=15ddb497-31de-4a5a-9b28-b117c6286f25
[root@centos76 CentOS 7.6]# echo '/swapfile/swapfile1 swap swap defaults 0 0' >> /rasp/etc/fstab
[root@centos76 CentOS 7.6]# umount /rasp
[root@centos76 CentOS 7.6]# rmdir /rasp
[root@centos76 CentOS 7.6]# eject /dev/sdb
|
Please, detach the SD reader from your computer and connect the micro SD to the raspberry pi.
Now connect the keyboard, mouse, and monitor to the Raspberry Pi and power on it. You will then be able to see the following screen.
The ID is root and the password is centos.
Congratulations. Now you can use CentOS 7.6 on Raspberry Pi. enjoy your Raspberry Pi. :D
See you next. Thank you.
No comments:
Post a Comment