Difference between revisions of "Installation guide"

From ArchWiki
Jump to: navigation, search
(clarify the scope of the article, see Talk:Installation Guide#arch-install-scripts)
(man7 for Table of Contents)
 
(166 intermediate revisions by 7 users not shown)
Line 1: Line 1:
[[Category:About Arch]]
 
 
[[Category:Getting and installing Arch]]
 
[[Category:Getting and installing Arch]]
[[ar:Installation Guide]]
+
[[ar:Installation guide]]
[[cs:Installation Guide]]
+
[[bg:Installation guide]]
 +
[[cs:Installation guide]]
 +
[[da:Installation guide]]
 
[[de:Arch Install Scripts]]
 
[[de:Arch Install Scripts]]
[[el:Installation Guide]]
+
[[el:Installation guide]]
[[es:Installation Guide]]
+
[[es:Installation guide]]
[[fr:Arch_install_scripts]]
+
[[fi:Installation guide]]
[[it:Installation Guide]]
+
[[fr:Arch install scripts]]
[[ko:Installation Guide]]
+
[[hr:Installation guide]]
[[pl:Installation Guide]]
+
[[hu:Installation guide]]
[[pt:Installation Guide]]
+
[[id:Installation guide]]
 +
[[it:Installation guide]]
 +
[[ja:インストールガイド]]
 +
[[ko:Installation guide]]
 +
[[lt:Installation guide]]
 +
[[nl:Installation guide]]
 +
[[pl:Installation guide]]
 +
[[pt:Installation guide]]
 
[[ro:Ghid de instalare]]
 
[[ro:Ghid de instalare]]
[[ru:Installation Guide]]
+
[[ru:Installation guide]]
[[uk:Installation Guide]]
+
[[sk:Installation guide]]
[[zh-CN:Installation Guide]]
+
[[sr:Installation guide]]
[[zh-TW:Installation Guide]]
+
[[th:Installation guide]]
This document will guide you through the process of installing [[Arch Linux]] from the live system booted with the official installation image. Before installing, you are advised to skim over the [[FAQ]]. See [[Beginners' Guide]] for a highly detailed, explanatory installation guide. [[:Category:Getting and installing Arch]] contains several more installation guides for specific cases.
+
[[uk:Installation guide]]
 +
[[zh-cn:Installation guide]]
 +
[[zh-tw:Installation guide]]
 +
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]].  
  
The community-maintained [[Main Page|Arch wiki]] is an excellent resource and should be consulted for issues first. The [[Wikipedia:IRC|IRC]] channel (irc://irc.freenode.net/#archlinux), and the [https://bbs.archlinux.org/ forums] are also available if the answer cannot be found elsewhere. Also, be sure to check out the {{ic|man}} pages for any command you are unfamiliar with; this can usually be invoked with {{ic|man ''command''}}.
+
For more detailed instructions, see the respective [[ArchWiki:About|ArchWiki]] articles (accessible from the installation environment with [[ELinks]]), or the various programs' [[man page]]s; see [https://projects.archlinux.org/svntogit/packages.git/tree/filesystem/trunk/archlinux.7.txt archlinux(7)] for an overview of the configuration. For interactive help, the [[IRC channel]] and the [https://bbs.archlinux.org/ forums] are also available.
  
== Download ==
+
== Pre-installation ==
Download the new Arch Linux ISO from the [https://www.archlinux.org/download/ Arch Linux download page].
+
* A single image is provided which can be booted into an i686 and x86_64 live system to install Arch Linux over the network. Media containing the [core] repository are no longer provided.
+
* Install images are signed and it is highly recommended to verify their signature before use: this can be done by downloading the ''.sig'' file from the download page (or one of the mirrors listed there) to the same directory as the ''.iso'' file and then using {{ic|pacman-key -v ''iso-file''.sig}}.
+
* The image can be burned to a CD, mounted as an ISO file, or directly [[USB Installation Media|written to a USB stick]]. It is intended for new installations only; an existing Arch Linux system can always be updated with {{ic|pacman -Syu}}.
+
  
== Installation ==
+
Arch Linux should run on any [[Wikipedia:P6 (microarchitecture)|i686]] compatible machine with a minimum of 256 MB RAM. A basic installation with all packages from the {{Grp|base}} group should take less than 800 MB of disk space.
  
=== Keyboard layout ===
+
Download and boot the installation medium as explained in [[:Category:Getting and installing Arch]]. You will be logged in as the root user, and presented with a [[Zsh]] shell prompt; common commands such as ''systemctl'' can be [[w:Command-line_completion|tab-completed]]. To [[edit]] configuration files, [[nano#Usage|nano]], ''vi'' and [[vim#Usage|vim]] are available.
  
For many countries and keyboard types appropriate keymaps are available already, and a command like {{ic|loadkeys uk}} might do what you want. More available keymap files can be found in {{ic|/usr/share/kbd/keymaps/}} (you can omit the keymap path and file extension when using loadkeys).
+
The installation process needs to retrieve packages from a remote repository, therefore a working internet connection is required.
  
=== Partition disks ===
+
=== Verify the boot mode ===
See [[partitioning]] for details.
+
  
If you want to create any stacked block devices for [[LVM]], [[disk encryption]] or [[RAID]], do it now.
+
As instructions differ for [[UEFI]] systems, verify the boot mode by checking [[efivars]]:
 +
 
 +
# ls /sys/firmware/efi/efivars
 +
 
 +
=== Set the keyboard layout ===
 +
 
 +
The default [[Keyboard_configuration_in_console|console keymap]] is [[Wikipedia:File:KB United States-NoAltGr.svg|US]]. Available choices can be listed with {{ic|ls /usr/share/kbd/keymaps/**/*.map.gz}}.
 +
 
 +
The layout can be changed with [http://man7.org/linux/man-pages/man1/loadkeys.1.html loadkeys(1)], appending a file name (path and file extension can be omitted). For example:
 +
 
 +
# loadkeys ''de-latin1''
 +
 
 +
[[Console fonts]] are located in {{ic|/usr/share/kbd/consolefonts/}}, and can likewise be set with [http://man7.org/linux/man-pages/man8/setfont.8.html setfont(8)].
 +
 
 +
=== Connect to the Internet ===
 +
 
 +
Internet service via [[dhcpcd]] is enabled on boot for supported wired devices; check the connection using a tool such as ''ping''.
 +
 
 +
For other [[network configuration]], [[systemd-networkd]] and [[netctl]] are included; for examples, see [http://man7.org/linux/man-pages/man5/systemd.network.5.html systemd.network(5)] and [https://github.com/joukewitteveen/netctl/blob/master/docs/netctl.profile.5.txt netctl.profile(5)].
 +
 
 +
When using a different networking service, [[stop]] {{ic|dhcpcd@''interface''.service}} first:
 +
 
 +
# systemctl stop dhcpcd@''interface''.service
 +
 
 +
=== Update the system clock ===
 +
 
 +
Use [[systemd-timesyncd]] to ensure the system clock is accurate:
 +
 
 +
# timedatectl set-ntp true
 +
 
 +
To check the service status, use {{ic|timedatectl status}}.
 +
 
 +
=== Partition the disks ===
 +
 
 +
Identify the disk names with {{ic|lsblk -f}} (results ending in {{ic|rom}}, {{ic|loop}} or {{ic|airoot}} can be ignored), and print existing [[partition table]]s with {{ic|fdisk -l ''/dev/sda'' print}}.
 +
 
 +
To modify tables, use [[fdisk]] or [[parted]] for both [[MBR]] and [[GPT]], or [[gdisk]] for GPT only.
 +
 
 +
At the minimum, a partition must be available for the {{ic|/}} directory. [[UEFI]] systems additionally require an [[EFI System Partition]]. Other partitions may be needed, such as a [[GRUB#GUID Partition Table (GPT) specific instructions|GRUB BIOS boot partition]].
 +
 
 +
If wanting to create any stacked block devices for [[LVM]], [[disk encryption]] or [[RAID]], do it now.
  
 
=== Format the partitions ===
 
=== Format the partitions ===
See [[File Systems#Step_2:_create_the_new_file_system|File Systems]] for details.
 
  
If you are using (U)EFI you will most probably need another partition to host the UEFI System partition. Read [[Unified Extensible Firmware Interface#EFI_System_Partition|Create an UEFI System Partition in Linux]].
+
See [[File systems#Create a file system|File systems]] and optionally [[Swap]] for details.
  
 
=== Mount the partitions ===
 
=== Mount the partitions ===
You must now mount the root partition on {{ic|/mnt}}. After that, you should create directories for and mount any other partitions ({{ic|/mnt/boot}}, {{ic|/mnt/home}}, ...)  and mount your [[Swap|swap]] partition if you want them to be detected by {{ic|genfstab}}.
 
  
=== Connect to the internet ===
+
Mount the root partition on {{ic|/mnt}}. After that, create directories for and mount any other partitions ({{ic|/mnt/boot}}, {{ic|/mnt/home}}, ...) and activate your ''swap'' partition with ''swapon'', if you want them to be detected later by ''genfstab''.
A DHCP service is already enabled for all available devices. If you need to setup a static IP or use management tools such as [[Netctl]], you should stop this service first: {{ic|systemctl stop dhcpcd.service}}. For more information read [[configuring network]].
+
  
==== Wireless ====
+
== Installation ==
Run {{ic|wifi-menu}} to set up your wireless network. For details, see [[Wireless Setup]] and [[Netctl]].
+
 
 +
=== Select the mirrors ===
 +
 
 +
Edit {{ic|/etc/pacman.d/mirrorlist}} and select a download mirror(s). Regional mirrors usually work best; however, other criteria may be necessary to discern, read more on [[Mirrors]].  
 +
 
 +
This file will later be copied to the new system by ''pacstrap'', so it is worth getting right.
 +
 
 +
=== Install the base packages ===
  
=== Install the base system ===
+
Use the [https://projects.archlinux.org/arch-install-scripts.git/tree/pacstrap.in pacstrap] script to install the {{Grp|base}} group:
Before installing, you may want to edit {{ic|/etc/pacman.d/mirrorlist}} such that your preferred [[Mirrors|mirror]] is first. This copy of the mirrorlist will be installed on your new system by {{ic|pacstrap}} as well, so it's worth getting it right.
+
  
Using the [https://projects.archlinux.org/arch-install-scripts.git/tree/pacstrap.in pacstrap] script we install the base system.
 
 
 
  # pacstrap /mnt base
 
  # pacstrap /mnt base
  
Other packages can be installed by appending their names to the above command (space seperated), including the boot loader if you want.
+
To [[install]] other packages or groups to the new system, such as {{Pkg|btrfs-progs}} or a [[boot loader]], append their names to ''pacstrap'' (space separated) or to individual ''pacman'' commands after [[#Chroot|changing root]].
  
=== Configure the system ===
+
== Configure the system ==
* Generate an [[fstab]] with the following command (if you prefer to use UUIDs or labels, add the {{ic|-U}} or {{ic|-L}} option, respectively):
+
:{{bc|# genfstab -p /mnt >> /mnt/etc/fstab}}
+
* [[chroot]] into our newly installed system:
+
:{{bc|# arch-chroot /mnt}}
+
* Write your hostname to {{ic|/etc/hostname}}.
+
  
* Symlink {{ic|/etc/localtime}} to {{ic|/usr/share/zoneinfo/Zone/SubZone}}. Replace {{ic|Zone}} and {{ic|Subzone}} to your liking. For example:
+
=== Fstab ===
:{{bc|# ln -s /usr/share/zoneinfo/Europe/Athens /etc/localtime}}
+
  
* Uncomment the selected locale in {{ic|/etc/locale.gen}} and generate it with {{ic|locale-gen}}.
+
Generate an [[fstab]] file (use {{ic|-U}} or {{ic|-L}} to define by [[UUID]] or labels):
* Set [[Locale#Setting system-wide locale|locale]] preferences in {{ic|/etc/locale.conf}}.
+
* Add [[KEYMAP|console keymap]] and [[Fonts#Console_fonts|font]] preferences in {{ic|/etc/vconsole.conf}}
+
* Configure {{ic|/etc/mkinitcpio.conf}} as needed (see [[mkinitcpio]]) and create an initial RAM disk with:
+
:{{bc|# mkinitcpio -p linux}}
+
  
* Set a root password with {{ic|passwd}}.
+
# genfstab -p /mnt >> /mnt/etc/fstab
* Configure the network again for newly installed environment. See [[Network Configuration]] and [[Wireless Setup]].
+
  
=== Install and configure a boot loader ===
+
Check the resulting file in {{ic|/mnt/etc/fstab}} afterwards, and edit it in case of errors.
See [[Boot Loaders]] for the available choices.
+
  
=== Unmount and reboot ===
+
=== Chroot ===
If you are still in the chroot environment type {{ic|exit}} or press {{ic|Ctrl+D}} in order to exit.
+
Earlier we mounted the partitions under {{ic|/mnt}}. In this step we will unmount them:
+
# umount -R /mnt
+
  
Now reboot and then login into the new system with the root account.
+
[[Change root]] into the new system:
  
== Post-installation ==
+
# arch-chroot /mnt
  
=== User management ===
+
=== Time zone ===
  
Add any user accounts you require besides root, as described in [[Users and Groups#User management|User management]]. It is not good practice to use the root account for regular use, or expose it via [[SSH]] on a server. The root account should only be used for administrative tasks.
+
Set the [[time zone]]:
  
=== Package management ===
+
# ln -s /usr/share/zoneinfo/''zone''/''subzone'' /etc/localtime
  
See [[pacman]] and [[FAQ#Package Management]] for answers regarding installing, updating, and managing packages.
+
Run ''hwclock'' to generate {{ic|/etc/adjtime}}. If the [[time standard]] is set to [[w:UTC|UTC]], other operating systems should be configured accordingly.
  
=== Service management ===
+
# hwclock --systohc --''utc''
  
Arch Linux uses [[systemd]] as init, which is a system and service manager for Linux. For maintaining your Arch Linux installation, it is a good idea to learn the basics about it. Interaction with systemd is done through the {{ic|systemctl}} command. Read [[systemd#Basic systemctl usage]] for more information.
+
=== Locale ===
  
=== Sound ===
+
Uncomment the needed [[locale]]s in {{ic|/etc/locale.gen}}, then generate them with:
  
[[ALSA]] usually works out-of-the-box. It just needs to be unmuted. Install {{Pkg|alsa-utils}} (which contains {{ic|alsamixer}}) and follow [[Advanced Linux Sound Architecture#Unmuting the channels|these]] instructions.
+
# locale-gen
  
ALSA is included with the kernel and it is recommended. If it does not work, [[OSS]] is a viable alternative. If you have advanced audio requirements, take a look at [[Sound system]] for an overview of various articles.
+
Add {{ic|1=LANG=''your_locale''}} to {{ic|/etc/locale.conf}}, and if required, console [[keymap]] and [[Fonts#Console_fonts|font]] to {{ic|/etc/vconsole.conf}}. See {{ic|man 5 locale.conf}} and {{ic|man 5 vconsole.conf}} for details.
  
=== Display server ===
+
=== Hostname ===
  
The X Window System (commonly X11, or X) is a networking and display protocol which provides windowing on bitmap displays. It is the de-facto standard for implementating graphical user interfaces. See the [[Xorg]] article for details.
+
Create an entry for your [[hostname]] in {{ic|/etc/hostname}} and {{ic|/etc/hosts}}. See {{ic|man 5 hostname}} and {{ic|man 5 hosts}} for the correct format.
  
[[Wayland]] is a new display server protocol and the Weston reference implementation is available. There is very little support for it from applications at this early stage of development.
+
=== Network configuration ===
  
=== Fonts ===
+
Configure the network for the newly installed environment: see [[Network configuration]].
  
You may wish to install a set of TrueType fonts, as only unscalable bitmap fonts are included by default. DejaVu is a set of high quality, general-purpose fonts with good [[Wikipedia:Unicode|Unicode]] coverage:
+
For [[Wireless configuration]], [[install]] the {{Pkg|iw}}, {{Pkg|wpa_supplicant}}, and {{Pkg|dialog}} packages; additional [[Wireless#Installing driver/firmware|firmware packages]] may be required.
  
# pacman -S ttf-dejavu
+
=== Initramfs ===
  
Refer to [[Font Configuration]] for how to configure font rendering and [[Fonts]] for font suggestions and installation instructions.
+
When making configuration changes to [[mkinitcpio|/etc/mkinitcpio.conf]], create a new initial RAM disk with:
  
== Appendix ==
+
# mkinitcpio -p linux
 +
 
 +
=== Root password ===
 +
 
 +
Set the root [[password]]:
 +
 
 +
# passwd
 +
 
 +
=== Boot loader ===
 +
 
 +
See [[:Category:Boot loaders]] for available choices and configurations. Choices include [[GRUB]] (BIOS/UEFI), [[systemd-boot]] (UEFI) and [[syslinux]] (BIOS).
 +
 
 +
If you have an Intel CPU, in addition to installing a boot loader, install the {{Pkg|intel-ucode}} package and [[Microcode#Enabling_Intel_microcode_updates|enable microcode updates]].
 +
 
 +
== Reboot ==
 +
 
 +
Exit the chroot environment by typing {{ic|exit}} or pressing {{ic|Ctrl+D}}.
 +
 
 +
Optionally manually unmount all the partitions with {{ic|umount -R /mnt}}: this allows noticing any "busy" partitions, and finding the cause with [[Wikipedia:fuser_(Unix)|fuser]].
 +
 
 +
Finally, restart the machine by typing {{ic|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.
 +
 
 +
== Post-installation ==
  
For a list of applications that may be of interest, see [[List of Applications]].
+
See [[General recommendations]] for system management directions and post-installation tutorials (like setting up a graphical user interface, sound or a touchpad).
  
See [[General Recommendations]] for post-installation tutorials like setting up a touchpad or font rendering.
+
For a list of applications that may be of interest, see [[List of applications]].

Latest revision as of 16:27, 23 July 2016

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.

For more detailed instructions, see the respective ArchWiki articles (accessible from the installation environment with ELinks), or the various programs' man pages; see archlinux(7) for an overview of the configuration. For interactive help, the IRC channel and the forums are also available.

Pre-installation

Arch Linux should run on any i686 compatible machine with a minimum of 256 MB RAM. A basic installation with all packages from the base group should take less than 800 MB of disk space.

Download and boot the installation medium as explained in Category:Getting and installing Arch. You will be logged in as the root user, and presented with a Zsh shell prompt; common commands such as systemctl can be tab-completed. To edit configuration files, nano, vi and vim are available.

The installation process needs to retrieve packages from a remote repository, therefore a working internet connection is required.

Verify the boot mode

As instructions differ for UEFI systems, verify the boot mode by checking efivars:

# ls /sys/firmware/efi/efivars

Set the keyboard layout

The default console keymap is US. Available choices can be listed with ls /usr/share/kbd/keymaps/**/*.map.gz.

The layout can be changed with loadkeys(1), appending a file name (path and file extension can be omitted). For example:

# loadkeys de-latin1

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

Connect to the Internet

Internet service via dhcpcd is enabled on boot for supported wired devices; check the connection using a tool such as ping.

For other network configuration, systemd-networkd and netctl are included; for examples, see systemd.network(5) and netctl.profile(5).

When using a different networking service, stop dhcpcd@interface.service first:

# systemctl stop dhcpcd@interface.service

Update the system clock

Use systemd-timesyncd to ensure the system clock is accurate:

# timedatectl set-ntp true

To check the service status, use timedatectl status.

Partition the disks

Identify the disk names with lsblk -f (results ending in rom, loop or airoot can be ignored), and print existing partition tables with fdisk -l /dev/sda print.

To modify tables, use fdisk or parted for both MBR and GPT, or gdisk for GPT only.

At the minimum, a partition must be available for the / directory. UEFI systems additionally require an EFI System Partition. Other partitions may be needed, such as a GRUB BIOS boot partition.

If wanting to create any stacked block devices for LVM, disk encryption or RAID, do it now.

Format the partitions

See File systems and optionally Swap for details.

Mount the partitions

Mount the root partition on /mnt. After that, create directories for and mount any other partitions (/mnt/boot, /mnt/home, ...) and activate your swap partition with swapon, if you want them to be detected later by genfstab.

Installation

Select the mirrors

Edit /etc/pacman.d/mirrorlist and select a download mirror(s). Regional mirrors usually work best; however, other criteria may be necessary to discern, read more on Mirrors.

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 group:

# pacstrap /mnt base

To install other packages or groups to the new system, such as btrfs-progs or a boot loader, append their names to pacstrap (space separated) or to individual pacman commands after changing root.

Configure the system

Fstab

Generate an fstab file (use -U or -L to define by UUID or labels):

# genfstab -p /mnt >> /mnt/etc/fstab

Check the resulting file in /mnt/etc/fstab afterwards, and edit it in case of errors.

Chroot

Change root into the new system:

# arch-chroot /mnt

Time zone

Set the time zone:

# ln -s /usr/share/zoneinfo/zone/subzone /etc/localtime

Run hwclock to generate /etc/adjtime. If the time standard is set to UTC, other operating systems should be configured accordingly.

# hwclock --systohc --utc

Locale

Uncomment the needed locales in /etc/locale.gen, then generate them with:

# locale-gen

Add LANG=your_locale to /etc/locale.conf, and if required, console keymap and font to /etc/vconsole.conf. See man 5 locale.conf and man 5 vconsole.conf for details.

Hostname

Create an entry for your hostname in /etc/hostname and /etc/hosts. See man 5 hostname and man 5 hosts for the correct format.

Network configuration

Configure the network for the newly installed environment: see Network configuration.

For Wireless configuration, install the iw, wpa_supplicant, and dialog packages; additional firmware packages may be required.

Initramfs

When making configuration changes to /etc/mkinitcpio.conf, create a new initial RAM disk with:

# mkinitcpio -p linux

Root password

Set the root password:

# passwd

Boot loader

See Category:Boot loaders for available choices and configurations. Choices include GRUB (BIOS/UEFI), systemd-boot (UEFI) and syslinux (BIOS).

If you have an Intel CPU, in addition to installing a boot loader, install the intel-ucode package and enable microcode updates.

Reboot

Exit the chroot environment by typing exit or pressing Ctrl+D.

Optionally manually unmount all the partitions with umount -R /mnt: this allows noticing any "busy" partitions, and finding the cause with fuser.

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.

Post-installation

See General recommendations for system management directions and post-installation tutorials (like setting up a graphical user interface, sound or a touchpad).

For a list of applications that may be of interest, see List of applications.