見出し画像

Arch Linux すゝめ

手順

コンソールのキーボードレイアウトを設定する

loadkeys jp106

システムクロックを更新する

timedatectl set-timezone Asia/Tokyo
timedatectl # 確認

ディスクをパーティション分割する

fdisk -l # 確認

パーティション削除

fdisk /dev/nvme0n1
Command (m for help): p # パーティション確認
Command (m for help): d # パーティション削除
Command (m for help): w # 書き込み

パーティション作成

fdisk /dev/nvme0n1
Command (m for help): g # GPT作成

EFI system partition(1GiB)

Command (m for help): n
Partition number: 1
First sector: (Enter)
Last sector: +1G

Command (m for help): t
Partition number: 1
Type: 1   # EFI System

Linux swap(4GiB)

Command (m for help): n
Partition number: 2
First sector: (Enter)
Last sector: +4G

Command (m for help): t
Partition number: 2
Type: 19  # Linux swap

Linux x86-64 root /(残り全部)

Command (m for help): n
Partition number: 3
First sector: (Enter)
Last sector: (Enter)

パーティション確定

Command (m for help): w # 書き込み

パーティションをフォーマットする

# EFI
mkfs.fat -F 32 /dev/nvme0n1p1

# swap
mkswap /dev/nvme0n1p2

# root
mkfs.ext4 /dev/nvme0n1p3

ファイルシステムをマウントする

# root
mount /dev/nvme0n1p3 /mnt

# EFI
mount --mkdir /dev/nvme0n1p1 /mnt/boot

# swap
swapon /dev/nvme0n1p2

必須パッケージをインストールする

pacstrap -K /mnt base linux linux-firmware
pacman -S amd-ucode

テキストエディッター

pacman -S vi
echo "set number" >> ~/.vimrc # 行番号表示

システムを構成する

# フスタブ
genfstab -U /mnt >> /mnt/etc/fstab

# クルート
arch-chroot /mnt

# 時間
ln -sf /usr/share/zoneinfo/Asia/Tokyo /etc/localtime
hwclock --systohc

# ローカリゼーション
locale-gen
cat /etc/locale.conf # 中身確認
echo "LANG=en_US.UTF-8" > /etc/locale.conf # 上書き保存
cat /etc/vconsole.conf # 中身確認
echo "KEYMAP=jp106" > /etc/vconsole.conf # 上書き保存

# ネットワーク構成
echo "yourhostname" > /etc/hostname

# ルートパスワード
passwd

# ブートローダー(GRUB)
pacman -S grub efibootmgr os-prober
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB
grub-mkconfig -o /boot/grub/grub.cfg

# リブート
exit
reboot

# ログイン
root

参考

インストールガイド - ArchWiki
https://wiki.archlinux.org/title/Installation_guide