Difference between revisions of "Beginners' guide"

From ArchWiki
Jump to navigation Jump to search
(Undo revision 446844 by Delta Duhr (talk) thanks, but that's explained in General recommendations, in turn linked from #Post-installation)
(#REDIRECT Installation guide, merge completed, see Talk:Installation_guide#BG_merge)
Line 1: Line 1:
[[Category:Getting and installing Arch]]
#REDIRECT [[Installation guide]]
[[ar:Beginners' guide]]
[[bg:Installation guide]]
[[cs:Installation guide]]
[[da:Installation guide]]
[[de:Anleitung für Einsteiger]]
[[el:Installation guide]]
[[es:Beginners' guide]]
[[fa:راهنمای تازه‌کاران]]
[[hr:Installation guide]]
[[hu:Installation guide]]
[[id:Installation guide]]
[[it:Installation guide]]
[[ko:Installation guide]]
[[lt:Installation guide]]
[[nl:Installation guide]]
[[pl:Installation guide]]
[[pt:Installation guide]]
[[ro:Ghidul începătorilor]]
[[ru:Beginners' guide]]
[[sk:Installation guide]]
[[sr:Installation guide]]
[[tr:Yeni başlayanlar rehberi]]
[[uk:Installation guide]]
[[zh-cn:Beginners' guide]]
[[zh-tw:Installation guide]]
{{Related articles start}}
{{Related|Installation guide}}
{{Related|General recommendations}}
{{Related|General troubleshooting}}
{{Related articles end}}
This document will guide you through the process of installing [[Arch Linux]] using the [https://projects.archlinux.org/arch-install-scripts.git/ Arch Install Scripts]. Before installing, you are advised to skim over the [[FAQ]].
The community-maintained [[Main page|ArchWiki]] is the primary resource that should be consulted if issues arise. The [[IRC channel]] (irc://irc.freenode.net/#archlinux) and the [https://bbs.archlinux.org/ forums] are also excellent resources if an answer cannot be found elsewhere. In accordance with [[the Arch Way]], you are encouraged to type {{ic|man ''command''}} to read the [[man page]] of any command you are unfamiliar with.
{{Tip|This guide is accessible from the live installation with the [[ELinks]] browser, after the [[#Connect to the Internet]] step. This can be done in a new [[w:Virtual console|virtual console]], switching ({{ic|Alt+arrow}}) between the console containing the web page, and the console where you are performing the installation. Similarly, the {{ic|#archlinux}} [[IRC]] can be accessed using [[irssi]].}}
== Preparation ==
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.
See [[:Category:Getting and installing Arch]] for instructions on downloading the installation medium, and methods for booting it to the target machine(s). This guide assumes you use the latest available version.
After booting into the installation media, you will be automatically logged in as the root user and presented with a [[Zsh]] shell prompt. For [[create|modifying or creating]] configuration files, typically in {{ic|/etc}}, [[nano#Usage|nano]] or [[vim#Usage|vim]] are suggested.
=== UEFI mode ===
In case you have a [[UEFI]] motherboard with UEFI mode enabled, the CD/USB will automatically launch Arch Linux via [[systemd-boot]].
To verify you are booted in UEFI mode, check that the following directory is populated:
# ls /sys/firmware/efi/efivars
See [[UEFI#UEFI Variables]] for details.
=== Set the keyboard layout ===
The default [[Keyboard_configuration_in_console|console keymap]] is set to [[Wikipedia:File:KB United States-NoAltGr.svg|us]]. Available choices can be listed with {{ic|ls /usr/share/kbd/keymaps/**/*.map.gz}}.
{{Note|{{ic|localectl list-keymaps}} does not work due to bug {{Bug|46725}}.}}
For example, to change the layout to {{ic|de-latin1}}, run:
# loadkeys ''de-latin1''
If certain characters appear as white squares or other symbols, change the [[Console fonts|console font]]. For example:
# setfont ''lat9w-16''
=== Connect to the Internet ===
The [[dhcpcd]] daemon is enabled on boot for '''wired''' devices, and will attempt to start a connection. To access captive portal login forms, use the [[ELinks]] browser.
Verify a connection was established, for example with {{ic|ping archlinux.org}}. If no connection is available, see [[Network configuration]] or follow the below [[netctl]] examples. Otherwise, continue to [[#Update the system clock]].
; Netctl preparation
To prevent conflicts, [[stop]] the enabled ''dhcpcd'' service first, replacing {{ic|''enp0s25''}} with the correct wired interface:
# systemctl stop dhcpcd@''enp0s25''.service
[[Network configuration#Device names|Interfaces]] can be listed using {{ic|ip link}}, or {{ic|iw dev}} for wireless devices. They are prefixed with {{ic|en}} (ethernet), {{ic|wl}} (WLAN), or {{ic|ww}} (WWAN).
; Wireless
[[Wireless_network_configuration#Getting_some_useful_information|List available networks]], and make a connection for a specified interface:
# wifi-menu -o ''wlp2s0''
The resulting configuration file is stored in {{ic|/etc/netctl}}. For networks which require both a username and password, see [[WPA2 Enterprise#netctl]].
; Other
Several example profiles, such as for configuring a [[Network configuration#Static IP address|static IP address]], are available. Copy the required one to {{ic|/etc/netctl}}, for example {{ic|''ethernet-static''}}:
# cp /etc/netctl/examples/''ethernet-static'' /etc/netctl
Adjust the copy as needed, and enable it:
# netctl start ''ethernet-static''
=== Update the system clock ===
Use [[systemd-timesyncd]] to ensure that your system clock is accurate. To start it:
# timedatectl set-ntp true
To check the service status, use {{ic|timedatectl status}}.
== Prepare the storage devices ==
{{Warning|In general, partitioning or formatting will make existing data inaccessible and subject to being overwritten, i.e. destroyed, by subsequent operations. For this reason, all data that needs to be preserved must be backed up before proceeding.}}
In this step, the storage devices that will be used by the new system will be prepared. Read [[Partitioning]] for a more general overview.
Users intending to create stacked block devices for [[LVM]], [[disk encryption]] or [[RAID]], should keep those instructions in mind when preparing the partitions. If intending to install to a USB flash key, see [[Installing Arch Linux on a USB key]].
=== Identify the devices ===
[[File_systems#Identify_the_devices|Identify the devices]] where the new system will be installed:
# lsblk
Not all devices listed are viable mediums for installation; results ending in {{ic|rom}}, {{ic|loop}} or {{ic|airoot}} can be ignored.
{{Note|In the sections below, the {{ic|sd'''xy'''}} notation will be used ({{ic|'''x'''}} for the device, {{ic|'''y'''}} for an existing partition).}}
If the existing partition scheme does not need to be changed, you may skip to [[#Format the partitions]].
=== Partition the devices ===
[[Partition]]ing a hard drive divides the available space into sections that can be accessed independently. The required information is stored in a ''partition table'' using a format such as [[MBR]] or [[GPT]]. Existing tables can be printed with {{ic|parted /dev/sd'''x''' print}} or {{ic|fdisk -l /dev/sd'''x'''}}.
To partition devices, use a [[Partitioning#Partitioning tools|partitioning tool]] compatible to the chosen type of partition table. Incompatible tools may result in the destruction of that table, along with existing partitions or data. Choices include:
{| class="wikitable"
! Name
! Variants
| [[fdisk]]
| {{Yes}}
| {{Yes}}
| ''sfdisk'', ''cfdisk''
| [[gdisk]]
| {{No}}
| {{Yes}}
| ''cgdisk'', ''sgdisk''
| [[parted]]
| {{Yes}}
| {{Yes}}
| [[GParted]]
The examples below demonstrate a basic [[partition scheme]] for both types of partition tables. They assume that a new, contiguous layout is applied to a single device in {{ic|/dev/sd'''x'''}}. Necessary changes to device names and partition numbers must be done beforehand.
{| class="wikitable"
!colspan="5" | UEFI/GPT example layout
! Mount point
! Partition
! [[w:GUID_Partition_Table#Partition_type_GUIDs|Partition type (GUID)]]
! Bootable flag
! Suggested size
| /boot
| /dev/sd'''x'''1
| [[EFI System Partition]]
| Yes
| 260–512 MiB
| [SWAP]
| /dev/sd'''x'''2
| Linux [[swap]]
| No
| More than 512 MiB
| /
| /dev/sd'''x'''3
| Linux
| No
| Remainder of the device
!colspan="5" | MBR/BIOS example layout
! Mount point
! Partition
! [[w:Partition type|Partition type]]
! Bootable flag
! Suggested size
| [SWAP]
| /dev/sd'''x'''1
| Linux [[swap]]
| No
| More than 512 MiB
| /
| /dev/sd'''x'''2
| Linux
| Yes
| Remainder of the device
=== Format the partitions ===
{{Warning|If [[Dual boot with Windows|dual-booting]] with an existing installation of Windows on a UEFI/GPT system, avoid reformatting the UEFI partition, as this includes the Windows ''.efi'' file required to boot it.}}
Once the partitions have been created, each '''must''' be formatted with an appropriate [[file system]], ''except'' for [[swap]] partitions. All available partitions on the intended installation device can be listed with the following command:
# lsblk /dev/sd'''x'''
With the exceptions noted below, it is recommended to use the {{ic|ext4}} file system:
# mkfs.ext4 /dev/sd'''xy'''
If a swap partition was created, it must be set up and activated with:
# mkswap /dev/sd'''xy'''
# swapon /dev/sd'''xy'''
If a '''new''' UEFI system partition has been created on a UEFI/GPT system, it '''must''' be formatted with a {{ic|fat32}} file system:
# mkfs.fat -F32 /dev/sd'''xy'''
=== Mount the partitions ===
Mount the ''root'' partition to the {{ic|/mnt}} directory of the live system:
# mount /dev/sd'''xy''' /mnt
Remaining [[Partitioning#Partition_scheme|partitions]] except ''swap'' may be mounted in any order, after creating the respective mount points. For example, when using a {{ic|/boot}} partition:
# mkdir -p /mnt/boot
# mount /dev/sd'''xy''' /mnt/boot
{{ic|/mnt/boot}} is also recommended for mounting the (formatted or already existing) EFI System Partition on a UEFI/GPT system. See [[EFISTUB]] and related articles for alternatives.
== Installation ==
=== Select the mirrors ===
Packages to be installed must be downloaded from [[mirror]] servers, which are defined in {{ic|/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.
The ''pacstrap'' tool used in the next step also installs a copy of the file to the new system, so it is worth getting right.
=== Install the base packages ===
Execute the [https://git.archlinux.org/arch-install-scripts.git/tree/pacstrap.in pacstrap] script:
# pacstrap /mnt
which defaults to install the {{Grp|base}} group of packages.
This group represents the recommended minimum of packages for an Arch Linux installation. The group does not include all tools from the live installation, such as {{Pkg|btrfs-progs}}; see [https://projects.archlinux.org/archiso.git/tree/configs/releng/packages.both packages.both] for comparison.
To build packages from the [[AUR]] or with the [[ABS]], the {{Grp|base-devel}} group is also required. Packages can be [[install]]ed with {{man|8|pacman|url=https://www.archlinux.org/pacman/pacman.8.html}} anytime after the [[#Change root]] step later, or by appending their names to the ''pacstrap'' command. For example:
# pacstrap -i /mnt base base-devel btrfs-progs
The {{ic|-i}} switch ensures prompting before package installation.
With the base group, the first [[initramfs]] will be generated and installed to the new system's boot path; double-check output prompts {{ic|1===> Image creation successful}} for it.
== Configuration ==
=== fstab ===
Generate an [[fstab]] file. The {{ic|-U}} option indicates [[UUID]]s. Labels can be used instead through the {{ic|-L}} option.
# genfstab -U /mnt >> /mnt/etc/fstab
Check the resulting file in {{ic|/mnt/etc/fstab}} afterwards, and edit it in case of errors.
=== Change root ===
[[chroot#Change root|Chroot]] to the new system:
# arch-chroot /mnt /bin/bash
=== Locale ===
The [[Locale]] defines which language the system uses, and other regional considerations such as currency denomination, numerology, and character sets.
Uncomment {{ic|en_US.UTF-8 UTF-8}} in {{ic|/etc/locale.gen}}, as well as other needed localisations. Save the file, and generate the new locales:
# locale-gen
[[Create]] {{ic|/etc/locale.conf}}, where {{ic|''en_US.UTF-8''}} refers to the '''first column''' of an uncommented entry in {{ic|/etc/locale.gen}}:
If you [[#Set the keyboard layout|set the keyboard layout]], make the changes persistent in {{ic|/etc/vconsole.conf}}. For example, if {{ic|de-latin1}} was set with ''loadkeys'', and {{ic|lat9w-16}} with ''setfont'', assign the {{ic|KEYMAP}} and {{ic|FONT}} variables accordingly:
=== Time ===
Select a [[time zone]]:
# tzselect
Create the symbolic link {{ic|/etc/localtime}}, where {{ic|Zone/Subzone}} is the {{ic|TZ}} value from ''tzselect'':
# ln -s /usr/share/zoneinfo/''Zone''/''SubZone'' /etc/localtime
It is recommended to adjust the time skew, and set the time standard to UTC:
# hwclock --systohc --utc
If other operating systems are installed on the machine, they must be configured accordingly. See [[Time]] for details.
=== Initramfs ===
Because [[mkinitcpio]] was run on installation of {{Pkg|linux}} with ''pacstrap'', most users do not need to regenerate the intramfs image so this step can be skipped.
For special configurations, set the correct [[Mkinitcpio#HOOKS|hooks]] in {{ic|/etc/mkinitcpio.conf}} and [[Mkinitcpio#Image_creation_and_activation|re-generate]] the initramfs image:
# mkinitcpio -p linux
=== 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]].
=== Network configuration ===
The procedure is similar to [[#Connect to the Internet]] for the live installation environment, except made persistent for subsequent boots.
==== Hostname ====
Set the [[hostname]] by [[add]]ing an entry to {{ic|/etc/hostname}}, where ''myhostname'' is the desired host name:
It is recommended to append the same host name to {{ic|/etc/hosts}}, for example:
{{hc|1=/etc/hosts|2= localhost.localdomain localhost ''myhostname''
::1 localhost.localdomain localhost ''myhostname''
==== Wired ====
When only requiring a single wired connection, [[enable]] the [[dhcpcd]] service:
# systemctl enable dhcpcd@''interface''.service
Where {{ic|''interface''}} is an ethernet [[Network_configuration#Device_names|device name]].
See [[Network configuration#Configure the IP address]] for other available methods.
==== Wireless ====
[[Install]] the {{Pkg|iw}}, {{Pkg|wpa_supplicant}}, and (for [[Netctl#Wireless_.28WPA-PSK.29|wifi-menu]]) {{Pkg|dialog}} packages:
# pacman -S iw wpa_supplicant dialog
Additional [[Wireless#Installing driver/firmware|firmware packages]] may also be required. When using ''wifi-menu'', do so after [[#Unmount the partitions and reboot]].
See [[Wireless#Wireless management]] for other available methods.
=== Root password ===
Set the root [[password]] with:
# passwd
== Unmount the partitions and reboot ==
Exit from the chroot environment by running {{ic|exit}} or pressing {{ic|Ctrl+D}}.
Partitions will be unmounted automatically by ''systemd'' on shutdown. You may however unmount manually as a safety measure:
# umount -R /mnt
If the partition is "busy", you can find the cause with [[fuser]]. Reboot the computer.
# reboot
Remove the installation media, or you may boot back into it. You can log into your new installation as ''root'', using the password you specified with ''passwd''.
== Post-installation ==
Your new Arch Linux base system is now a functional GNU/Linux environment ready to be built into whatever you wish or require for your purposes. You are now ''strongly'' advised to read the [[General recommendations]] article, especially the first two sections. Its other sections provide links to post-installation tutorials like setting up a graphical user interface, sound or a touchpad.
For particular areas of interest, see the [[List of applications]].

Latest revision as of 11:34, 23 August 2016

Redirect to: