- Installation guide
- Contents
- Pre-installation
- Acquire an installation image
- Verify signature
- Prepare an installation medium
- Boot the live environment
- Set the console keyboard layout
- Verify the boot mode
- Connect to the internet
- Update the system clock
- Partition the disks
- Example layouts
- Format the partitions
- Mount the file systems
- Installation
- Select the mirrors
- Install essential packages
- Configure the system
- Fstab
- Chroot
- Time zone
- Localization
- Network configuration
- Initramfs
- Root password
- Boot loader
- Reboot
- Post-installation
- Install Arch Linux from existing Linux
- Contents
- Backup and preparation
- From a host running Arch Linux
- Create a new Arch installation
- Create a copy of an existing Arch installation
- From a host running another Linux distribution
- Using pacman from the host system
- Creating a chroot
- Method A: Using the bootstrap image (recommended)
- Method B: Using the LiveCD image
- Using a chroot environment
- Initializing pacman keyring
- Downloading basic tools
- Installation tips
- Debian-based host
- Fedora-based host
- Things to check before you reboot
- Replacing the existing system without a LiveCD
- Set old swap partition as new root partition
- Installation
Installation guide
This document is a guide for installing Arch Linux using the live system booted from an installation medium made from an official installation image. The installation medium provides accessibility features which are described on the page Install Arch Linux with accessibility options. For alternative means of installation, see Category:Installation process.
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.
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.
Arch Linux should run on any x86_64-compatible machine with a minimum of 512 MiB RAM, though more memory is needed to boot the live system for installation.[1] A basic installation should take less than 2 GiB of disk space. As the installation process needs to retrieve packages from a remote repository, this guide assumes a working internet connection is available.
Contents
Pre-installation
Acquire an installation image
Visit the Download page and, depending on how you want to boot, acquire the ISO file or a netboot image, and the respective GnuPG signature.
Verify signature
It is recommended to verify the image signature before use, especially when downloading from an HTTP mirror, where downloads are generally prone to be intercepted to serve malicious images.
On a system with GnuPG installed, do this by downloading the PGP signature (under Checksums in the Download page) to the ISO directory, and verifying it with:
Alternatively, from an existing Arch Linux installation run:
Prepare an installation medium
The installation image can be supplied to the target machine via a USB flash drive, an optical disc or a network with PXE: follow the appropriate article to prepare yourself an installation medium from the chosen image.
Boot the live environment
- Point the current boot device to the one which has the Arch Linux installation medium. Typically it is achieved by pressing a key during the POST phase, as indicated on the splash screen. Refer to your motherboard’s manual for details.
- When the installation medium’s boot loader menu appears, select Arch Linux install medium and press Enter to enter the installation environment.
To switch to a different console—for example, to view this guide with Lynx alongside the installation—use the Alt+arrow shortcut. To edit configuration files, mcedit(1) , nano and vim are available. See packages.x86_64 for a list of the packages included in the installation medium.
Set the console keyboard layout
The default console keymap is US. Available layouts can be listed with:
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:
Console fonts are located in /usr/share/kbd/consolefonts/ and can likewise be set with setfont(8) .
Verify the boot mode
To verify the boot mode, list the efivars directory:
If the command shows the directory without error, then the system is booted in UEFI mode. If the directory does not exist, the system may be booted in BIOS (or CSM) mode. If the system did not boot in the mode you desired, refer to your motherboard’s manual.
Connect to the internet
To set up a network connection in the live environment, go through the following steps:
- Ensure your network interface is listed and enabled, for example with ip-link(8) :
- For wireless and WWAN, make sure the card is not blocked with rfkill.
- Connect to the network:
- Ethernet—plug in the cable.
- Wi-Fi—authenticate to the wireless network using iwctl.
- Mobile broadband modem—connect to the mobile network with the mmcli utility.
- Configure your network connection:
- DHCP: dynamic IP address and DNS server assignment (provided by systemd-networkd and systemd-resolved) should work out of the box for Ethernet, WLAN and WWAN network interfaces.
- Static IP address: follow Network configuration#Static IP address.
- The connection may be verified with ping:
Update the system clock
Use timedatectl(1) to ensure the system clock is accurate:
To check the service status, use timedatectl status .
Partition the disks
When recognized by the live system, disks are assigned to a block device such as /dev/sda , /dev/nvme0n1 or /dev/mmcblk0 . To identify these devices, use lsblk or fdisk.
Results ending in rom , loop or airoot may be ignored.
The following partitions are required for a chosen device:
If you want to create any stacked block devices for LVM, system encryption or RAID, do it now.
Use fdisk or parted to modify partition tables. For example:
Example layouts
Mount point | Partition | Partition type | Suggested size |
---|---|---|---|
[SWAP] | /dev/swap_partition | Linux swap | More than 512 MiB |
/mnt | /dev/root_partition | Linux | Remainder of the device |
Mount point | Partition | Partition type | Suggested size |
---|---|---|---|
/mnt/boot or /mnt/efi 1 | /dev/efi_system_partition | EFI system partition | At least 260 MiB |
[SWAP] | /dev/swap_partition | Linux swap | More than 512 MiB |
/mnt | /dev/root_partition | Linux x86-64 root (/) | Remainder of the device |
- /mnt/efi should only be considered if the used boot loader is capable of loading the kernel and initramfs images from the root volume. See the warning in Arch boot process#Boot loader.
Format the partitions
Once the partitions have been created, each newly created partition must be formatted with an appropriate file system. For example, to create an Ext4 file system on /dev/root_partition , run:
If you created a partition for swap, initialize it with mkswap(8) :
Mount the file systems
Mount the root volume to /mnt . For example, if the root volume is /dev/root_partition :
Create any remaining mount points (such as /mnt/efi ) using mkdir(1) and mount their corresponding volumes.
If you created a swap volume, enable it with swapon(8) :
genfstab(8) will later detect mounted file systems and swap space.
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, after connecting to the internet, reflector updates the mirror list by choosing 20 most recently synchronized HTTPS mirrors and sorting them by download rate.[2]
The higher a mirror is placed in the list, the more priority it is given when downloading a package. You may want to inspect the file to see if it is satisfactory. If it is not, 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 essential packages
Use the pacstrap(8) script to install the base package, Linux kernel and firmware for common hardware:
The base package does not include all tools from the live installation, so installing other packages may be necessary for a fully functional base system. In particular, consider installing:
- userspace utilities for the management of file systems that will be used on the system,
- utilities for accessing RAID or LVM partitions,
- specific firmware for other devices not included in linux-firmware (e.g. sof-firmware for sound cards),
- software necessary for networking,
- a text editor,
- packages for accessing documentation in man and info pages: man-db , man-pages and texinfo .
To install other packages or package groups, append the names to the pacstrap command above (space separated) or use pacman while chrooted into the new system. For comparison, packages available in the live system can be found in packages.x86_64.
Configure the system
Fstab
Generate an fstab file (use -U or -L to define by UUID or labels, respectively):
Check the resulting /mnt/etc/fstab file, and edit it in case of errors.
Chroot
Change root into the new system:
Time zone
Run hwclock(8) to generate /etc/adjtime :
This command assumes the hardware clock is set to UTC. See System time#Time standard for details.
Localization
Edit /etc/locale.gen and uncomment en_US.UTF-8 UTF-8 and other needed locales. Generate the locales by running:
Network configuration
Add matching entries to hosts(5) :
If the system has a permanent IP address or a fully qualified domain name, see the example in Network configuration#Local hostname resolution.
Complete the network configuration for the newly installed environment, that may include installing suitable network management software.
Initramfs
Creating a new initramfs is usually not required, because mkinitcpio was run on installation of the kernel package with pacstrap.
For LVM, system encryption or RAID, modify mkinitcpio.conf(5) and recreate the initramfs image:
Root password
Boot loader
Choose and install a Linux-capable boot loader. If you have an Intel or AMD CPU, enable microcode updates in addition.
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(1) .
Finally, restart the machine by typing reboot : any partitions still mounted will be automatically unmounted by systemd. Remember to remove the installation medium 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 creating unprivileged user accounts, setting up a graphical user interface, sound or a touchpad).
For a list of applications that may be of interest, see List of applications.
Источник
Install Arch Linux from existing Linux
This document describes the bootstrapping process required to install Arch Linux from a running Linux host system. After bootstrapping, the installation proceeds as described in the Installation guide.
Installing Arch Linux from a running Linux is useful for:
- remotely installing Arch Linux, e.g. a (virtual) root server
- replacing an existing Linux without a LiveCD (see #Replacing the existing system without a LiveCD)
- creating a new Linux distribution or LiveMedia based on Arch Linux
- creating an Arch Linux chroot environment, e.g. for a Docker base container
- rootfs-over-NFS for diskless machines
The goal of the bootstrapping procedure is to setup an environment from which the scripts from arch-install-scripts (such as pacstrap and arch-chroot ) can be run.
If the host system runs Arch Linux, this can be achieved by simply installing arch-install-scripts . If the host system runs another Linux distribution, you will first need to set up an Arch Linux-based chroot.
Contents
Backup and preparation
Backup all your data including mails, webservers, etc. Have all information at your fingertips. Preserve all your server configurations, hostnames, etc.
Here is a list of data you will likely need:
- IP address
- hostname(s), (note: rootserver are mostly also part of the providers domain, check or save your /etc/hosts before you delete)
- DNS server (check /etc/resolv.conf )
- SSH keys (if other people work on your server, they will have to accept new keys otherwise. This includes keys from your Apache, your mail servers, your SSH server and others.)
- Hardware info (network card, etc. Refer to your pre-installed /etc/modules.conf )
- Grub configuration files.
In general, it is a good idea to have a local copy of your original /etc directory on your local hard drive.
From a host running Arch Linux
Follow Installation guide#Mount the file systems to mount the filesystem that will be used for the root directory as well as all the other needed mount points. If you already use the /mnt directory for something else, just create another directory such as /mnt/install and use it as the mount point base for the rest of the installation.
At this stage, Arch Linux can either be installed from scratch or it can mirror the host installation. The two options are described thereafter.
Create a new Arch installation
In the procedure, the first step, Installation guide#Select the mirrors, can be skipped since the host should already have a correct mirrorlist.
Create a copy of an existing Arch installation
It is possible to replicate an existing Arch Linux installation by copying the host filesystem to the new partition and make some adjustments to it to make it bootable and unique.
The first step is to copy the host files into the mounted new partition, for this, consider using the approach exhibited in rsync#Full system backup.
Then, follow the procedure described in Installation guide#Configure the system with some caveats and additional steps:
- Installation guide#Time zone, Installation guide#Localization and Installation guide#Root password can be skipped
- Installation guide#Initramfs may be required in particular if changing filesystem, for example from ext4 to Btrfs
- Regarding Installation guide#Boot loader, it is necessary to reinstall the bootloader
- Delete /etc/machine-id so that a new, unique one, is generated at the next boot
If the mirrored Arch installation may be used within a different configuration or with another hardware, consider the following additional operations:
- Use the CPU microcode update adapted to the target system during the step Installation guide#Boot loader
- If any specific Xorg#Configuration was present on the host and may be incompatible with the target system, follow Moving an existing install into (or out of) a virtual machine#Disable any Xorg-related files
- Make any other adjustment appropriate to the target system, like reconfiguring the network or the audio.
From a host running another Linux distribution
There are multiple tools which automate a large part of the steps described in the following subsections. See their respective homepages for detailed instructions.
The manual way is presented in the following subsections. The idea is to either get pacman working directly on the host system, or to run an Arch system inside the host system, with the actual installation being executed from the Arch system. The nested system is contained inside a chroot.
Using pacman from the host system
Pacman can be compiled on most Linux distributions, and used directly on the host system to bootstrap Arch Linux. The arch-install-scripts should run without issues directly from the downloaded sources on any recent distribution.
Some distributions provide a package for pacman and/or arch-install-scripts in their official repositories which can be used for this purpose. As of July 2020, Void Linux is known to provide the pacman package, and Alpine Linux and Fedora are known to provide both pacman and arch-install-scripts.
Creating a chroot
Two methods to setup and enter the chroot are presented below, from the easiest to the most complicated. Select only one of the two methods. Then, continue at #Using a chroot environment.
Method A: Using the bootstrap image (recommended)
Download the bootstrap image from a mirror into /tmp . You can also download the signature (same URL with .sig added) and verify it with GnuPG.
Extract the tarball:
Select a repository server by editing /tmp/root.x86_64/etc/pacman.d/mirrorlist .
Enter the chroot:
- If bash 4 or later is installed, and unshare supports the —fork and —pid options:
- Otherwise, run the following commands:
Method B: Using the LiveCD image
It is possible to mount the root image of the latest Arch Linux installation media and then chroot into it. This method has the advantage of providing a working Arch Linux installation right within the host system without the need to prepare it by installing specific packages.
The root image can be found on one of the mirrors under iso/latest/arch/x86_64/ . The squashfs format is not editable, so we unsquash the root image and mount it.
To unsquash the root image, run
Select a repository server by editing squashfs-root/etc/pacman.d/mirrorlist .
Before chrooting to the unsquashed root image, we need to set up some mount points and copy the resolv.conf for networking.
Now, everything is prepared to chroot into the newly installed Arch environment:
Using a chroot environment
The bootstrap environment is really barebones (no nano or lvm2 ). Therefore, we need to set up pacman in order to download other necessary packages.
Initializing pacman keyring
Before starting the installation, pacman keys need to be setup. Before running the following two commands, read pacman-key#Initializing the keyring to understand the entropy requirements:
If you prefer generating entropy through system activity and decide to run ls -Ra / in another console (TTY, terminal, SSH session. ), do not be afraid of running it in a loop a few times: five or six runs from the host proved sufficient to generate enough entropy on a remote headless server.
Downloading basic tools
Installation tips
Some host systems or configurations may require certain extra steps. See the sections below for tips.
Debian-based host
/dev/shm
On some Debian-based host systems, pacstrap may produce the following error:
This is because in some versions of Debian, /dev/shm points to /run/shm while in the Arch-based chroot, /run/shm does not exist and the link is broken. To correct this error, create a directory /run/shm :
/dev/pts
While installing archlinux-2015.07.01-x86_64 from a Debian 7 host, the following error prevented both pacstrap(8) and arch-chroot from working:
Apparently, this is because these two scripts use a common function. chroot_setup() [1] relies on newer features of util-linux , which are incompatible with Debian 7 userland (see FS#45737).
The solution for pacstrap is to manually execute its various tasks, but use the regular procedure to mount the kernel filesystems on the target directory ( «$newroot» ):
Instead of using arch-chroot for Installation guide#Chroot, simply use:
lvmetad
Trying to create LVM logical volumes from an archlinux-bootstrap-2015.07.01-x86_64 environment on a Debian 7 host resulted in the following error:
(Physical volume and volume group creation worked despite /run/lvm/lvmetad.socket: connect failed: No such file or directory being displayed.)
This could be easily worked around by creating the logical volumes outside the chroot (from the Debian host). They are then available once chrooted again.
The factual accuracy of this article or section is disputed.
Also, if the system you are using has lvm, you might have the following output:
This is because debian does not use lvmetad by default. You need to edit /etc/lvm/lvm.conf and set use_lvmetad to 0 :
The factual accuracy of this article or section is disputed.
This article or section needs language, wiki syntax or style improvements. See Help:Style for reference.
This will trigger later an error on boot in the initrd stage. Therefore, you have to change it back after the grub generation. In a software RAID + LVM, steps would be the following:
- After installing the system, double check your Mkinitcpio and your bootloader settings. See Arch boot process#Boot loader for a list of bootloaders.
- You may need to change your /etc/mdadm.conf to reflect your RAID settings (if applicable).
- You may need to change your HOOKS and MODULES according to your LVM and RAID requirements: MODULES=»dm_mod» HOOKS=»base udev mdadm_udev . block lvm2 filesystems . «
- You will most likely need to generate new initrd images with mkinitcpio. See Mkinitcpio#Image creation and activation.
- Set use_lvmetad = 0 in /etc/lvm/lvm.conf .
- Update your bootloader settings. See your bootloader’s wiki page for details.
- Set use_lvmetad = 1 in /etc/lvm/lvm.conf .
Fedora-based host
On Fedora based hosts and live USBs you may encounter problems when using genfstab to generate your fstab. Remove duplicate entries and the «seclabel» option where it appears, as this is Fedora-specific and will keep your system from booting normally.
Things to check before you reboot
Before rebooting, doublecheck a few details in your installation to achieve a successful installation. To do so, first chroot into the newly-installed system, and then:
- create a user with password, so you can login via ssh. This is critical since root login is disabled by default since OpenSSH-7.1p2.
- set a root password so that you can switch to root via su later
- install a ssh solution and enable its server instance to start automatically at boot.
- set up your network configuration in order to have a connection started automatically at boot.
- set up a boot loader and configure it to use the swap partition you appropriated earlier as the root partition. You might want to configure your bootloader to be able to boot into your old system; it is helpful to re-use the server’s existing /boot partition in the new system for this purpose.
Replacing the existing system without a LiveCD
700 MB of free space somewhere on the disk, e.g. by partitioning a swap partition. You can disable the swap partition and set up your system there.
Set old swap partition as new root partition
Check cfdisk , /proc/swaps or /etc/fstab to find your swap partition. Assuming your hard drive is located on sdaX ( X will be a number).
Do the following:
Disable the swap space:
Create a filesystem on it
Create a directory to mount it in
Finally, mount the new directory for installing the intermediate system.
Installation
Install essentials packages and any other package required to get a system with internet connection up and running in the temporary partition, being careful with the limit of
700 MB space. When specifying packages to be installed with pacstrap, consider adding the -c flag to avoid filling up valuable space by downloading packages to the host system.
Once the new Arch Linux system is installed, fix the bootloader configuration, then reboot into the newly created system, and rsync the entire system to the primary partition.
Источник