Installing Arch Linux for the first time can be a daunting task but I will try my best to cover as much as possible. Since Archlinux is a rolling distro, there is never any need to reinstall unless you mess it up

So hopefully, you only have to do this once. Later on I will show how to automate this after you set it up once.

NOTE: in this tutorial, # means the command must run as root and $ means the command must be run as user

The installation media is a dual architecture which basically means that it included both 32bit and 64bit versions on the disc.

The installation images are signed and I would recommend that you verify the signature before using the iso. This can be done by downloading the .sig file from the download page to the same directory as the .iso file and then run:

# pacman-key -v iso-file.sig

After burning the iso, boot the livecd and choose the first entry in the menu, "Boot Arch Linux Live CD". Then press enter.

Next make sure your bios is set to boot from the cd/dvd drive. When the Arch menu appears, select "Boot Arch Linux" and press Enter to boot (if booting from a UEFI enabled disk, the option will say something like "Arch Linux archiso x86_64 UEFI").

After some scrolling boot messages, you will be greeted with a prompt that automatically logins you in as root.

If you are using an Intel video chipset and the screen goes blank during the boot process, the problem is likely an issue with Kernel Mode Setting. A possible workaround may be achieved by rebooting and pressing e over the entry that you are trying to boot (i686 or x86_64). At the end of the string type nomodeset and press Enter. Alternatively, try video=SVIDEO-1:d which, if it works, will not disable kernel mode setting. You can also try i915.modeset=0. See the Intel article for more information.

If the screen does not go blank and the boot process gets stuck while trying to load the kernel, press Tab while hovering over the menu entry, type acpi=off at the end of the string and press Enter.

Also:

Quote

Warning: As of v197, udev no longer assigns network interface names according to the wlanX and ethX naming scheme. If you are coming from a different distribution or are reinstalling Arch and not aware of the new interface naming style, please do not assume that your wireless interface is named wlan0, or that your wired interface is named eth0. You can use the command ip link to discover the names of your interfaces.

Ok, all warnings aside for now..

Next you need to check if your network is up and running. The dhcpcd daemon starts automatically at boot so if you have a wired connection, more than likely you are online. To test this, ping google.com:

Ok, we should now have networking completely setup. Next we need to prepare the harddrive's partitions for /, /home and swap. If you already have your partitions setup from another installation, you can skip this part.

I personally have not used GPT with UEFI so I will only be explaining how to setup MBR partitions. NOTE: I have the hardware but have not dabbled with it so far but the Beginner's Guide covers this extensively.

In order to use MBR partitions, you must use cfdisk, a CLI based partitioner.

Cfdisk looks confusing at first, but is actually very simple to use. If you want to make a partition, select the item with the file system type "Free Space" and choose "New".

Next you will be able to choose between a primary partition and a logical partition. Most of the time you will only need to make primary partitions, but if you will need more than four partitions, you will need to make a logical partition, which can contain many more than you will need.

Next you will choose how big you want your partition to be. The first one we will be making is the root partition, which will contain all of your programs. It will need to be at least 6GB unless you will be installing a lot, then 20-40GB would suit better. I personally use 40gb for / but it is up to you. Cfdisk expects you to put in the sizes in megabytes. Since a gigabyte is about 1000MB, you can easily work it out.

The next step will ask you whether you want your partition to be at the beginning of the free space or at the end. Choose the beginning unless you have specific needs.

Now we will make a home partition, which keeps your files separate from your programs, so if you want to reinstall, your files and settings will be saved in the home partition.

Next you need to make the swap partition.You should make it double the size of your RAM, so if I have 1GB of RAM, make your swap 2000MB. You will need to choose the file system type for this one, so go to "type". A bunch of numbers and file system types will appear. Ignore them and press a key. Type in the number "82". There. Now you have made your swap partition!

Repeat the steps again, and when you get to when you choose which size you would like the partition, just press enter because you want your home partition to fill up the rest of your hard drive or choose the size you would like your /home.

Next you need to use the cursor keys to go to "Write". Type "yes" to confirm it. Next go to "Quit".
(Note I always write down my partition layout since it helps when setting the mount points.)

The next step is to create your filesystems on the partitions you just made. I have my root (/) parition set to sda1 so in order to format your root partition with ext4, you need to run this:

# mkfs.ext4 /dev/sda1

I personally do not format my /home partition but you can format it as ext4 with the same command as above, except you need to change the partition location.

Next you need to activate your swap parititon. If you second partition is swap, you need to run this command (otherwise change the partition number):

