Overclock.net › How To's › How To Install Archlinux The Easy Quick And Dirt Way

How To Install Archlinux The Easy Quick And Dirt Way

Archlinux Install Guide.


Due to the the AIF ( Arch Installation Framework ) being removed, everything is command line based now. But, installing Arch still could not be any easier. And most of this guide will be an almost copy/paste of most of the Arch wiki as it really is just that easy and straight forward.

It won't go into as much detail as the Arch Beginners Guide though. Just enough to get you up and running, no more.

The new image is purely a netinstall image due to Arch nature of being rolling release having a core image makes little sense. So you will need an active internet connection, I prefer wired for initial setup as it's just that much easier, and I don't feel like explaining how to connect to wireless via the command line ( it's 3am at the moment ) so if you must, then head over to the Wiki.



Downloading.

Ok, so first things first. Head over to the Arch Linux download page and download the new installation media.

If you're on Windows you can use a program such as Unetbootin or ImgBurn to write the image file to CD/DVD or Flash Drive. And now you are ready to go.



Breif description.

Ok, after you load up your new Arch Linux ISO, you'll be greeted with a menu where you can choose to install x86 or an x64 ( x86_64 ) system, choose the appropriate for you and continue.

Afterwards, you'll see the kernel load and you'll be automatically logged into root. So time to begin.

The basic steps that we'll take are;

1. Connect to the internet.
2. Partitioning your hard drive. ( if not already done )
3. Mounting the partitions.
4. Installing the base system.
5. Basic Setup.
6. Installing Grub. ( or your bootloader of choice )

So let's begin shall we?



Step 1 - Setting up an internet connection.

First is easy if you're using an ethernet connection which I suggest you do, simply type " dhcpcd " and it should set up your ethernet connection for you.



Step 2 - Partitioning your hard drive.

Next you'll need to partition your hard drive, you can use whichever program you want ( if you aren't familiar with " cfdisk " or " gparted " then you can use the Windows Disk Manager before you begin. )

For your basic setup, you can install everything to one partition, or you can make separate partitions for for different directories such as boot, root, home, swap, tmp, or any other you want. I generally just keep mine simple with boot, root, and home.

Now, for a basic install you simply need 15-20GB of space ( or less depending on how much you expect to install ), and if you decide to make multiple partitions, boot can be pretty much any size ( I keep mine at 150MB so there's enough room for multiple kernels / Other installs ), Root can be... as low as 3GB or as high as you want ( most generally don't need more than 10-15GB ), Home is where you'll keep all of your files, so size it accordingly. And Swap ( optional ) can be as large or small as you want/need. So decide on a partiion scheme and go at it.

# Just a note on partitioning for those who do not know hard drives. [/size] Warning: Spoiler! (Click to show)
You can have a MAX of 4 Primary partitions. But there is a way around this. And to get the most expansion out of your hard drive, you can choose 3 primary partitions and 1 extended partition. The extended partition in essense is like a folder of sorts. It's still a normal partition, but it allows you to partition itself many times over.
Code:
A bit of a visual representation;

 ________________________________________________________
|   Primary    |   Primary   |   Primary   |   Primary   |
|_____________ |____________ |____________ |____________ |

Or you can go about with the extended partition

 ___________________________________________________________________________________
|    Primary    |    Primary    |    Primary    |             Extended               |
|______________ |______________ |______________ |_Ext1, Ext2, Ext3, Ext4, Ext5, Etc_ |

And when setting up filesystems, remember to skip /dev/sda4 as it is the main extension. Like;

sda1 - Primary
sda2 - Primary
sda3 - Primary
sda4 - Extended ( skip )
sda5 - First extended partition
sda6 - Second extended partition

And so on

Next we'll have to format them, it is really easy using the " mkfs.ext{2,3,4} " command. For this example I'll be using /dev/sda partition 1 and ext4. Simple type " mkfs.ext4 /dev/sda1 " and you are done. Now just repeat for each partiion you decided to make.

So if you've made a partition scheme like mine simply type;

mkfs.ext4 /dev/sda1
mkfs.ext4 /dev/sda2
mkswap /dev/sda3 <-- for Swap you'll use " mkswap "
mkfs.ext4 /dev/sda4

Next you'll need to turn on the swap file so type " swapon /dev/sda3 "



Step 3 - Mounting the partitions.

Here all you need to do is mount the partitions you just made to " /mnt ", so to get started;

First mount your root partition ( using the same layout as I did above, root would be /dev/sda2 so we'll start there ) type;

mount /dev/sda2 /mnt

Now you'll need to make any directories if you're using multiple partitions, one for each partition. If you're only using one partition then you are done and can skip this.

mkdir /mnt/{boot,home}
mount /dev/sda1 /mnt/boot
mount /dev/sda4 /mnt/home



Step 4 - Installing the base system.

Time to actually install the system. And it is extremely easy with the use of the " pacstrap ". So to begin we type;

pacstrap /mnt base base-devel

you can also install other tools you may need, such as wireless stuff; wireless_tools, wpasupplicant, wpa_actiond, iw, and any firmware for your wireless drivers and whatever else you want using the same command " pacstrap /mnt {packages}".



Step 5 - Basic setup of the initial system.

Start with generating your fstab file;

genfstab -p -L /mnt >> /mnt/etc/fstab ( the -L makes it use labels such as /dev/sda, you can use -U instead if you want UUID's )

Now we'll do the easiest chroot you'll likely ever do,

arch-chroot /mnt

And you should now be in your new install, so time to do some basic setup of your files.

1. Setting your hostname type " echo myhostname > /etc/hostname " and change myhostname to the hostname of your choice.

2. Type " nano /etc/hosts " and make sure it looks similar to below, where myhostname is the hostname you chose above;
Code:
127.0.0.1   localhost.localdomain   localhost myhostname
::1         localhost.localdomain   localhost myhostname

3. Type " nano /etc/vconsole.conf " and make sure it looks similar to below ( this is only used for TTY's );
Code:
KEYMAP=us
FONT=
FONT_MAP=

4. Create a symbolic link from your time zone to /etc/localtime, you can find the proper zones and subzones in /usr/share/zoneinfo/{zone}/{subzone} choose accordingly then type;
" ln -s /usr/share/zoneinfo/Zone/SubZone /etc/localtime " filling in the proper Zone and SubZone, US/Eastcost is simply /usr/share/zoneinfo/America/New_York as an example.

5. Type " nano /etc/locale.gen " and uncomment your proper locales. If english then simply uncomment both en_US entries. Then type " locale-gen ". Then you'll have to set the same locale in /etc/locale.conf so type " echo "LANG=en_US.UTF-8" > /etc/locale.conf " changing the LANG= as needed variable as needed.

6. Set your clock with either utc or local time;
" hwclock --systohc --utc "
" hwclock --systohc --localtime "

7. To get DHCPCD to run at startup, simply type " systemctl enable dhcpcd@eth0.service " and it will connect to eth0 at startup. ( change appropriately if needed, eth1/2/3/4 etc. )

8. Create your initial ramdisk environment by typing the following; " mkinitcpio -p linux "

9. Install the bootloader of your choice and configure it;
" pacman -S grub-bios " ( or grub-efi if using an efi system )
" grub-install /dev/sda " ( make sure not to use a partition number to write to the MBR )
" grub-mkconfig -o /boot/grub/grub.cfg "
And if you're dualbooting with Windows install os-prober and run grub-mkconfig again;
" pacman -S os-prober "
" grub-mkconfig -o /boot/grub/grub.cfg "

There is currently an issue with the grub package that causes grub-mkconfig to crash; you may receive several syntax or out of memory errors when attempting to run the grub-mkconfig line as suggested above. To work around this - simply execute the following:
echo "GRUB_DISABLE_SUBMENU=y" >> /etc/default/grub


10. Set a root password by typing " passwd " then typing your password.



Step 6 - Done.

Congratulations, you should now be done. Simply type " exit " to exit your chroot. And then umount the partitions " umount /mnt/{boot,home} && umount /mnt " and type " reboot " to restart and boot into your new install.



Getting the basics all set up

Warning: Spoiler! (Click to show)
Now the system should have restarted and we are then thrown into the command line again. We will first log in as root using the password set earlier.

First on the list of things to do, if you installed from the disc, you will have to update. If you installed from the net, you should be up to date. Your network should be connected already if not, the run dhcpcd eth0 or whatever your ethernet cable is, type ifconfig to find that out. And for good measures, go ahead and run pacman -Syu .

Ok, now that the system is all up to date it's time to start getting ready for the desktop. Here's a list of what we need to do;
  • Install Sudo
  • Install Xorg
  • Install Alsa
  • Set up a user
  • Install video drivers
  • Install Desktop Environment


So to get started and knock it out mostly in one hit, type pacman -S sudo alsa-oss alsa-utils xorg xorg-server xorg-server-utils xorg-utils xorg-xinit . That should get sudo, alsa, and xorg installed.

Configuring Sudo

Pretty easy, type EDITOR=nano visudo and then uncomment this line; " %wheel ALL=(ALL) ALL "
Code:
##
## User privilege specification
##
root ALL=(ALL) ALL 

## Uncomment to allow members of group wheel to execute any command
%wheel ALL=(ALL) ALL 

## Same thing without a password
# %wheel ALL=(ALL) NOPASSWD: ALL

## Uncomment to allow members of group sudo to execute any command
# %sudo ALL=(ALL) ALL

## Uncomment to allow any user to run sudo if they know the password
## of the user they are running the command as (root by default).
# Defaults targetpw  # Ask for the password of the target user
# ALL ALL=(ALL) ALL  # WARNING: only use this together with 'Defaults targetpw'

## Read drop-in files from /etc/sudoers.d
## (the '#' here does not indicate a comment)
#includedir /etc/sudoers.d

Save, and you will be set to go.

To add a user

simply type; useradd -m -g users -G audio,lp,optical,storage,video,wheel,games,power -s /bin/bash shrak <- or your own username, must be all lowercase. Then type passwd shrak <- or your username of course, and type a password for your user. And you should now be able to type exit to log out of root and then log back in using your username and password.

Now, we'll be installing the video drivers.

For more information on them look here .

Pick which one you need and install

xf86-video-intel
xf86-video-ati
xf86-video-nouveau ( 3rd party nvidia drivers )
nvidia & nvidia-utils

Setting up ALSA to load on boot

Type alsamixer and unmute any channels you'll need, usually Master, PCM, Front, Left, LFE, Line, Mic and turn them up ( but make sure db stays below 0, otherwise you may get some distorsion ).

And last but not least, The Desktop Environment.

This one can be a bit of a pain since there's so many different choices and combinations. Simply go here for a list of different Desktop Environments and precise instructions on how to install them. Since they're already laid out pretty well, I won't bother explaining them.

I'm going to pick XFCE for this since it's pretty straight forward and easy. For me, and XFCE, it's as simple as typing pacman -S xfce4 xfce4-goodies and it will install everything needed. And as I'm just using the command line to launch I simply added " exec startxfce4 " to my ~/.xinitrc file and typed startx. But if you install Gnome, or KDE you will have to add GDM or KDM to the startup services, so type " systemctl enable gdm " or whichever display manager you want to use. Then just reboot and you will load directly into KDM or GDM, whatever you chose ( KDE or Gnome ). Don't forget if something calls for DBUS or HAL, to make sure to add it to your daemons array as well. But only if it's called for by the instructions in the Arch Wiki.

And we're done.

Don't mind the terminal, that's just from my normal Desktop computer hovering over the vm using a screenshot program.
373



A few must have programs to keep things easy and tips & tricks;

Warning: Spoiler! (Click to show)
Pacman usage

Just a few here that may be useful for some people.

pacman -S {package-name} << installs program(s)
pacman -Ss {package-name} << search for program(s)
pacman -Syy {package-name} << forces download of a fresh package list and updates repo(s)
pacman -Syu {package-name} << fully updates system

pacman -Rns {package-name} << removes programs

pacman -Q {package-name} << query a package to check if it's installed
pacman -Ql {package-name} << queries a package then lists where it's installed files are


AUR ( Arch User Repository )

The AUR will hold a number of programs that haven't made it to the official repository yet, along with user hacked programs to add additional support, and functionality. But, to install things from the AUR you normally would have to download the PKGBUILD, or the TarBall. But to make things easier you can install a wrapper for Pacman to add the funtionality. There are quite a few out there but I myself prefer yaourt, another choice is Clyde.

sudo pacman -S yajl curl

cd ~/

wget http://aur.archlinux.org/packages/ya/yaourt/yaourt.tar.gz
wget http://aur.archlinux.org/packages/pa/package-query/package-query.tar.gz

tar zxvf yaourt.tar.gz
tar zxvf package-query.tar.gz

cd package-query/
makepkg -i

cd ../yaourt/
makepkg -i


Then just use it as you would pacman, just use yaourt instead.

Example;
yaourt -S random-program
or
yaourt -Syua ( a will update all the aur packages )

* No need to use sudo with it, it'll ask for the pass later.

And a little clean up;

cd ~/

rm -rf package-query*
rm -rf yaourt*


Keeping your mirrorlist up to date and speedy

From time to time mirrors will either go down completely, go out of sync, or begin to throttle. So here you will be shown how to solve that problem. Like most things, there are multiple ways to do this, such as using rankmirrors and other programs alike. I personally like using Reflector as it is about as easy as can be.

sudo pacman -S reflector

sudo reflector -l 5 --sort rate --save /etc/pacman.d/mirrorlist

sudo pacman -Syy
( will force a fresh copy of the package list from the mirrors )

The above command, will grab the 5 fastest mirrors ( you can change it to however many you want though, but rarely will you need more than 5 at any given time ), and then save them to your mirrorlist.

Comments (12)

Very nice guide indeed! Not only do I love the screenshots, but I love how they're in spoiler tags so my little lappy handles the page better.

Still haven't had the time to give Arch a good swing and I'll likely reference this when I do
Sorry for the messed up thumbnails atm, the issue is being looked at already for thumbnails in articles and the market place.
Updated for the newer non-AIF install media.
Very good. Other then needing an internet connection (which isn't a problem most of the time) it does look alot simpler then the aif.
Netinstalls are usually better in most cases anyways

Albeit not always right for certain situations, but whenever possible, it is recommended.
You need to do a %s/ect/etc/g as there's a few occastions when you point towards the ect directory instead etc.

Aside that, good work.
Yeah I figured I would make a few mistakes like that, lol. Why do I always come up with the brilliant idea to do these things at 3 in the morning ( I think I wrote the original about the same time too, lol ).

Also you can always edit it if you find things like that

I'm sure there's things you could contribute to it
Perhaps with the introduction of systemd the guide could be updated to have a decision between rc and systemd for daemons and such.
I thought about it but I kind of rewrote this guide randomly at 3-4am ( my update post above says 3:40 on the time stamp, lol ). And I'm going to be busy for the next 2 weeks or so and won't have much time to write it up real quick. I went ahead and gave a few more people access to edit it, so if you want to you can add to it if you want

Else it'll have to wait till I get back.
Great guide, however you should remove unetbootin as an example for writing the image to a usb as the arch wiki says not to.
https://wiki.archlinux.org/index.php/USB_Installation_Media#Linux_Live_USB_Creator
Added a blurb about current grub package issues and the workaround for them.
Overclock.net › How To's › How To Install Archlinux The Easy Quick And Dirt Way