此篇文章主要记录 UEFT 启动方式安装系统。

制作启动U盘

打开下载页面,在China分类中选择合适的镜像站点下载。

下载etcher工具,使用此工具,将启动镜像写入到U盘。

安装系统

Arch Linux 安装镜像不支持安全启动(Secure Boot)。须在Bios中关闭安全启动,当系统安装完成之后,可打开。

联网验证

系统安装过程中需要使用互联网,使用下面命令验证否是可连接互联网。

ping www.baidu.com

更新系统时间

timedatectl set-ntp true timedatectl status

硬盘分区

使用 将分区表转为 GPT

pc ~ # parted /dev/sdc GNU Parted 2.3 Using /dev/sdc Welcome to GNU Parted! Type 'help' to view a list of commands. (parted) mklabel GPT Warning: The existing disk label on /dev/sdc will be destroyed and all data on this disk will be lost. Do you want to continue? Yes/No? Yes (parted) mkpart primary 2048s 100% (parted) q Information: You may need to update /etc/fstab.

使用命令查看硬盘分区

lsblk

选中要操作的硬盘进行分区操作

cfdisk /dev/sda

分区建议

UEFI 与 GPT

| 挂载点 | 分区类型 | 建议大小| /mnt/boot 或 /mnt/efi | EFI 系统分区 | 512 MiB| [SWAP] | Linux swap (交换空间) | 大于 512 MiB| /mnt | Linux x86-64 根目录 (/) | 剩余空间

格式化分区

1、格式化根分区

mkfs.ext4 /dev/root_partition

2、格式化交换分区

mkswap /dev/swap_partition

挂载分区

将根目录挂载至 /mnt 目录,然后新建 /mnt/boot 文件夹,挂载 EFI 分区

mount /dev/root_partition(根分区) /mnt mkdir /mnt/boot mount /dev/root_partition(EFI分区) /mnt/boot

启用交换分区

swapon /dev/swap_partition(交换空间分区)

选中合适镜像站点

我选用清华Mirrors镜像站点,使用 vim 编辑 /etc/pacman.d/mirrorlist 文件,在第一行加入下面文字:

Server = https://mirrors.tuna.tsinghua.edu.cn/archlinux/$repo/os/$arch

安装系统

pacstrap /mnt base base-devel linux linux-firmware vim

生成fstab文件

genfstab -U /mnt >> /mnt/etc/fstab

切换正式系统

arch-chroot /mnt

设置时间

ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime hwclock --systohc

本地化

1、使用 Vim 编辑 /etc/locale.gen 文件,找到 en_US.UTF-8、zh_CN.UTF-8 两行,将前面的#去除(去除注释)。

2、生成对应信息

locale-gen

3、使用 Vim 编辑 /etc/locale.conf 文件,没有则创建,写入下面字符

LANG=en_US.UTF-8

网络配置

1、创建并写入hostname,这里hostname是计算机名称

vim /etc/hostname

2、编辑/etc/hosts文件,写入下面信息

127.0.0.1 localhost ::1 localhost 127.0.1.1 ${计算机名称}.localdomain ${计算机名称}

root 创建密码

passwd

安装基本的包

pacman -S grub efibootmgr networkmanager network-manager-applet dialog wireless_tools wpa_supplicant os-prober mtools dosfstools ntfs-3g linux-headers reflector git sudo

安装微码文件

1、Intel

pacman -S intel-ucode

2、AMD

pacman -S amd-ucode

配置引导

grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=Arch grub-mkconfig -o /boot/grub/grub.cfg

退出U盘系统,并重启

重启时,建议拔掉U盘。

exit umount -a reboot

正式系统

此时安装在硬盘上的Arch Linux是没有桌面环境的,先使用上面的 root 用户,进行登录,然后下面进行配置。

配置网络

如果使用路由器接网线,输入下面的命令,使用ping验证,如果不生效,重启一波。

systemctl enable --now NetworkManager

WIFI使用下命令连接wifi

nmtui

创建用户并授权

1、创建用户

useradd -m -G wheel liaocp

2、设置密码

passwd liaocp

3、授权

EDITOR=vim visudo

找到 %wheel ALL=(ALL) ALL,删除前的#,去除注释。

安装显卡驱动

1、如果是AMD集显

pacman -S xf86-video-amdgpu

2、如果是NVIDIA独显

pacman -S nvidia nvidia-utils

安装桌面环境

1、安装XOrg、gdm、gnome

pacman -S xorg pacman -S gdm pacman -S gnome

2、设置开机自启

systemctl enable gdm

3、安装中文字体

pacman -S ttf-sarasa-gothic

重启

重启就可以进入带有桌面环境的系统了

reboot
参考文章 1、[https://wiki.archlinux.org/title/Installation_guide](https://wiki.archlinux.org/title/Installation_guide) 2、[https://zhuanlan.zhihu.com/p/138951848](https://zhuanlan.zhihu.com/p/138951848)