# mkswap /dev/sda2
# swapon /dev/sda2

Each partition is identified with a number suffix. For example, sda1 specifies the first partition of the first drive, while sda designates the entire drive.

To display the current partition layout, run this:

# lsblk /dev/sda

Now we need to mount the root partition on /mnt:

# mount /dev/sda1 /mnt

Then make a directory to mount home and mount the partition:

# mkdir /mnt/home
# mount /dev/sda2 /mnt/home

Once that is done, we need to install the base system:

# pacstrap -i /mnt base base-devel

If pacman complains that error: failed to commit transaction (invalid or corrupted package), run the following command:

# pacman-key --init && pacman-key --populate archlinux

Now you have a basic Arch system. You can install the other packages using pacman and AUR.

Next you will need to generate an /etc/fstab by running these two commands:

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

Now you need to chrrot and configure the base system. In order to chroot, run this command:

# arch-chroot /mnt /bin/bash

The next step is to configure your Arch Linux base system. These config file can either be created or edited if you wish to change the defaults.

Make sure you closely follow and understand these steps to ensure that you have a working system when you are done. Do not skup these steps!

Next you need to set your locale so you will have the correct time/date, money values and the correct alphabet.

There are two files that you need to edit: locale.gen and locale.conf.

Setting only LANG should be enough as it will act as the default value for all other variables. ou can either edit /etc/locale.gen and uncomment your locale or if you are in the US, these command should be suffice:

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

Next you must setup your timezone. All of the times zones and subzones are located in /usr/share/zoneinfo/<zone>/<subzone>:

# ls /usr/share/zoneinfo

You must create a symbolic link in /etc/localtime for thSetting only LANG should be enough as it will act as the default value for all other variables. Adjust the following commands according to your locale, e.g. de_DE.UTF-8. mezone your in. For instance I am in the US and in Central timezone, so I would use this command to set my timezone:

# ln -s /usr/share/zoneinfo/America/Chicago /etc/localtime

Next you must set your hardware clock by generating /etc/adjtime:

# hwclock --systohc --utc

Next you must set your hostname using this command (replace myhostname with your actual hostname):

# echo myhostname > /etc/hostname

Now you need to configure your network again for your newly installed system. I am just going to explain how to setup dhcp as their is a nice wiki entry for setting a static IP and most people will just use dhcp.

If you only use a wired network connection, you do not need a network management service and you can simply enable the dhcpcd service:

# systemctl enable dhcpcd.service

Note: If it doesn't work, use this:

# systemctl enable dhcpcd@interface_name.service

There are many ways of setting up a wireless connection so I will not go over them but the Archwiki has a great entry for Wireless that shows many ways to accomplish this.

Next you need to set the root password:

# passwd

It will ask you for your new root password twice. Make sure you remember exactly what you set it as.

Now you need to setup your bootloader. There are many bootloaders to choose from but I use syslinux as it is simple to use and install. To install syslinux, simply run:

# pacman -S syslinux

You use the syslinux-install_update script to automatically install the bootloader (-i), mark the partition active by setting the boot flag (-a), and install the MBR boot code (-m):

# syslinux-install_update -i -a -m

