[Arch] 安裝(Virtualbox)
BIOS system
- 分割磁碟, /dev/sda1 給 1G,其餘給 /dev/sda2
fdisk /dev/sda
mkswap /dev/sda1 mkfs.ext4 /dev/sda2 mount /dev/sda2 /mnt swapon /dev/sda1
- 安裝(arch 核心、linux 核心、韌體)其他套件(非必要)
pacstrap -K /mnt base linux linux-firmware
pacstrap -K /mnt vim sudo openssh docker docker-compose bash-completion
- 產生 fstab
# -U Use UUIDs for source identifiers genfstab -U /mnt >> /mnt/etc/fstab
- Chroot
arch-chroot /mnt
- Time zone
ln -sf /usr/share/zoneinfo/Asia/Taipei /etc/localtime # generate /etc/adjtime hwclock --systohc
- Localization
在
/etc/locale.gen
裡面把en_US.UTF-8 UTF-8
、zh_TW.UTF-8 UTF-8
解除註解。locale-gen
echo "LANG=en_US.UTF-8" >> /etc/locale.conf
- Boot loader
pacman -S grub # don’t put the disk number sda1, just the disk name sda grub-install /dev/sda grub-mkconfig -o /boot/grub/grub.cfg
- Root password
passwd
- 重開機
exit unmount -R /mnt reboot
EFI system
首先在 virtualbox 硬體的部分將 EFI 打勾
- 分割磁碟,使用 GPT table,/dev/sda1, /dev/sda2 給 1G,其餘給 /dev/sda3
fdisk /dev/sda
mkswap /dev/sda1 mkfs.fat -F32 /dev/sda2 mkfs.ext4 /dev/sda3 # 注意順序,一定要先掛載根目錄再掛載 /mnt/boot/efi mount /dev/sda3 /mnt mount /dev/sda2 /mnt/boot/efi --mkdir swapon /dev/sda1
- 安裝(arch 核心、linux 核心、韌體)其他套件(非必要)
pacstrap -K /mnt base linux linux-firmware
pacstrap -K /mnt vim sudo openssh docker docker-compose bash-completion
- 產生 fstab
# -U Use UUIDs for source identifiers genfstab -U /mnt >> /mnt/etc/fstab
- Chroot
arch-chroot /mnt
- Time zone
ln -sf /usr/share/zoneinfo/Asia/Taipei /etc/localtime # generate /etc/adjtime hwclock --systohc
- Localization
locale-gen
echo "LANG=en_US.UTF-8" >> /etc/locale.conf
- Boot loader
pacman -S grub efibootmgr os-prober grub-install --target=x86_64-efi --bootloader-id=grub --efi-directory=/boot/efi grub-mkconfig -o /boot/grub/grub.cfg
- Root password
passwd
- 重開機
exit unmount -R /mnt reboot
Network configuration
touch /etc/hostname
使用內建的 systemd-networkd,新增檔案 /etc/systemd/network/default.network
[Match]
Name=*
[Network]
DHCP=yes
# enable
systemctl enable systemd-networkd
systemctl enable systemd-resolved
# start
systemctl start systemd-networkd
systemctl start systemd-resolved
openssh
systemctl enable sshd
systemctl start sshd
sudo user…
visudo,讓 %wheel 成為 sudor useradd -m naxo usermod -aG wheel naxo https://ostechnix.com/add-delete-and-grant-sudo-privileges-to-users-in-arch-linux/
新增國網中心 mirrot
/etc/pacman.d/mirrorlist
Server = https://mirror.archlinux.tw/ArchLinux/$repo/os/$arch