树莓派3B+安装CentOS7.9 64位系统

实验环境

树莓派3B+一个,32G内存卡一个,电脑一台

镜像下载

上清华镜像站下载树莓派的镜像,我下载的是64位没有图形界面的镜像。32位的是有两个镜像,GNOME和KDE,都是带桌面的图形化界面,由于我想用64位系统,就没有下载进行测试。

树莓派centos镜像32位桌面版.png

下面的是64位的,也就是本篇文章测试所用的镜像。下载地址是https://mirrors.tuna.tsinghua.edu.cn/centos-altarch/7.9.2009/isos/aarch64/images/

树莓派centos镜像.png

镜像写入

下载好了就可以解压到电脑里了,这时候需要把我们的micro sd卡取出来,插到电脑里,用上祖传的Win32DiskImager这个工具,写入镜像到内存卡,然后插入树莓派开机。可以看到解压后的镜像有将近3GB大小,格式是raw

树莓派centos镜像属性.png

此时开始写入,由于默认是img格式,此时需要将文件名那里改成星号所有类型,就可以看到centos镜像了,设备那里会自动识别内存卡,由于我没插卡,所以没有显示,选择镜像了就直接写入。几分钟到十几分钟都有可能,主要还是看内存卡的写入速度。

win32写入树莓派centos镜像.png

写完了弹出内存卡,插到树莓派插上网线通电开机。之前我还下载了那个通用的CentOS-7-aarch64-Everything-2009这个镜像写入内存卡,结果开不了机。

开机去路由器下面找到你的树莓派IP地址,然后ssh进去就可以。账号是root,密码是centos

查看系统配置

[root@localhost ~]# cat /etc/redhat-release 
CentOS Linux release 7.9.2009 (AltArch)
[root@localhost ~]# uname -r
5.4.72-v8.1.el7
[root@localhost ~]# arch
aarch64
[root@localhost ~]# python --version
Python 2.7.5
[root@localhost ~]# free -h
              total        used        free      shared  buff/cache   available
Mem:           912M        125M        669M        6.2M        117M        765M
Swap:          487M          0B        487M
[root@localhost ~]# lscpu 
Architecture:          aarch64
Byte Order:            Little Endian
CPU(s):                4
On-line CPU(s) list:   0-3
Thread(s) per core:    1
Core(s) per socket:    4
Socket(s):             1
Model:                 4
CPU max MHz:           1400.0000
CPU min MHz:           600.0000
BogoMIPS:              38.40
Flags:                 fp asimd evtstrm crc32 cpuid

开始使用

扩容根分区,系统刚装好根分区很小,micro sd卡还有很多剩余空间没有分给根分区

[root@localhost ~]# cat README 
== CentOS 7 userland ==
If you want to automatically resize your / partition, just type the following (as root user):
rootfs-expand

运行这条命就好了

rootfs-expand

此时根分区容量就正常了,可以看到可用有27G

[root@localhost ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root        29G  1.9G   27G   7% /
devtmpfs        424M     0  424M   0% /dev
tmpfs           457M     0  457M   0% /dev/shm
tmpfs           457M  6.2M  451M   2% /run
tmpfs           457M     0  457M   0% /sys/fs/cgroup
/dev/mmcblk0p1  286M   54M  233M  19% /boot
tmpfs            92M     0   92M   0% /run/user/0

yum源的配置

系统装好了肯定要安装软件,因此yum源就成了头等大事,首先要把系统时间校准,还要保证有网络

timedatectl set-timezone Asia/Shanghai
timedatectl set-ntp true
date

打包备份下yum源

tar -cvf /root/yum-back.gz /etc/yum.repos.d/*

删除内核那个repo,不然会报错

rm -rf /etc/yum.repos.d/CentOS-aarch64-kernel.repo

可以看到yum源是正常的

[root@localhost ~]# yum repolist
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.truenetwork.ru
 * extras: mirrors.powernet.com.ru
 * updates: mirrors.powernet.com.ru
repo id                                                                                  repo name                                                                                      status
base/7/aarch64                                                                           CentOS-7 - Base                                                                                 7,629
epel                                                                                     Epel rebuild for armhfp                                                                        24,308
extras/7/aarch64                                                                         CentOS-7 - Extras                                                                                 515
updates/7/aarch64                                                                        CentOS-7 - Updates                                                                              3,576
repolist: 36,028

查看下httpd的软件版本

[root@localhost ~]# yum info httpd
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.truenetwork.ru
 * extras: mirrors.powernet.com.ru
 * updates: mirrors.powernet.com.ru
Available Packages
Name        : httpd
Arch        : aarch64
Version     : 2.4.6
Release     : 99.el7.centos.1
Size        : 2.7 M
Repo        : updates/7/aarch64
Summary     : Apache HTTP Server
URL         : http://httpd.apache.org/
License     : ASL 2.0
Description : The Apache HTTP Server is a powerful, efficient, and extensible
            : web server.

可以看到,arm架构下版本也是2.4.6和X86架构使用的版本是一样的。

最后编辑于:2023/07/18作者: admin

发表评论