# arch安裝步驟 [toc] ## inputrc設定檔 :::success $include /etc/inputrc "\C-p":history-search-backward "\C-n":history-search-forward set colored-stats On #set completion-ignore-case On set completion-prefix-display-length 3 set mark-symlinked-directories On set show-all-if-ambiguous On set show-all-if-unmodified On set visible-stats On #set editing-mode vi ::: ## ip usage :::success ip addr add 10.121.12.128/16 dev eno1 ip route add default via 10.121.254.254 ::: ## 設定語言 設定鍵盤 :::success ls /usr/share/kbd/keymaps/**/*.map.gz loadkeys de-latin1 ::: ## arch安裝在UEFI磁區 使用**cfdisk** 將硬碟的分割區 分成以下的partition 也要用grub-install 來寫入bootloader 要安裝**efibootmgr**套件 :::success /dev/sda1 EFI # mkfs.fat -F 32 /dev/sda2 swap # mkswap /dev/sda3 ext4 # mkfs.ext4 mount /dev/sda3 /mnt mount --mkdir /dev/sda1 /mnt/boot swapon /dev/sda2 ::: ## 安裝arch基本套件 :::success pacstrap -K /mnt base linux linux-firmware grub efibootmgr genfstab -U /mnt >> /mnt/etc/fstab arch-chroot /mnt #chroot 進入/mnt ln -sf /usr/share/zoneinfo/Asia/Taiepi /etc/localtime hwclock --systohc ::: ### 設定locale :::success echo 'LANG=zh_TW.UTF-8' >> /etc/locale.conf 編輯/etc/locale.gen 找出zh_TW.UTF-8 然後生出其locale 執行locale-gen 執行 mkinitcpio -P passwd 設定密碼 root ::: ### 使用UEFI開機Unified Extensible Firmware Interface :::success * grub-install --target=x86_64-efi --efi-directory=/boot --recheck /dev/sda * grub-mkconfig -o /boot/grub/grub.cfg * 使用UEFI開機模式 使用cfdisk 來分割EFI磁區 否則efibootmgr無法加入上 GRUB UEFI boot entry 以及進入安全模式fallback This whole article assumes that inserting additional GRUB2 modules via insmod is possible. As discussed in Unified Extensible Firmware Interface/Secure Boot#shim with key and GRUB, this is not the case on UEFI systems with Secure Boot enabled. If you want to use any additional GRUB module that is not included in the standard GRUB EFI file grubx64.efi on a Secure Boot system, you have to re-generate the GRUB EFI grubx64.efi with grub-mkstandalone with the additional GRUB modules included. ::: ### 使用GPT開機 GUID Partition Table :::success 在BIOS/GPT組態 在作磁碟分割時 要選定GPT磁區 BIOS boot partition GRUB會嵌入core.img GPT會作出此額外的磁區 there is no guaranteed unused space before the first partition. 若使用UEFI磁區 並不需要額外的磁區 this extra partition is not required, 因為不需要嵌入此額外的開機區 但是UEFI開機方式 需要先分割出EFI磁區 ::: ### 設定grub開機 bootloader :::success grub-install --target=x86_64-efi --efi-directory=**esp** --bootloader-id=GRUB grub-install -- target=i386-pc /dev/sda 沒有出現錯誤訊息 grub-mkconfig -o /boot/grub/grub.cfg 作出開機順序設定檔 ::: ## EFI開機方式 若是設定使用EFI開機 則可以使用下列指令 此時設定**esp**目錄夾為**/boot/grub/x86_64-efi/** :::success grub-install --target=x86_64-efi --efi-directory=**esp** --bootloader-id=GRUB :::