安装 Arch Linux

安装 Arch Linux

Acha
2023-07-26 / 0 评论 / 113 阅读 / 正在检测是否收录...
温馨提示:
本文最后更新于2023年09月25日,已超过453天没有更新,若内容或图片失效,请留言反馈。

Arch Linux

1、获取镜像

http://mirrors.163.com/archlinux/iso/latest/

2、安装前的准备

  1. 准备安装介质
  2. 启动到 Live 环境
  3. 验证引导模式
  4. 连接到互联网
  5. 更新系统时间
  6. 硬盘分区
  7. 格式化分区
  8. 挂载分区
# 验证引导模式
root@archiso ~ # [ -d /sys/firmware/efi/efivars/ ] && echo "Uefi" || echo "Bios" 
Uefi

磁盘

  • Uefi 磁盘分区选 GPT
  • Bios 磁盘分区选 MBR

grub 引导

# 获取 IP
root@archiso ~ # ip addr | awk '/inet / {print $2}' | grep -v "127.0.0.1/8"
10.52.17.32/24
root@archiso ~ # ping www.baidu.com -c 2
PING www.a.shifen.com (36.152.44.96) 56(84) bytes of data.
64 bytes from 36.152.44.96 (36.152.44.96): icmp_seq=1 ttl=57 time=6.32 ms
64 bytes from 36.152.44.96 (36.152.44.96): icmp_seq=2 ttl=57 time=6.75 ms

--- www.a.shifen.com ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 5135ms
rtt min/avg/max/mdev = 6.319/6.532/6.745/0.213 ms
root@archiso ~ # timedatectl set-timezone Asia/Shanghai 
root@archiso ~ # timedatectl status                     
               Local time: Tue 2023-04-04 13:16:06 CST
           Universal time: Tue 2023-04-04 05:16:06 UTC
                 RTC time: Tue 2023-04-04 05:16:06
                Time zone: Asia/Shanghai (CST, +0800)
System clock synchronized: yes
              NTP service: active
          RTC in local TZ: no

root@archiso ~ # mount /dev/mmcblk0p3 /mnt 
root@archiso ~ # mount --mkdir /dev/mmcblk0p1 /mnt/boot/efi
root@archiso ~ # swapon /dev/mmcblk0p2 

3、安装

  1. 配置镜像源
  2. 安装软件包
root@archiso ~ # nano /etc/pacman.d/mirrorlist
# 第一行添加
Server = https://mirrors.tuna.tsinghua.edu.cn/archlinux/$repo/os/$arch 
root@archiso ~ # pacman -Syy                                                                     
:: Synchronizing package databases...
 core
 extra                                        153.9 KiB   719 KiB/s 00:00 [#########################################] 100%
 community                                   1746.2 KiB  13.4 MiB/s 00:00 [#########################################] 100%
root@archiso ~ #  pacman -S archlinux-keyring
root@archiso ~ # pacstrap /mnt base base-devel linux-lts linux-firmware linux-lts-headers
pacstrap /mnt base base-devel linux-lts linux-firmware linux-lts-headers  48.63s user 29.30s system 85% cpu 1:31.19 total
root@archiso ~ # pacstrap /mnt networkmanager dhcpcd openssh vim git grub efibootmgr intel-ucode man-db man-pages ntfs-3g noto-fonts-cjk noto-fonts-emoji

4、安装后的配置

  1. 配置 Fstab
  2. Chroot
  3. 设置时区
  4. 设置区域语言
  5. 网络配置 & 主机名
  6. root 密码
  7. 安装引导程序
  8. 重启

root@archiso ~ # genfstab -U /mnt >> /mnt/etc/fstab
root@archiso ~ # cat /mnt/etc/fstab 
# Static information about the filesystems.
# See fstab(5) for details.

# <file system> <dir> <type> <options> <dump> <pass>
# /dev/mmcblk0p3
UUID=c7bfd5b1-7e6b-4ae5-b483-e1b4a2ed2674       /               ext4            rw,relatime     0 1

# /dev/mmcblk0p1
UUID=4973-14CE          /boot           vfat            rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro     0 2

# /dev/mmcblk0p2
UUID=5c75e41d-ee5a-4e2f-9346-eafc20ae1b1a       none            swap            defaults        0 0
root@archiso ~ # arch-chroot /mnt
[root@archiso /]# ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
[root@archiso /]# date
Tue Apr  4 14:00:44 CST 2023
[root@archiso /]# hwclock --systohc
[root@archiso /]# vim /etc/locale.gen 
# 171
en_US.UTF-8 UTF-8  
# 496
zh_CN.UTF-8 UTF-8
[root@archiso /]# locale-gen 
Generating locales...
  en_US.UTF-8... done
  zh_CN.UTF-8... done
Generation complete.
[root@archiso /]# echo "Arch" > /etc/hostname
[root@archiso /]# passwd 
New password: 
Retype new password: 
passwd: password updated successfully

[root@archiso /]# useradd -m acha -G wheel
[root@archiso /]# passwd acha
New password: 
Retype new password: 
passwd: password updated successfully
0

评论

博主关闭了当前页面的评论