Installation guide (正體中文)
此文件是個引導你透過官方安裝映像的 Live 系統安裝 Arch Linux 的教學。在安裝前,建議先閱讀 FAQ。關於此文件使用的慣例字詞,請閱讀 Help:Reading。一些情況下,範例程式碼可能包含佔位符(以斜體
格式化),其需要手動替換。
更詳細的資源可以參考 ArchWiki 文章,或者閱讀該命令的 man page。如需要互動式幫助,可以使用 IRC channel 及 英文論壇。
Arch Linux 可在任何 RAM 不小於 512MB 的 x86_64 相容機器上運作。用 base 軟體包群組內的所有軟體包進行基本安裝將佔用小於 800MB 的硬碟空間。由於安裝過程中需要從遠端軟體庫取得軟體包,因此需要連線到網際網路。
Contents
安裝前的準備
根據取得並安裝 Arch (英文)中所述,下載並引導安裝媒介。啟動完成後將會自動以 root 使用者身份登入虛擬終端器(virtual console)並進入 Zsh 命令解譯器。
欲切換至其它的虛擬終端器,例如在安裝過程使用 ELinks 來查看本篇指南,使用 Alt+arrow
快捷鍵(shortcut)。可使用 nano、vi 或 vim 來編輯(edit)設定檔案。
設定鍵盤配置
預設的鍵盤配置(console keymap)為 US 配置。可使用以下指令列出所有配置:
# ls /usr/share/kbd/keymaps/**/*.map.gz
欲更改鍵盤配置,需將對應的檔案名稱,省略路徑和副檔名附加到 loadkeys(1) 中。例如,要附加 German 鍵盤配置:
# loadkeys de-latin1
終端字體位於 /usr/share/kbd/consolefonts/
,設定方式請參考 setfont(8)。
確認啟動模式
如果在 UEFI 主機板上有啟用 UEFI 模式的話,Archiso 將會根據 systemd-boot 給出的設定引導 Arch Linux。若要驗證是否啟用,請使用 ls 指令列出 efivars 資料夾:
# ls /sys/firmware/efi/efivars
如果資料夾不存在,系統可能將會以 BIOS 或 CSM 模式啟動。參閱您的主機板說明了解詳細資訊。
連線到網際網路
安裝媒體啟用了 dhcpcd 守護程序用來在開機時連線有線網路裝置。若要確認是否連上網路,可使用 ping 檢查:
# ping archlinux.org
如果沒有網路,則請使用 systemctl stop dhcpcd@interface
停止 dhcpcd 服務,interface
名稱可以用 Tab 自動完成。
更新系統時間
執行 timedatectl(1) 確保系統時間是準確的:
# timedatectl set-ntp true
可以執行 timedatectl status
檢查系統時間的服務狀態。
Partition the disks 分割硬碟(待翻譯)
When recognized by the live system, disks are assigned to a block device such as /dev/sda
or /dev/nvme0n1
. To identify these devices, use lsblk or fdisk.
# fdisk -l
Results ending in rom
, loop
or airoot
may be ignored.
The following partitions are required for a chosen device:
- One partition for the root directory
/
. - If UEFI is enabled, an EFI system partition.
To modify partition tables, use fdisk or parted.
# fdisk /dev/sda
See Partitioning for more information.
Format the partitions 格式化分割
Once the partitions have been created, each must be formatted with an appropriate file system. For example, to format the root partition on /dev/sda1
with ext4
, run:
分區一旦建立,每個分區都要用適當的檔案系統(file system)進行格式化。例如,欲將 /dev/sda1
格式化成 ext4
,可執行:
# mkfs.ext4 /dev/sda1
If you created a partition for swap (for example /dev/sda3
), initialize it with mkswap:
如果您創建了 swap 分割(例如 /dev/sda3
),使用 mkswap 將其初始化:
# mkswap /dev/sda3 # swapon /dev/sda3
See File systems#Create a file system for details.
詳情參見(File systems#Create a file system)。
Mount the file systems 掛載檔案系統
Mount the file system on the root partition to /mnt
, for example:
首先將根分割掛載(Mount)到 /mnt
,例如:
# mount /dev/sda1 /mnt
Create mount points for any remaining partitions and mount them accordingly:
為其它分割創建目錄並掛載它們:
# mkdir /mnt/boot # mount /dev/sda2 /mnt/boot
genfstab will later detect mounted file systems and swap space.
genfstab 會自動檢測掛載的檔案系統和 swap 分割。
Installation 安裝
Select the mirrors 選擇鏡像站(待翻譯)
Packages to be installed must be downloaded from mirror servers, which are defined in /etc/pacman.d/mirrorlist
. On the live system, all mirrors are enabled, and sorted by their synchronization status and speed at the time the installation image was created.
The higher a mirror is placed in the list, the more priority it is given when downloading a package. You may want to edit the file accordingly, and move the geographically closest mirrors to the top of the list, although other criteria should be taken into account.
This file will later be copied to the new system by pacstrap, so it is worth getting right.
Install the base packages 安裝系統基本套件
Use the pacstrap script to install the base package group:
# pacstrap /mnt base
This group does not include all tools from the live installation, such as btrfs-progs or specific wireless firmware; see packages.x86_64 for comparison.
這個套件組沒有包含全部 Live 安裝環境中的工具,例如 btrfs-progs 或是特定的無線裝置的韌體。 差異請見 packages.x86_64。
To install packages and other groups such as base-devel, append the names to pacstrap (space separated) or to individual pacman commands after the #Chroot step.
安裝(install)其他套件或套件組例如 base-devel,請將它們的名稱添加到 pacstrap 之後並用空格隔開。也可以在 #Chroot 後使用 pacman 個別安裝。
Configure the system 系統設置
Fstab
Generate an fstab file (use -U
or -L
to define by UUID or labels, respectively):
用以下命令生成 fstab 文件(用 -U
或 -L
以使用 UUID 或分割標籤(Partition labels)):
# genfstab -U /mnt >> /mnt/etc/fstab
Check the resulting file in /mnt/etc/fstab
afterwards, and edit it in case of errors.
執行完後檢查一下生成的 /mnt/etc/fstab
文件是否正確,如有錯需立即更正。
Chroot
Change root into the new system:
Change root 到新系統:
# arch-chroot /mnt
Time zone 時區
Set the time zone:
設置時區(time zone):
# ln -sf /usr/share/zoneinfo/Region/City /etc/localtime
Run hwclock(8) to generate /etc/adjtime
:
執行 hwclock(8) 以生成 /etc/adjtime
:
# hwclock --systohc
This command assumes the hardware clock is set to UTC. See System time#Time standard for details.
這個命令假定硬體時間已經被設置為 UTC 時間。詳細資訊請看 System time#Time standard。
Localization 語言環境
Uncomment en_US.UTF-8 UTF-8
and other needed locales in /etc/locale.gen
, and generate them with:
# locale-gen
Set the LANG
variable in locale.conf(5) accordingly, for example:
/etc/locale.conf
LANG=en_US.UTF-8
If you set the keyboard layout[broken link: invalid section], make the changes persistent in vconsole.conf(5):
/etc/vconsole.conf
KEYMAP=de-latin1
Network configuration 網路設置
Create the hostname file:
創建 hostname 文件:
/etc/hostname
myhostname
Add matching entries to hosts(5):
並添加對應的項目到 hosts(5):
/etc/hosts
127.0.0.1 localhost ::1 localhost 127.0.1.1 myhostname.localdomain myhostname
If the system has a permanent IP address, it should be used instead of 127.0.1.1
.
如果系統擁有一個永久的 IP 位址,請使用該 IP 位址而不是 127.0.1.1
。
Complete the network configuration for the newly installed environment.
為新安裝的環境完成網路設置 (network configuration)。
Initramfs
Creating a new initramfs is usually not required, because mkinitcpio was run on installation of the linux package with pacstrap.
你通常不需創建 initramfs,因為在執行 pacstrap 安裝 linux 套件時, mkinitcpio 即會被自動執行。
For special configurations, modify the mkinitcpio.conf(5) file and recreate the initramfs image:
如有特殊配置的需求,可更改 mkinitcpoi.conf(5)[dead link 2018-09-22] 並執行以下命令重新創建一個 Initramfs:
# mkinitcpio -p linux
Root password Root 密碼
Set the root password:
設置 root 密碼(password):
# passwd
Boot loader 開機引導程式
A Linux-capable boot loader must be installed in order to boot Arch Linux. See Category:Boot loaders for available choices.
你需要安裝與 Linux 相容的開機引導程式(boot loader)以在安裝完成後啟動 Arch Linux。可用的開機程式請參考 Category:Boot loaders。
If you have an Intel or AMD CPU, enable microcode updates.
如果你使用的是 Intel 或 AMD 的 CPU,請開啟微碼(Microcode)更新。
Reboot 重新啟動
Exit the chroot environment by typing exit
or pressing Ctrl+D
.
執行 exit
或按 Ctrl+D
退出 chroot 環境。
Optionally manually unmount all the partitions with umount -R /mnt
: this allows noticing any "busy" partitions, and finding the cause with fuser(1).
可以執行 umount -R /mnt
以手動卸載被掛載的分區:這有助於發現任何「繁忙」的分區,並通過 fuser(1) 查找原因。
Finally, restart the machine by typing reboot
: any partitions still mounted will be automatically unmounted by systemd. Remember to remove the installation media and then login into the new system with the root account.
最后,通過執行 reboot
重新啓動系統,systemd 將自動卸載掛載中的任何分區。並記得移除安裝媒介,然後使用 root 帳戶登入新系統。
Post-installation 安裝後
See General recommendations for system management directions and post-installation tutorials (like setting up a graphical user interface, sound or a touchpad).
系統管理引導,圖形使用者介面安裝、聲音管理、觸控板等後期工作參考 General recommendations。
For a list of applications that may be of interest, see List of applications.
感興趣的各類程式,請參考 List of applications。