Installation guide (正體中文)

From ArchWiki
Jump to: navigation, search
翻譯狀態: 本文章是 Installation_guide 的翻譯版本。最近一次的翻譯時間:2018-09-19。點擊本連結查看英文頁面之後的變更。

This document is a guide for installing Arch Linux from the live system booted with the official installation image. Before installing, it would be advised to view the FAQ. For conventions used in this document, see Help:Reading. In particular, code examples may contain placeholders (formatted in italics) that must be replaced manually.

此文件是個引導你透過官方安裝映像的 Live 系統安裝 Arch Linux 的教學。在安裝前,建議先閱讀 FAQ。關於此文件使用的慣例,請閱讀 Help:Reading。一些情況下,範例程式碼可能包含佔位符(以 italics 格式化),其需要手動替換。

For more detailed instructions, see the respective ArchWiki articles or the various programs' man pages, both linked from this guide. For interactive help, the IRC channel and the forums are also available.

更詳細的資源,可以參考 ArchWiki 文章,或者閱讀該命令的 man page。如需要互動式幫助,可透過 IRC channelforums

Arch Linux should run on any x86_64-compatible machine with a minimum of 512 MB RAM. A basic installation with all packages from the base group should take less than 800 MB of disk space. As the installation process needs to retrieve packages from a remote repository, this guide assumes a working internet connection is available.

Arch Linux 可在任何 RAM 不小於 512MB 的 x86_64 相容機上運行。用 base 套件組內的所有套件進行基本安裝將占用小於 800MB 的硬碟空間。由於安裝過程中需要從遠程存儲庫獲取軟件包,機器需要連結到網際網路。

Pre-installation 安裝前的準備

Download and boot the installation medium as explained in Getting and installing Arch. You will be logged in on the first virtual console as the root user, and presented with a Zsh shell prompt.

根據 Getting and installing Arch 中所述,下載並引導安裝媒介。啟動完成後將會自動以 root 身份登錄虛擬控制台(virtual console)並進入 Zsh 命令解譯器。

To switch to a different console—for example, to view this guide with ELinks alongside the installation—use the Alt+arrow shortcut. To edit configuration files, nano, vi and vim are available.

欲切換至其它的虛擬終端,例如使用 ELinks 來查看本篇指南,使用 Alt+arrow 快捷鍵(shortcut)。可使用 nanovivim 來編輯(edit)配置文件。

Set the keyboard layout 設置鍵盤配置

The default console keymap is US. Available layouts can be listed with:

預設的鍵盤配置(console keymap)為 US。執行以下命令以列出所有配置:

# ls /usr/share/kbd/keymaps/**/*.map.gz

To modify the layout, append a corresponding file name to loadkeys(1), omitting path and file extension. For example, to set a German keyboard layout:

欲更改鍵盤配置,需將對應的文件名添加經 loadkeys(1),並省略路徑和副檔名。例如,欲添加 German 鍵盤配置:

# loadkeys de-latin1

Console fonts are located in /usr/share/kbd/consolefonts/ and can likewise be set with setfont(8).

Console fonts 位於 {{ic|/usr/share/kbd/consolefonts/},設置方式請參考 setfont(8)

Verify the boot mode 確認啟動模式(待翻譯)

If UEFI mode is enabled on an UEFI motherboard, Archiso will boot Arch Linux accordingly via systemd-boot. To verify this, list the efivars directory:

# ls /sys/firmware/efi/efivars

If the directory does not exist, the system may be booted in BIOS or CSM mode. Refer to your motherboard's manual for details.

Connect to the Internet 連接到網際網路(待翻譯)

The installation image enables the dhcpcd daemon for wired network devices on boot. The connection may be verified with ping:

# ping

If no connection is available, stop the dhcpcd service with systemctl stop dhcpcd@interface where the interface name can be tab-completed. Proceed to configure the network as described in Network configuration.

Update the system clock 更新系統時間

Use timedatectl(1) to ensure the system clock is accurate:

執行 timedatectl(1) 確保系統時間是準確的:

# timedatectl set-ntp true

To check the service status, use timedatectl status.

可以執行 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:

Note: Swap space can be set on a separate partition or a swap file.

To modify partition tables, use fdisk or parted.

# fdisk /dev/sda

See Partitioning for more information.

Note: If you want to create any stacked block devices for LVM, disk encryption or RAID, do it now.

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 腳本安裝 base 套件組:

# 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 系統設置


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 文件是否正確,如有錯需立即更正。


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:


If you set the keyboard layout[broken link: invalid section], make the changes persistent in vconsole.conf(5):


Network configuration 網路設置

Create the hostname file:

創建 hostname 文件:


Add matching entries to hosts(5):

並添加對應的項目到 hosts(5)

/etc/hosts      localhost
::1            localhost      myhostname.localdomain      myhostname

If the system has a permanent IP address, it should be used instead of

如果系統擁有一個永久的 IP 位址,請使用該 IP 位址而不是

Complete the network configuration for the newly installed environment.

為新安裝的環境完成網路設置 (network configuration)。


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