User:Iaw4

From ArchWiki
Jump to: navigation, search

Iaw4 Alternative Installation Guide

This document is a fork of the official Installation_guide for Arch Linux. It Is shorter than the Beginners' guide, but more detailed than the Installation_guide. To "fork" it further, select "edit" or "source" (not html source, but wiki source) and use copy-and-paste.

Before installing, you may want to look at the FAQ. If looking for a detailed, highly-explanatory, installation guide see the Beginners' guide, or Category:Getting and installing Arch for specific installation cases.

Most help can be found on the wiki or through 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.


Download and Bootable Media Creation

Download the most recent Arch Linux installation ISO image from the Arch Linux download page. You probably want an image named something like archlinux-yyyy.mm.dd-dual.iso, around 500MB in size. This is a hybrid image that allows booting into an x86_64 or i686 (32-bit) live system, depending on the system's architecture and the user's choice. Make sure to check the md5 or sha hash sums of the image you just downloaded first. A corrupt image will lead to undiagnosable installation errors and significant hair loss. Repeat: once downloaded, verify the integrity of the image against the PGP signature

# pacman-key -v archlinux-yyyy.mm.dd-dual.iso.sig

or look at the checksums (e.g. md5sum archlinux-yyyy.mm.dd-dual.iso) which are provided on the download page.

Note that the arch packages themselves are not included in the image. Instead, the installation process will retrieve packages from a remote repository. Therefore a working internet connection will be required after the installation ISO boot to install arch on your disk. (You cannot install this on your isolated cabin computer, unlike the iso image of most other linux distros. On the plus side, this means that your initial install will be up to date.) A good part of the 500MB (or so) of the installation ISO image is taken up by the smarts to automate the connection to the internet. Warning: if the install image fails to boot with a working net connection, then you may have hardware that is not easily supported by or made to work under arch.

After downloading the image, you need to burn it to a medium that is bootable. This used to be CD's in the past, but nowadays almost everyone writes iso images to written to a USB stick instead. (Virtual machine emulators, like vmware or qemu, can boot directly from iso files.)

In brief, first unmount your usb stick (/dev/sd[usb]) and then write the image to the medium. On a linux host, you should be able to use

# umount /dev/sd[usb]
# dd if=archlinux-yyyy.mm.dd-dual.iso of=/dev/sd[usb]

where you probably have to replace both the if and the of appropriately. On a Mac OSX host, you require another interim step

# hdiutil convert -format UDRW -o ~/tmp/archlinux.img archlinux-yyyy.mm.dd-dual.iso
# diskutil unmountDisk /dev/disk[usb]
# dd if=archlinux.img of=/dev/rdisk[usb] bs=1m

