本文永久地址:https://my.oschina.net/bysu/blog/1557801
下载:
下载(不得不吐槽,官网上的指引好像下载不了,还是我没找对,反正找了好久)
到http://sg.mirror.archlinuxarm.org/os/中下载
或直接到下面链接下载
http://sg.mirror.archlinuxarm.org/os/ArchLinuxARM-rpi-3-latest.tar.gz
顺便贴上fedora的下载地址:
https://mirrors.tuna.tsinghua.edu.cn/fedora/releases/26/Spins/armhfp/images/Fedora-LXQt-armhfp-26-1.5-sda.raw.xz
centos7的下载地址
http://mirror.centos.org/altarch/7/isos/armhfp/CentOS-Userland-7-armv7hl-Minimal-1708-RaspberryPi3.img.xz
安装Archlinux
安装Archlinux这部分在Linux系统中测试通过。sdX是SD卡盘符。
譬如我通过df -h查到是/dev/sdb1,那么这里就是sdb.
SD卡分区
使用fdisk工具 # fdisk /dev/sdX
在fdisk提示命令下删除旧分区并新建:
a. 按o 删除全部分区
b. 按p列出分区,此时应该没有任何分区。
c. 按n新建分区, 然后p选择为主分区, 输入1作为SD卡的第1个主分区; 按回车选择默认开始扇区,再输入+100M设置结束扇区.
d. 按t,然后按c设置刚才的主分区类型为W95 FAT32(LBA).
e. 按n新建分区,然后p选择为主分区,输入2作为SD卡的第2个主分区;按两次回车默认把SD卡剩下的空间都给第2主分区.
f. 按w写入保存分区, 退出fdisk.
[bysu@localhost ~]$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 18G 3.5G 14G 21% /
tmpfs 931M 232K 931M 1% /dev/shm
/dev/sda1 291M 39M 238M 14% /boot
/dev/sdb1 30G 96K 30G 1% /media/FEDORA
[bysu@localhost ~]$ sudo fdisk /dev/sdb
[sudo] password for bysu:
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').
Command (m for help): p #1.按p列出分区,可以查看到分区/dev/sdb1
Disk /dev/sdb: 31.9 GB, 31914983424 bytes
255 heads, 63 sectors/track, 3880 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Device Boot Start End Blocks Id System
/dev/sdb1 1 3880 31162004 c W95 FAT32 (LBA)
Command (m for help): o #2.按o删除全部分区
Building a new DOS disklabel with disk identifier 0x8a4c7423.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').
Command (m for help): p #3.按p列出分区,此时应该没有任何分区
Disk /dev/sdb: 31.9 GB, 31914983424 bytes
255 heads, 63 sectors/track, 3880 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x8a4c7423
Device Boot Start End Blocks Id System
Command (m for help): n #4.输入n,然后回车.新建分区
Command action
e extended
p primary partition (1-4)
p #5.输入p,然后回车.选择为主分区
Partition number (1-4): 1 #6.输入1作为SD卡的第1个主分区;
First cylinder (1-3880, default 1): #7.此处直接点击回车键,选择开始值,默认为1
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-3880, default 3880): +100M #8.输入"+100M"(不包括双引号),然后回车
Command (m for help): t #9.输入t,然后回车键
Selected partition 1
Hex code (type L to list codes): c #10.按c设置刚才的主分区类型为W95 FAT32(LBA)
Changed system type of partition 1 to c (W95 FAT32 (LBA))
Command (m for help): n #11.输入n,然后回车,新建分区
Command action
e extended
p primary partition (1-4)
p #12.输入p,然后回车,选择为主分区
Partition number (1-4): 2 #13.输入2,然后回车.设置第2个主分区
First cylinder (15-3880, default 15): #14.按两次回车键,默认把SD卡剩下的空间都给第2主分区.
Using default value 15
Last cylinder, +cylinders or +size{K,M,G} (15-3880, default 3880):
Using default value 3880
Command (m for help): w #15.输入w,然后回车.把配置写入磁盘,并保存分区, 退出fdisk.
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)
WARNING: If you have created or modified any DOS 6.x
partitions, please see the fdisk manual page for additional
information.
Syncing disks.
格式化和挂载分区
把第1主分区格式化为FAT分区,并挂载到boot: # mkfs.vfat /dev/sdX1
# mkdir boot
# mount /dev/sdX1 boot
把第2分区格式化为ext4分区,并挂载到root: # mkfs.ext4 /dev/sdX2
# mkdir root
# mount /dev/sdX2 root
下载树莓派Archlinux ARM版本, 安装到SD卡 # wget http://archlinuxarm.org/os/ArchLinuxARM-rpi-latest.tar.gz
# tar -zxpf ArchLinuxARM-rpi-latest.tar.gz -C root
# sync
# mv root/boot/* boot
安装完成,卸载分区 # umount boot root
系统安装完成
Archlinux镜像已经安装成功,连上网线,插上电源,可以直接SSH到树莓派了。
默认用户名和密码分别为:alarm 和alarm
管理员用户名和密码分别为:root和root
管理员帐号无法远程登录
一直听说arch是相当极简,所以进入之后,第一时间查看内存的使用
[root@alarm bysu]# free -h
total used free shared buff/cache available
Mem: 909M 57M 755M 276K 96M 837M
Swap: 0B 0B 0B
整个磁盘的使用情况
[root@alarm bysu]# df -h
Filesystem Size Used Avail Use% Mounted on
dev 420M 0 420M 0% /dev
run 455M 276K 455M 1% /run
/dev/mmcblk0p2 30G 903M 27G 4% /
tmpfs 455M 0 455M 0% /dev/shm
tmpfs 455M 0 455M 0% /sys/fs/cgroup
tmpfs 455M 0 455M 0% /tmp
/dev/mmcblk0p1 110M 58M 52M 53% /boot
tmpfs 91M 0 91M 0% /run/user/1001
[root@alarm bysu]# fdisk -l
Disk /dev/mmcblk0: 29.7 GiB, 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
Disklabel type: dos
Disk identifier: 0x8a4c7423
Device Boot Start End Sectors Size Id Type
/dev/mmcblk0p1 63 224909 224847 109.8M c W95 FAT32 (LBA)
/dev/mmcblk0p2 224910 62332199 62107290 29.6G 83 Linux
配置Archlinux
1.新增用户及其相应的家目录
#新增用户
useradd -d /home/bysu -m bysu #使用root用户
#设置密码
passwd bysu #使用root用户
添加国内源
编辑 /etc/pacman.d/mirrorlist
在文件头部添加:
清华软件源:Server = http://mirrors.tuna.tsinghua.edu.cn/archlinuxarm/$arch/$repo
中科大软件源:Server = http://mirrors.ustc.edu.cn/archlinuxarm/$arch/$repo
更新软件源:
# pacman -Syyu
安装SUDO
安装sudo:
# pacman -S sudo
输入 visudo 去掉 #%wheel ALL=(ALL) ALL 此行注释,使wheel用户组可以临时使用sudo 提高权限.
# visudo
参考教材:
系统安装:
http://www.jianshu.com/p/be4a44a54b65
添加用户
http://www.cnblogs.com/kex1n/p/5199109.html