A Basic Arch Linux Installation

It's been a long time since I've been writing a blog, and I've been working so hard, I've been working so hard. So there's a lot of holes, like writing blogs.

Why Arch?

I've always been a Debian/Ubuntu user, and I used to be a Desktop. They've been used, and they're not intended for change, mainly as Server's OS for the years.

And Arch, I'm mostly looking at its high-momentability. I hope that Arch will return to Linux as the main production force for Desktop.

It should be good.

The installation note is a basic installation record, not only to the extent that it does not work, but not even for the user. Don't worry, take your time. I'll update the article later.

Learning materials

Machine Environment

I used it. VirtualBox To install a machine, two nuclear 2G, 64G hard drive.

And then I'm going to find a real machine to install, like a 2012 MBA.

All right, we're going to put the soo file in the vbox and start the installation.

Confirm UEFI mode

ls /sys/firmware/efi/efivars

Confirm Network

ping bilibili.com

Set Clock

timedetectl set-ntp true
timedatectl set-timezon Asia/Shanghai
timedatectl status

Set mirror

Edit Mirror List File

vim /etc/pacman.d/mirrorlist

Replace all mirrors with regular comments

:v/^\(#\|\s*$\)/ s/^/#/

Then put the big, middle-school mirror in the front.

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

## Arch Linux ...
##
## ...

Partition and Formatting

Division

Check current partition status

lsblk

Then we'll do a partitioning operation, a general SATA disk is sda, sdb, a NVME disk is nvme0n1, nvme1n2, and then I'll do it on my own.

cfdisk /dev/sda

You can use the original partition of Delete, then new partitions on Free Space, and you can set partition types through Type

  1. Build 256M in the first partition, and do not delete the use if it already exists, and use EFI System for the new recollection type
  2. The second partition is filled with almost all disks, with twice the memory capacity for the swap partition, the default Linux fieldstem
  3. The third partition swaps virtual memory, just run out of space, type Linux swap

And Write writes, to knock on yes, then Quit cfdissk, and check the partition.

lsblk

Formatting

Sda1 is an EFI partition, so if it exists, then do not delete or format it, or if it was new earlier.

mkfs.fat -F32 /dev/sda1

Formats sda2, with Btrfs

mkfs.btrfs -L Arch /dev/sda2

Formatting sda3

mkswap /dev/sda3

Create subrolls, mount sda2 to/mnt

mount -t btrfs -o compress=zstd /dev/sdxn /mnt

You can see the mounted.

df -h

Create two subrolls

btrfs subvolume create /mnt/@
btrfs subvolume create /mnt/@home

And then look at the subroll.

btrfs subvolume list -p /mnt

Unmount/mnt

umount /mnt

Mount a partition directory, to press Order Come on.

mount -t btrfs -o subvol=/@,compress=zstd /dev/sda2 /mnt
mkdir /mnt/home
mount -t btrfs -o subvol=/@home,compress=zstd /dev/sda2 /mnt/home
mkdir /mnt/boot
mount /dev/sda1 /mnt/boot
swapon /dev/sda3

We can check it out when it's over.

df -h
free -h

Installation of the system

Install Basic Packages

pacstrap /mnt base base-devel linux linux-firmware btrfs-progs

Deals with virtual console-related errors

If there's any in the installation,ERROR: file not found: '/etc/vconsole.conf'The mistake is that you have to create it yourself./etc/vconsole.conf

echo 'KEYMAP=us' > /mnt/etc/vconsole.conf

And regenerated. Initramfs Mirror That's how the system knows we added this file.

arch-chroot /mnt mkinitcpio -P

If you also suggest that the kernel module does not exist, run

arch-chroot /mnt pacman -Syu linux

Re-apply to kernel, re-enforce.

arch-chroot /mnt mkinitcpio -P

Install the necessary functionality software

pacstrap /mnt networkmanager vim sudo zsh zsh-completions

Generate fstab

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

Switch to New System

arch-chroot /mnt

Setup hostname and HOSTS

Edit hostname settings file

vim /etc/hostname

I set it up as funcman-arch

Note that host names can only contain letters, numbers, hyphens (-), dots (...) and underlineds

Set hosts

vim /etc/hosts

My Settings

127.0.0.1   localhost.localdomain localhost
::1         localhost.localdomain localhost
127.0.1.1   funcman-arch.localdomain funcman-arch

Added127.0.1.1It's not necessary. It's a way to avoid problems.

Set Time Zone & & & Zone

Link to the Timezone file.

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

Then we synchronize the time with the hardware.

hwclock --systohc

Set up Locale

Open Settings File

vim /etc/locale.gen

I found it.en_US.UTF-8 UTF-8andzh_CN.UTF-8 UTF-8, will#Remove the note.

And then I'll execute it.

locale-gen
echo 'LANG=en_US.UTF-8' > /etc/locale.conf

Set password for root users

passwd root

Enter the same password twice

Installing Microcodes

According to your CPU manufacturer, install the corresponding microcode.

pacman -S intel-ucode #Intel
pacman -S amd-ucode #AMD

I'm not going to need a virtual machine.

Install a Lead Program

pacman -S grub efibootmgr os-prober
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=ARCHBOOT

Edit GRUB configuration. Customize it.

vim /etc/default/grub

I found it.GRUB_CMDLINE_LINUX_DEFAULT, with the following modifications:

Generate Profile

grub-mkconfig -o /boot/grub/grub.cfg

End installation

Implementation

exit           #退回安装环境
umount -R /mnt #卸载新分区
reboot         #重启

Remember to remove the installed medium when restarting.

I'm done for now.