(If you run windows, it's your own fault.) If you find the above instructions too difficult, you should probably start with an easier linux distribution (like ubuntu, debian, or fedora), learn how to use its command line, and then return to arch. Arch is leaner, meaner, and better than those distros, but it assumes a lot more linux knowledge.


Installation After Booting The Installation Medium

After booting the installation image, the following steps are required to initialize the installation process.


Set the keyboard layout

The default keyboard layout is US. Alternative keyboard layouts can be loaded with loadkeys keymap_file: keymap files can be found in /usr/share/kbd/keymaps/ (path and file extension can be omitted).


Partition, Format, and Mount the Disk

See Partitioning for details; some special partitions may be needed, see EFI System Partition and GRUB BIOS boot partition. If you want to create any stacked block devices for LVM, disk encryption or RAID, do it now. In the remainder of this guide, we will assume that you are installing to the disk drive enumerated as sdx.

The below instructions assume you want one main root partition. An alternative to the single root partition is to have a separate /home/ partition, and to link /usr/local to /home/local. This makes it easier to update the operating system without touching the user files. However, this is never perfect, because a good number of files in /etc will have to be edited.

Assuming you have a 64-bit CPU, you have two main choices:

1. EFI+GPT (newer, safer, and better) or

2. BIOS+MBR (older and less trouble).

EFI was adopted in 2005, and should work on all modern PCs. [However, under qemu, the combination is still somewhat flaky (as of 2015-03).] You may have to enable EFI in your computer BIOS (startup screen). (GPT is a formatting scheme for the hard drive that you will set from the Arch installation disk.) Different combinations of the two (e.g., EFI+MBR) are asking for trouble.

See File systems. You do not need a swap partition. Swap partitions have been obsolete for at least 20 years. If need be, spend $20 on 2GB of RAM or create a swapfile later.

EFI+GPT Partition Setup Recommendation

To partition the disk with EFI+GPT, use gdisk on the device (not the partition).

# gdisk /dev/sdx

Unlike BIOS, EFI requires a dedicated boot partition. If you use EFI, then create the first EFI boot partition with the EFI system id partition type EF00 and at least 512MB as /dev/sdx1, and the second root partition with the default linux partition id 8300 as /dev/sdx2.

The most common EFI setup is one boot partition (which must be vfat with partition id EF00) and one linux partition. For example,

# mkfs.vfat /dev/sdx1
# mkfs.ext4 /dev/sdx2

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

# mount /dev/sdx2 /mnt
# mkdir /mnt/boot
# mount /dev/sdx1 /mnt/boot

BIOS+MBR Partition Setup Recommendation

To partition the disk with BIOS+MBR, use fdisk. It is often most convenient to assign the entire drive to one big partition. Preferably use only primary (not logical) partitions. Logical partitions were an awful kludge to allow more than four partitions, and if you ever accidentally lose your MBR (unlike GPT, there is no secondary backup), finding the partition start becomes really, really difficult. For the BIOS+MBR way of life, just

 # fdisk /dev/sdx
 # mkfs.ext4 /dev/sdx1
 # mount /dev/sdx1 /mnt

Connect to the Internet

The installer iso image is pretty smart about its internet connectivity. On most computers and network, networking will work out of the box. Internet service via DHCP discovery is enabled on boot for supported wired devices; read more at Network configuration. For supported wireless devices run wifi-menu to set up the network; read more with Wireless network configuration. Few networks today require a static IP or further network management tools, but if you do, then you can stop the DHCP discovery service with systemctl stop dhcpcd.service, and read more Netctl. To check that your net connection is live, use

# ip a

ip is a new tool that replaces the more familiar ifconfig and iwconfig. Also, try

# ping www.google.com

However, although the install iso is smart about its internet connectivity, your newly created arch system will not be. More often than not, you will have to make sure your Internet connection will also work on your new system before you reboot. This will be explained below.


Set a Mirror

Although the original installation guide suggests setting the mirror already here pacman -Syyu, this has given me a lot of trouble. I would suggest relying on arch for the mirrors at this point.


Install the base packages

Use the pacstrap script to install the base group:

# pacstrap /mnt base

Other packages or groups can be installed by appending their names to the above command (space seperated), possibly including the boot loader.


Configure the system (fstab, hostname, locale)

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

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

Set the hostname:

# echo computer_name > /mnt/etc/hostname

Change root into the new system:

# arch-chroot /mnt

Set the time zone:

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

For example

# ln -sf /usr/share/zoneinfo/US/Pacific-New /etc/localtime

If you need any further locales, uncomment the needed locales in /etc/locale.gen.

Next, generate locales with

# locale-gen

Set locale preferences in /etc/locale.conf and possibly $HOME/.config/locale.conf:

# echo LANG=en_US.UTF-8 > /etc/locale.conf

Make sure you do not misspell this. Errors are not reported at this stage, but may cause errors in the future that will be difficult to debug (e.g., in mkinitcpio).

If you want, you can add console keymap and font preferences in /etc/vconsole.conf. This file is read by systemd on startup, and helps create and cusomize pty's. If you don't know what this means, you probably don't care.

Create Networking for your new Arch system

Configure the network for the newly installed environment: see Network configuration and Wireless network configuration. The wifi-menu on the installation iso is great, but has not yet been installed on your new system. If you want the same easy wifi-menu when you boot your system, install it

# pacman -Si netcfg dialog wpa_supplicant ifplugd wpa_actiond wireless_tools ifenslave bridge-utils

([2015-04-03: netcfg has disappeared]

To have networking try to come up automatically at boot time, execute

# systemctl enable dhcpcd.service

Create an Initial RAM Disk

Configure /etc/mkinitcpio.conf if additional features are needed. Create the new initial RAM disk (needed for the linux kernel to get going before systemd takes over) with

# mkinitcpio -p linux

Ignore the error about the aic94xx driver not being found. Some other drivers may also not be found.

Root Password

Set the root password:

# passwd


Install a bootloader

See Boot loaders for the available choices and configuration.

For the less common but more modern GPT+EFI setup, if all you want to do is to boot this partition, you can use the EFI Stub manager

# pacman -S efibootmgr
# efibootmgr -d /dev/sdX -p 1 -c -L "Arch Linux" -l /vmlinuz-linux -u "root=/dev/sdx2 rw initrd=/initramfs-linux.img"

For the most common MBR+BIOS setups, the following grub installation should work

# pacman -S grub
# grub-install --target=i386-pc --recheck --debug /dev/sdx
# grub-mkconfig -o /boot/grub/grub.cfg

Unfortunately, short of a direct error message, the only way to learn whether the boot manager installation has succeeded is to reboot and pray. (Needless Editorial: This and the unwillingness of the kernel to search partitions when /etc/fstab is wrong have caused no pain on end to newbies and experienced admins alike. In a sane world, all file systems and partitions would have the first sector (4KB) reserved for a set of magic bytes that tells the OS that they want to be bootable, and at what offset the kernel starts.)

If you have difficulties in some cases, it helps to install a common linux distribution, such as ubuntu, on a third partition, and let ubuntu create the boot manager. It is usually a lot easier to modify the boot manager than to install it the first time. If nothing else, failure will be less catastrophic.


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

This is IMHO where you may want to choose better pacman 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 copy of the mirrorlist file will later be copied on the new system by pacstrap, so it is worth getting it right. However, this has tripped up some installations.

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

For a list of applications that may be of interest, see List of applications. I recommend at least the following:

# pacman -S mlocate make gdisk syslog-ng openssh rsync sudo

(Uncomment the relevant line in /etc/sudors.) Most users will also want their computers to update the time from the net

# pacman -S ntp
# systemctl enable ntpd.service

At this point, you should probably add a user account with

# useradd -m -d /home/me me

Give it a password, add the user to the wheel group, and disable the root account.

Next, you may want to install a better text editor (like emacs-nox) and a GUI (such as gnome or kde or mint).

Alternative Ways to Get Arch Running

A Virtual Machine Installed Image

The easiest way to try out an Arch install is to try it in a virtual machine. For a virtual machine image that results from the above instructions (using BIOS+MBR), go to [1]. It contains the image and md5 hash of a vmware virtual machine, created in mid-March 2015.

After you have downloaded it, first check the md5 (d66dd0e6daf3ca53a0525cd5efbb7bb3), then boot the virtual machine in vmware player (or vmware fusion on OSX).

Login as root (without a password), set a password, then login as me (without a password), and set another password.

Again, make sure to change the password on the root and me accounts. openssh is installed, and you do not want anyone over the Internet to invade you.

Update the image to the current Arch,

 # pacman -Syu

Enjoy!

Installation by GUI

Arch offers no arch GUI installer, as there are on ubuntu and most other linux distros. There are other distributions that build on arch and some have GUI installers. However, if you use them, then you are deemed not running Arch, but their distribution.


Installation by Script

Here I need to add some scripts that execute all of the above steps automatically. I plan on creating a script one of these days. If you have one, please email it to me.