linux_arm_arch,树莓派安装ArchLinuxARM的记录

2019-10-15 遇到的小问题

最近开始操作树莓派,安装的系统是ArchLinux的arm版本,简单记录一下安装过程。

主要是根据ArchLinuxARM安装文档进行安装操作的。

有点坑的是这页面在mac上能正常切换显示installation标签的内容,但在我的Windows上换了好几个浏览器,都无法切换过去。只能使用web调试,改了下html,才正常显示installation标签页。

c93d0572fb3f

树莓派安装

[root@alarmpi ~]# lsblk #查看存储卡名称

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT

sda 8:0 1 14.4G 0 disk

|-sda1 8:1 1 61M 0 part

|-sda2 8:2 1 2.3G 0 part

`-sda3 8:3 1 12.1G 0 part

mmcblk0 179:0 0 14.9G 0 disk

|-mmcblk0p1 179:1 0 100M 0 part /boot

`-mmcblk0p2 179:2 0 14.8G 0 part /

[root@alarmpi ~]# fdisk /dev/sda #使用fdisk对存储卡进行分区

Welcome to fdisk (util-linux 2.34).

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

Be careful before using the write command.

Command (m for help): o #删除所有分区

Created a new DOS disklabel with disk identifier 0xf5d1473c.

Command (m for help): p #查看分区情况,这时候没有分区了。

Disk /dev/sda: 14.42 GiB, 15476981760 bytes, 30228480 sectors

Disk model: Storage Device

Units: sectors of 1 * 512 = 512 bytes

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

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

Disklabel type: dos

Disk identifier: 0xf5d1473c

Command (m for help): n #创建第一个分区

Partition type

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

e extended (container for logical partitions)

Select (default p): p

Partition number (1-4, default 1):

First sector (2048-30228479, default 2048):

Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-30228479, default 30228479): +100M

Created a new partition 1 of type 'Linux' and of size 100 MiB.

Command (m for help): t #更改分区类型

Selected partition 1

Hex code (type L to list all codes): c

Changed type of partition 'Linux' to 'W95 FAT32 (LBA)'.

Command (m for help): n #创建第二个分区

Partition type

p primary (1 primary, 0 extended, 3 free)

e extended (container for logical partitions)

Select (default p):

Using default response p.

Partition number (2-4, default 2):

First sector (206848-30228479, default 206848):

Last sector, +/-sectors or +/-size{K,M,G,T,P} (206848-30228479, default 30228479):

Created a new partition 2 of type 'Linux' and of size 14.3 GiB.

Command (m for help): p #查看分区情况,有两个分区。

Disk /dev/sda: 14.42 GiB, 15476981760 bytes, 30228480 sectors

Disk model: Storage Device

Units: sectors of 1 * 512 = 512 bytes

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

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

Disklabel type: dos

Disk identifier: 0xf5d1473c

Device Boot Start End Sectors Size Id Type

/dev/sda1 2048 206847 204800 100M c W95 FAT32 (LBA)

/dev/sda2 206848 30228479 30021632 14.3G 83 Linux

Command (m for help): w #保存退出

The partition table has been altered.

Calling ioctl() to re-read partition table.

Syncing disks.a

[root@alarmpi ~]# mkfs.vfat /dev/sda1 #格式化

#如果-bash: mkfs.vfat: command not found不存在,需pacman -Sy dosfstools安装应用。

[root@alarmpi ~]# mkfs.ext4 /dev/sda2

[root@alarmpi ~]# cd /mnt

[root@alarmpi mnt]# mkdir boot

[root@alarmpi mnt]# mkdir root

[root@alarmpi mnt]# mount /dev/sda1 boot

[root@alarmpi mnt]# mount /dev/sda2 root

[root@alarmpi mnt]# wget http://os.archlinuxarm.org/os/ArchLinuxARM-rpi-2-latest.tar.gz

#需pacman -Sy wget 安装应用,不过下载速度太慢了,从其他地方下载好拷过去。

[root@alarmpi mnt]# bsdtar -xpf ArchLinuxARM-rpi-2-latest.tar.gz -C root

[root@alarmpi mnt]# sync

[root@alarmpi mnt]# mv root/boot/* boot

[root@alarmpi mnt]# umount boot root

安装后把SD卡插到树莓派开机,使用“账号root”和“密码root”登陆。

习惯使用root账号通过ssh连接对机器进行管理,所以执行命令echo "PermitRootLogin yes" >> "/etc/ssh/sshd_config"更改设置,然后执行systemctl restart sshd重启sshd服务,这样就 可以了。

我的版本和型号:

# uname -a

Linux alarmpi 4.19.66-1-ARCH #1 SMP PREEMPT Sat Aug 17 02:33:29 UTC 2019 armv7l GNU/Linux

# cat /proc/device-tree/model

Raspberry Pi 3 Model B Rev 1.2

开机后还需要执行pacman-key --init和pacman-key --populate archlinuxarm命令初始化pacman密钥环,才能正常安装程序。如果没有,在安装时会出现一堆错误提示。

error: binutils: signature from "Arch Linux ARM Build System " is unknown trust

:: File /var/cache/pacman/pkg/binutils-2.32-1-armv7h.pkg.tar.xz is corrupted (invalid or corrupted package (PGP signature)).

Do you want to delete it? [Y/n] n

顺便设置了一下镜像,镜像地址是拿的这篇文章里面的,使用的清华大学和中国科学技术大学。速度快了很多。

打开【/etc/pacman.d/mirrorlist】文件,

Server = http://mirrors.tuna.tsinghua.edu.cn/archlinuxarm/$arch/$repo

Server = http://mirrors.ustc.edu.cn/archlinuxarm/$arch/$repo

Server = http://mirrors.stuhome.net/archlinuxarm/$arch/$repo

把这三句添加到文件的开头,然后执行命令。

pacman -Syyu

.

parted /dev/sda

(parted) mklabel gpt

(parted) mkpart

Partition name? []?

File system type? [ext2]? xfs

Start? 0

End? 100%

(parted) print

.

mkfs.exfat /dev/sdb

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值