You must edit /boot/syslinux/syslinux.cfg to point it to the right root partition. This step is vital. If it points to the wrong partition, Arch Linux will not boot. Change /dev/sda3 to reflect your root partition (if you partitioned your drive as in the example, your root partition is /dev/sda1 if you followed this guide. Do the same for the fallback entry.

# nano /boot/syslinux/syslinux.cfg

...

Quote

LABEL arch
...
APPEND root=/dev/sda3 rw

Now you need to unmount your partitions and reboot into your newly installed Arch:

# exit
# umount -r /mnt
# reboot

Make sure you remove the cd/usb as you will boot back into the media otherwise.

After rebooting you will see a Syslinux Entry for Archlinux. Select it and hit enter. the system will boot up. Congratulations! You've made it to your new Arch Linux install!

You can now login as root with the root password

Next you will need to update your system:

# pacman -Syu

Hit enter to accept the updates and enter to install them all. It is pretty self-explanatory. Once this is done, reboot since you will probably have a new kernel installed. After rebooting, log back in as root.

Next you will need to setup a user account. Replacing username with your desired username:

Next we need to install alsa to get sound. Alsa should work out of the box but you need to install alsa-utils for alsamixer. To do this as root, run:

# pacman -S alsa-utils

Then test the sound by running this:

# aplay /usr/share/sounds/alsa/Front_Center.wav

If you hear sound, you are good to go.

Next to install X, type

# pacman -S xorg-server xorg-xinit xorg-utils xorg-server-utils mesa

The Linux kernel includes open-source video drivers by default. If you do not know which video chipset is available on your machine, run:

$ lspci | grep VGA

The vesa driver is a generic driver that will work with almost every GPU, but will not provide any 2D or 3D acceleration. If a better driver cannot be found or fails to load, Xorg will fall back to vesa. To install it:

Xorg has auto-detection and therefore it will work fine without an xorg.conf. If you want to manually configure X, look at the Xorg wiki page. To install X run this:

# pacman -S xorg-twm xorg-xclock xterm

To start(test) Xorg, run this as your user:

$ startx

A few terminal windows should show up, and your mouse should work. If X runs fine then your installation worked. Then you can exit out of X by typing exit into one of the terminals. This will take you back to TTY.

Run this as a regular user:

$ cp /etc/skel/.xinitrc ~/

This will give you a default ~/.xinitrc so you can choose your services and what environment you wish to run.

Next we will be installing KDE (I personally use an tiling environment called i3 but for this tutorial we will install KDE). Install kde or kde-meta. For differences between kde and kde-meta see the KDE Packages article.

# pacman -S kde

If you want to have a minimal installation of KDE, just install kdebase.

You may want to install a graphical login manager. For KDE, the kdm daemon is a good choice.
To start it by default run this:

This will make a directory called packer, change to the directory and use wget to fetch the package.

In the directory you downloaded packer to, you need to extract packer:

$ tar -xzf packer.tar.gz

Then you need to cd into the directory and run makepkg to build the package:

$ cd packer && makepkg

(You need to edit the PKGBUILD and change the source from git://github.com/keenerd/packer.git to git+https://github.com/keenerd/packer.git as their is currently an issue with the PKGBUILD)

You will end up with a file called packer-20131115-1-any.pkg.tar.xz or similar. To install packer, run this as root:

pacman -U packer-20131115-1-any.pkg.tar.xz

Packer acts just like pacman but you can also install packages from the AUR repo. The AUR repo stands for Arch User Repository and contains PKGBUILDS that lets you compile a package from source and instlal it via pacman.

Quote

A good number of new packages that enter the official repositories start in the AUR. In the AUR, users are able to contribute their own package builds (PKGBUILD and related files). The AUR community has the ability to vote for or against packages in the AUR. If a package becomes popular enough — provided it has a compatible license and good packaging technique — it may be entered into the community repository (directly accessible by pacman or abs).

There are some packages that you might want or need that are not in the main repos althoug 99% of packages you want are in the normal repos. The syntax for packer is the same as pacman and you can install update both normal packages and AUR packages with this command:

$ packer -Syu

Backing up and retrieving a list of installed packages

It is good practice to keep periodic backups of all pacman-installed packages. In the event of a system crash which is unrecoverable by other means, pacman can then easily reinstall the very same packages onto a new installation.

Store the pkglist.txt on a USB key or other convenient medium or gist.github.com or Evernote, Dropbox, etc.

Copy the pkglist.txt file to the new installation, and navigate to the directory containing it.

Issue the following command to install from the backup list: # pacman -S $(< pkglist.txt)

In the case you have a list which was not generated like mentioned above, there may be foreign packages in it (i.e. packages not belonging to any repos you have configured, or packages from the AUR).In such a case, you may still want to install all available packages from that list:

"Do you begin to see, then, what kind of world we are creating? It is the exact opposite of the stupid hedonistic Utopias that the old reformers imagined. A world of fear and treachery and torment, a world of trampling and being trampled upon, a world which will grow not less but more merciless as it refines itself. Progress in our world will be progress toward more pain." -George Orwell, 1984

"Do you begin to see, then, what kind of world we are creating? It is the exact opposite of the stupid hedonistic Utopias that the old reformers imagined. A world of fear and treachery and torment, a world of trampling and being trampled upon, a world which will grow not less but more merciless as it refines itself. Progress in our world will be progress toward more pain." -George Orwell, 1984

"Do you begin to see, then, what kind of world we are creating? It is the exact opposite of the stupid hedonistic Utopias that the old reformers imagined. A world of fear and treachery and torment, a world of trampling and being trampled upon, a world which will grow not less but more merciless as it refines itself. Progress in our world will be progress toward more pain." -George Orwell, 1984