2 min
6

Cài đặt Artix Linux

Ghi chú về cài đặt Artix Linux

  • #linux
  • #artix

Thiết lập mạng

Mở khóa bộ điều hợp wifi và bật interface, sau đó dùng `connmanctl` để kết nối mạng wifi.
  • `rfkill unblock wifi` — bật phần cứng wifi nếu đang bị soft-block
  • `ip link set wlan0 up` — bật interface không dây
  • `connmanctl` — mở shell tương tác của ConnMan
terminal
rfkill unblock wifiip link set wlan0 upconnmanctlconnmanctl> scan wificonnmanctl> servicesconnmanctl> agent onconnmanctl> connect wifi_<ssid>

Thiết lập ổ đĩa

Phân vùng ổ đĩa, format các phân vùng, mount chúng, rồi cài base system.
  • `lsblk` — liệt kê tất cả block device để tìm ổ đích
  • `cfdisk` — trình phân vùng tương tác, tạo 2 phân vùng: EFI (FAT32) và root (ext4)
  • `mkfs.fat -F32` — format phân vùng đầu thành FAT32 cho EFI
  • `mkfs.ext4` — format phân vùng thứ hai thành ext4 cho root
  • Mount root vào `/mnt` và EFI vào `/mnt/boot/efi`
  • `basestrap` — cài base system (tương đương `pacstrap` trên Artix)
  • `fstabgen` — tạo `/etc/fstab` bằng UUID
terminal
lsblkcfdisk /dev/{name_disk}mkfs.fat -F32 /dev/{name_disk}1mkfs.ext4 /dev/{name_disk}2mount /dev/{name_disk}2 /mntmount --mkdir /dev/{name_disk}1 /mnt/boot/efibasestrap /mnt base base-devel runit elogind-runit linux linux-firmware vim intel-ucodefstabgen -U /mnt >> /mnt/etc/fstab

Thiết lập hệ thống

Chroot vào hệ thống mới để cấu hình.
terminal
artix-chroot /mnt

Tạo swap file

Tạo swap file 3GB và thêm vào `/etc/fstab` để giữ sau khi reboot.
terminal
dd if=/dev/zero of=/swapfile bs=1G count=3 status=progresschmod 600 /swapfilemkswap /swapfileswapon /swapfilevim /etc/fstabswapon --show

Đặt múi giờ và đồng hồ

  • `ln -sf` — symlink file múi giờ tới `/etc/localtime`
  • `hwclock --systohc` — đồng bộ hardware clock với system time
terminal
ln -sf /usr/share/zoneinfo/Asia/Ho_Chi_Minh /etc/localtimels -l /etc/localtimehwclock --systohc

Đặt locale

Bỏ comment dòng `en_US.UTF-8 UTF-8` trong `/etc/locale.gen`, rồi generate locale.
terminal
vim /etc/locale.gen # uncomment: en_US.UTF-8 UTF-8locale-genvim /etc/locale.conf # add: LANG=en_US.UTF-8

Đặt hostname và hosts

terminal
vim /etc/hostname # add: artixvim /etc/hosts

Đặt mật khẩu root

terminal
passwd

Cài các gói thiết yếu

Cài bootloader, network manager và các công cụ thiết yếu khác.
terminal
pacman -S grub efibootmgr neovim networkmanager networkmanager-runit network-manager-applet xdg-utils xdg-user-dirs

Bật dịch vụ NetworkManager

Artix dùng runit, nên tạo symlink để bật dịch vụ.
terminal
ln -s /etc/runit/sv/NetworkManager/ /etc/runit/runsvdir/current

Cài bootloader GRUB

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

Tạo user

  • `useradd -mG wheel` — tạo user có thư mục home và thêm vào nhóm `wheel`
  • `visudo` — bỏ comment `%wheel ALL=(ALL) ALL` để cho phép sudo
terminal
useradd -mG wheel baichupasswd baichuEDITOR=vim visudo # uncomment: %wheel ALL=(ALL) ALL

Thoát và khởi động lại

terminal
exitumount -R --lazy /mntreboot

Tài liệu tham khảo

>Newsletter

Stay Updated

Get notified when I publish new articles, tutorials, and project updates. Subscribe for insights and actionable content.