wifi安装linux分区,树莓派3安装centos7以及wifi配置、根目录磁盘分区扩展

系统文件下载

64c5aafd1f4f

image.png

在页面找到下图,我这里下载mini版系统镜像,不安装桌面环境,说实话树莓派3运行桌面环境真心不流畅。

64c5aafd1f4f

image.png

镜像写入sd卡工具下载安装

下载完镜像可以看到文件是sda.raw.xz结尾的,之前安装img镜像使用的win32diskimager工具是不能使用了,这里使用推荐的balenaEtcher镜像写入工具。

官网地址:https://www.balena.io/etcher/

64c5aafd1f4f

image.png

点击“Download for windows x64”进行下载,下载时候双击安装即可。

镜像写入

电脑插上MicroSD卡,计算机识别后,打开安装的balenaEtcher工具。

选择下载的镜像

选择(sd卡一般自动选了)

开始写入。

等待完成即可。

开机启动

写入成功后,sd卡插入树莓派中,连接显示器,插上电源即可开机启动了

登陆树莓和无线网配置

64c5aafd1f4f

image.png

打开页面后,注意看这里

64c5aafd1f4f

image.png

这里详细的说明了root账号默认密码为centos,启用的是eth0网卡,默认为dhcp方式。

现在就可以使用root账号登陆树莓派了,密码是centos

64c5aafd1f4f

image

可以看到下图内容:

64c5aafd1f4f

image.png

解释一下

# 查看设备状态

nmcli radio

# 查看驱动状态

nmcli device

# 扫描wifi信号

nmcli device wifi rescan

# 获取wifi信号列表

nmcli device wifi list

# 连接wifi,SSID-Name为wifi名称,wireless-password为wifi对应的密码

nmcli device wifi connect SSID-Name password wireless-password

账号密码输入正确的情况下是很轻易的就能连接上wifi了。

查看是否连接上wifi

ifconfig

查看wlan0是否有ip地址信息即可。

根目录扩展

连上网了,想执行一下yum update,提示磁盘空间不够了,使用命令df -h可以看到新安装的centos7的'/'分区大小只有1.2G,已经使用91%了。分区总共使用大概2G左右,而我使用的是32G的MicroSD卡,因此需要扩展根目录挂载的分区大小。

查看文件系统使用情况(我这里已经扩展了,原来根分区只有1.2G)

[root@localhost ~]# df -h

Filesystem Size Used Avail Use% Mounted on

/dev/root 29G 1.2G 27G 5% /

devtmpfs 460M 0 460M 0% /dev

tmpfs 464M 0 464M 0% /dev/shm

tmpfs 464M 13M 452M 3% /run

tmpfs 464M 0 464M 0% /sys/fs/cgroup

/dev/mmcblk0p1 667M 43M 625M 7% /boot

tmpfs 93M 0 93M 0% /run/user/1000

tmpfs 93M 0 93M 0% /run/user/0

查看分区挂载情况

lsblk

[root@localhost ~]# lsblk

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT

mmcblk0 179:0 0 29.7G 0 disk

├─mmcblk0p2 179:2 0 488M 0 part [SWAP]

├─mmcblk0p3 179:3 0 28.6G 0 part /

└─mmcblk0p1 179:1 0 668M 0 part /boot

可以知道根目录挂载的是mmcblk0p3分区,调整mmcblk0p3的分区大小即可。

fdisk /dev/mmcblk0

[root@localhost ~]# fdisk /dev/mmcblk0

Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.

Be careful before using the write command.

# 这里输入m查看一下帮助信息

Command (m for help): m

Command action

a toggle a bootable flag

b edit bsd disklabel

c toggle the dos compatibility flag

d delete a partition

g create a new empty GPT partition table

G create an IRIX (SGI) partition table

l list known partition types

m print this menu

n add a new partition

o create a new empty DOS partition table

p print the partition table

q quit without saving changes

s create a new empty Sun disklabel

t change a partition's system id

u change display/entry units

v verify the partition table

w write table to disk and exit

x extra functionality (experts only)

Command (m for help):

扩展分区的步骤如下:

通过输入d删除分区

Command (m for help): d

Partition number (1-3, default 3): 3

Partition 3 is deleted

Command (m for help):

输入 n 新建分区(之后一直敲回车就行)

Command (m for help): n

Partition type:

p primary (2 primary, 0 extended, 2 free)

e extended

Select (default p): p

Partition number (3,4, default 3): 3

First sector (2369536-62333951, default 2369536):

Using default value 2369536

Last sector, +sectors or +size{K,M,G} (2369536-62333951, default 62333951):

Using default value 62333951

Partition 3 of type Linux and of size 28.6 GiB is set

Command (m for help):

输入p,查看分区结果

Command (m for help): p

Disk /dev/mmcblk0: 31.9 GB, 31914983424 bytes, 62333952 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk label type: dos

Disk identifier: 0x000cc7a5

Device Boot Start End Blocks Id System

/dev/mmcblk0p1 * 2048 1370111 684032 c W95 FAT32 (LBA)

/dev/mmcblk0p2 1370112 2369535 499712 82 Linux swap / Solaris

/dev/mmcblk0p3 2369536 62333951 29982208 83 Linux

Command (m for help):

分区起诉已经变大了,将剩余空间全部给了分区(我这里已经分过区了,现在看不到了)。

输入w写入分区

Command (m for help): w

The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.

The kernel still uses the old table. The new table will be used at

the next reboot or after you run partprobe(8) or kpartx(8)

Syncing disks.

reboot重启

重启之后,执行命令resize2fs /dev/mmcblk0p3,使分区生效。

[root@localhost ~]# resize2fs /dev/mmcblk0p3

resize2fs 1.42.9 (28-Dec-2013)

我安装了一个mariadb后,在mariadb启动的情况下,查看内存使用情况如下:

[root@localhost ~]# free -m

total used free shared buff/cache available

Mem: 927 96 684 11 146 774

Swap: 487 0 487

centos7在树莓派上还是很流畅的,文章到这里也就结束了!

祝各位玩的开心!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值