Build A Killer Customised Arch Linux Installation


Don’t like Windows 8’s new interface? Think Mountain Lion is an uneasy adaptation of iOS? Sick of Ubuntu Unity and the new ads that come along with it? Maybe it’s time to create your ideal operating system with just the features you want. Arch Linux can make it happen, providing the foundation for your : it lets you build your own personal killer Linux distribution.

Title image remixed from somchaij (Shutterstock)

We covered how to build an Arch distribution back in 2010, but the process has changed a lot recently. Here’s why you may want to use Arch Linux, followed by how to set it up.

Who Is Arch Linux Good For?

One of the key reasons for Linux’s popularity is that you have a lot more power to tweak the operating system to your liking. Doing that also gives you the opportunity to learn more about the way computers and operating systems work. While Ubuntu certainly offers that opportunity and is the best-known distribution, some Linux users may be itching to try something new. Arch Linux is a great distribution for intermediate users looking to dig further into Linux learn to roll a own fast, stable, super-personalised distro.

It’s important to emphasise the “intermediate” part. Arch Linux is not for Linux beginners; there’s a lot of manual configuration and command line work involved that Linux rookies won’t be comfortable with. If you are a rookie, you won’t want to start here. Check out our guide to getting started with Linux first. If you’re familiar with Ubuntu (or other distributions) and are comfortable with the basic command line work and editing configuration files, read on; Arch Linux is a great next step.

This guide has two parts. The first half describes the philosophy behind Arch Linux and its benefits as a distro, while the second part is a (very simplified) guide to setting up your first Arch install. I won’t go through some of the more basic explanations and will assume you already know how to burn an ISO image to CD, understand the difference between 32- and 64-bit operating systems, and so on.

This guide only covers Arch Linux basics. I highly recommend the Arch Linux Wiki, especially the Beginner’s Guide, before you actually begin. The forums are also a great source of information, so check them out as well. The Beginner’s Guide can be a bit overwhelming, since it incorporates so many different possibilities that many first-timers won’t deal with, so I’ve created this guide to inspire you and help show that setting up Arch Linux isn’t as nerve-racking as it may seem.

Why Arch Linux?

As Arch is definitely not for Linux beginners, you may be wondering what its advantages are. Arch is popular with developers, tweakers and geeks who like to really get at the nuts and bolts of a system. If you’ve used Linux for a while and you’d love to dive a little deeper and learn about how it works and how you can configure it to better fit your needs, Arch is the perfect next step in your journey.

The philosophy behind Arch is known as The Arch Way. Arch aims to be an efficient, user-centric, open, elegantly coded distribution that doesn’t sacrifice anything for convenience. When faced with a choice between more efficient code and a simpler experience for the average computer user, Arch will always choose the former.

While this may seem like a strange approach, it’s actually one of Arch’s biggest advantages. Instead of configuring the distribution to be idiot-proof, Arch forces you (politely) to learn what each configuration file and important terminal command does early on. That way, when something breaks or when you want to configure something beyond what KDE or GNOME has options for, you should already know where to go and what to do.

Note that I’m not trying to say that idiot-proofing is a bad thing. In fact, being simple to use is one of the best characteristics a modern OS can offer for the average PC user. Once again, this guide is not for those people. This is for those of us who love tinkering with our operating system at a fundamental level.

Why You May Want to Switch

If you’re already a Linux user, chances are you’re relatively happy with the options your chosen distro provides. Here’s what Arch offers that makes it worth trying.

You’ll Know What’s Going on Behind the Scenes


For the record, I like Ubuntu. It’s easy to install, works out of the box on tons of hardware, and has made some interesting innovations on the desktop. I’ve used it to repurpose some old PCs for my mother around the house and it’s easy enough for even non-geeks to handle. If you use Linux solely because it’s free, open and easy to use, you don’t need to complicate your life for no reason.

While Ubuntu works out of the box with a lot of computers, and provides user-friendly configuration for many elements, it’s a nightmare to configure for others. It provides no way of teaching you where the correct config files are for your eighty-button mouse or your three-monitor setup. And fixing that isn’t easy: I hate to say it, but in my experience the Ubuntu forums have been less than helpful dealing with those issues.

Arch’s installation doesn’t really have a graphical interface. It’s mostly done through the command line, and consists of you using a guide like this (and the fabulous Arch Wiki) to partition your drive, install a minimal base system, and go through each command and configuration file to get things set up. As a result, you’ll know how the base system works. Down the road, when you want to automatically mount another hard drive when Arch boots, you’ll know you need to add something to the options column of /etc/fstab, and you won’t be intimidated by that fact. When you don’t know what to do, Arch has one of the best documentation collections and communities I’ve ever seen.

You’ll Always Have The Newest Software


Unlike other popular operating systems, Arch doesn’t have a big update on a fixed schedule every few months. Arch updates whenever the community wants, which means you’re constantly on the bleeding edge.

Note that in this instance, “bleeding edge” does not mean “ridiculously unstable”. Lots of testing goes into these packages before they get added to the repositories, and you aren’t going to find your PC crashing every day because you’re always getting the newest updates. What it really means is that you’ll get software updates as soon as they’re ready to use, not as soon as Ubuntu gets around to updating its repositories. If Thunderbird releases an update, you’ll get that update the next day — not the next month.

You Build A Personalised Operating System


Since you start off with a minimal install and build up from there, you won’t have any unnecessary packages bloating your system. You have complete control over everything that goes into your setup, and you can make it as minimal or as powerful as you want. With Arch, you build your own, fast, stable, super-customised Linux distro from the ground up. And who wouldn’t love that?

How to Install Arch Linux

If all this sounds like your dream come true, then it’s time to move on to the next step: actually installing Arch. While the Arch Wiki has a great Beginner’s Guide (have I mentioned that you should read it?), I found I still ran into a few hiccups along the way, and the wiki is so full of information that it can be overwhelming for an Arch first-timer. For example, the beginner’s guide goes through lots of different possible networking situations (using a static IP, setting up wireless internet from the get-go). I’ve created this guide to help you get up and running without your brain exploding.

This guide contains the methods I found work best and were easiest for me, and they should work with most PC builds without a problem. If you do run into any problems, or have any specific needs that aren’t fulfilled by this guide, you can generally find more detail in the corresponding section of Arch’s Beginner’s Guide, so head over there when necessary.

Step One: Get Yourself An Arch Linux Install CD

You can install Arch using many different methods, but we’re going to use a basic CD installation. If you don’t have an optical drive, you can install from a USB flash drive. Head to the Arch download page, download the Arch Linux ISO, and burn it to your installation medium of choice before you continue.

Step Two: Set Up Your Partitions

While you can partition your drive from the Arch Linux installation CD, it’s much easier to do so from a Linux Live CD such as Ubuntu or GParted, which you should already have (because you’re no Linux slouch!). Assuming you already know how to partition drives, go ahead and make one for your OS (around 15GB is safe) and one for all your documents and apps (which can be as big as you want). If you use an SSD, you can make one partition on the SSD for your boot drive and one on a bigger HDD for your files. You can also create a 1GB swap partition for good measure, but if you have a lot of RAM, this arguably isn’t necessary.

Format the partitions as ext4. Note the names of the two you’ll be using (such as /dev/sda1 as the OS partition and /dev/sda2 as your data partition), as that’s how you’ll have to refer to the partitions during the install process.

Once you’ve created your partitions, boot up from your newly-burned Arch Installation CD and choose “Start Arch Linux” at the prompt. Make sure you choose the right architecture for your CPU (32-bit or i686 versus 64-bit or x86-64). When it finishes booting, you’ll get a command line prompt.

You should also create a locale.conf file with the following command (for English-speaking US users):

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

If you speak another language, tweak this command accordingly.

Time Zone and Clock: Next, we’ll set our time zone. To view the available zones, run the following command:

ls /usr/share/zoneinfo

You can view sub-zones by picking a category and running:

ls /usr/share/zoneinfo/Australia

Find the zone you want, then run the following command, replacing America/Los_Angeles with your time zone:

ln -s /usr/share/zoneinfo/America/Los_Angeles /etc/localtime

Then, set the clock according to your chosen zone with:

hwclock --systohc --utc

Step Four: Set Up Your Network

At this point, you have network access from the live CD, but you’ll need to set up your network for the actual Arch installation.

If you have a wired connection with a dynamic IP address, all you need to do is enable the wired networking service on your new setup. To enable a background service, you’ll need to use the systemctl command. In this case, run:

systemctl enable [email protected]

If you connect using Wi-Fi, you’ll need to install a few packages first. To start, install Arch’s wireless tools with:

pacman -S wireless_tools wpa_supplicant wpa_actiond dialog

Then, run the following to connect to your network:

wifi-menu

This will create a profile in /etc/network.d named after your network. Lastly, enable the wireless service with systemctl:

systemctl enable net-auto-wireless.service

Now, your network should be all set up and ready to go when you finish installing Arch.

Step Five: Configure Your Package Manager

Arch Linux uses a package manager called Pacman, and it’s pretty darn awesome. Before you can use it in your new installation, you’ll need to set up a few things. Start by editing its configuration file with:

nano /etc/pacman.conf

Scroll down to the “Repositories” section. The [core], [extra] and [community] repositories should already be uncommented, but if you’re on a 64-bit machine, you should also enable the [multilib] repository, which lets you install both 64- and 32-bit programs. To do so, add the following lines to the bottom of the config file:

[multilib]
Include = /etc/pacman.d/mirrorlist

If you’re on a 32-bit system, you shouldn’t need to edit anything in here right now, but it’s a good idea to take a look around, since this is where you’ll add any extra repositories in the future. When you’re done, go ahead and exit, saving any changes you might have made.

When you’re done, run the following command to refresh your repository list (if you made any changes):

pacman -Sy

We’ll talk more about how to use Pacman shortly. For now, head to the next step.

Step Six: Create A User Account

Now it’s time for a few finishing touches before we actually boot into our Arch system. First, set the root password by running:

passwd

Type in your desired password when prompted. As an intermediate Linux user, you already know you don’t want to use the root account for regular computing, since that can be dangerous. So create a user account (and a password) for yourself by running:

useradd -m -g users -G wheel,storage,power -s /bin/bash johndoe
passwd johndoe

Of course, replace johndoe with your desired username. The string of comma-separated terms contains the groups to which your user belongs. The ones listed should be fine, though they aren’t the only ones available. If you have a floppy drive or scanner, for example, you’ll want to add floppy and/or scanner to the list. For a full list, check out the Groups wiki entry.

Now would be a good time to install sudo, so your new user can perform administrative tasks. To do this, use the aforementioned Pacman package manager:

pacman -S sudo

That’s how easy adding a package is in Pacman. If you wanted to see a list of packages pertaining to a search term, you could type:

pacman -Ss sudo

This would search the repositories for “sudo”, returning to you a list of packages containing that name. Of course, you could also search the database on Arch Linux’s web site.

Once you’ve installed sudo, you can allow your new user to run it by editing your sudoers file:

EDITOR=nano visudo

Scroll down until you find this line and uncomment it:

%wheel ALL=(ALL) ALL

Save the document and exit the editor. This tweak will allow all members of the wheel group — to which your new user belongs — to use sudo, which will be handy when you finally boot into our new OS.

Step 7: Install Your Bootloader

Next, you’ll need to install a bootloader that can boot you into your Arch installation. For this guide, we’ll be using the ever-popular GRUB, though you can choose something else if you desire. If you’re installing Arch on a UEFI-based motherboard (instead of a BIOS-based motherboard) or if you’re dual-booting, you may want to do some extra reading before continuing.

To install GRUB, run the following commands, replacing /dev/sda with the drive (not the partition /dev/sda1) that holds your Arch Linux installation:

pacman -S grub-bios
grub-install --target=i386-pc --recheck /dev/sda
cp /usr/share/locale/en\@quot/LC_MESSAGES/grub.mo /boot/grub/locale/en.mo

If you’re dual booting, run the following:

pacman -S os-prober

Then, whether you’re dual-booting or not, run:

grub-mkconfig -o /boot/grub/grub.cfg

This will create a config file for your bootloader (which you can edit if you want different options when booting into Arch or another OS).

Lastly, exit from chroot, unmount your partitions, and reboot your computer:

exit
umount /mnt/home
umount /mnt
reboot

If you mounted other partitions at any point, include them in the commands above. You should also remove your Arch Linux Installation CD at this time.

Step Eight: Get Your Desktop Up And Running

When you reboot, you should find yourself at a simple login prompt, as you did at the beginning. However, this time, you’re actually logging into your new Arch installation! You now have a very basic system from which you can build up a working desktop with sound, video and more.

First, let’s get sound working. To do this, you need to install alsa-utils with the following command:

sudo pacman -S alsa-utils

Then, start up alsamixer:

alsamixer

All your channels will start muted, so use the M key to unmute the channels you need. Then, use the arrow keys to turn them up or down. You’ll definitely want to unmute the Master channel, and the PCM channel if you have one. Depending on your speaker setup, you may also need to unmute others such as Front Speaker or Headphone. Raise their volume up until “dB gain” equals “0” for each. This will ensure that you don’t get any sound distortion. Press ESC when you’re done.

To check your speakers are working, run:

speaker-test -c 2

Change 2 to the number of speakers you have (for example, 8 if you have a 7.1 surround system). If you hear the static it generates, you’ve got working audio! If not, head back to alsamixer and try tweaking your channels to make sure everything’s properly unmuted. To stop the speaker test, press Ctrl-C.

Next, it’s time to get some graphics happening. First, we’ll install the X window system with:

sudo pacman -S xorg-server xorg-xinit xorg-server-utils

If you want 3D support, you’ll also want to install mesa:

sudo pacman -S mesa

Next is what I normally find the most troublesome part of a Linux installation: video drivers and configuring X. The video driver you need will depend on your graphics card and what you want to get from it, so see the corresponding entry in the Beginner’s guide for more information. You’ll use Pacman to install those drivers. For example, if I wanted to install the proprietary NVIDIA drivers on a 64-bit system, I’d run:

sudo pacman -S nvidia lib32-nvidia-utils

Again, your commands will differ. Do some research to find out which drivers you need.

Most desktop computers should be able to use their mouse and keyboard out of the box. If you’re on a laptop, though, you should install some drivers for your trackpad:

sudo pacman -S xf86-input-synaptics

We’re in the home stretch. Now it’s time to see if you can get a graphical environment up and running. First, install the default environment:

pacman -S xorg-twm xorg-xclock xterm

Then, to test X, run:

startx

If it works, you should be able to interact with a very basic windowed environment and run commands in xterm. You can exit by typing exit into xterm and hitting Enter.

It was at this stage I discovered I had used the wrong video drivers the first time around, so I had to uninstall the old ones and reinstall a different package. To remove a package in Pacman, type:

pacman -Rns package_name

The n flag removes all the configuration files related to a package, while the s flag removes any dependencies that are now unnecessary. I generally always use n and s when removing a package, because I like to keep my system clear of cruft.

If you’re having trouble with your video drivers and testing X, there’s more information on troubleshooting it in the Beginner’s Guide.

Stay with us, we’re at the last step! All that’s left is to install your desktop environment of choice. First, install a few fonts:

sudo pacman -S ttf-dejavu

Then, pick your favourite desktop environment and install it (you can see lots of good choices here). Your commands will differ depending on what you choose, but it should be simple. For example, to install a GNOME desktop, you’d run:

sudo pacman -S gnome

This could take a while, depending on the kind of environment you want. Once it’s finished , you can turn on a display manager to give yourself a graphical login to your new desktop. GNOME comes with the gdm display manager, so to enable its service (remember those?) we just need to run:

sudo systemctl enable gdm.service

Now, reboot your system with sudo reboot and you should find yourself inside a new desktop on your new Arch system! Hooray!

Going Further

Congratulations on setting up your first Arch desktop. There’s a lot more to learn, but that’s where this guide ends. Here are some resources for expanding your knowledge:

  • How to Use Pacman: You already know how to install a package with Pacman. This guide will show you how to remove packages, update your repositories, and update your system with the newest versions of all your apps.
  • Install Other Apps With The Arch User Repository: One of my favourite parts of Arch is the Arch User Repository, or AUR. This is a special repository that combines apps that aren’t in the official repositories, managed by Arch’s user base. It contains every Linux app you could possibly imagine. Read up on the AUR and install AUR helper like Yaourt or Packer — they’ll help you install apps from the AUR as easily as you install apps with Pacman. Seriously, do this.
  • Install Browser Plug-Ins: You’ll probably want (however begrudgingly) to install Adobe Flash, and this wiki page will help you do so.
  • Use the Forums: They’ll be your greatest source of help. Of course, make sure you Google and search the forums before you go and start asking questions.
  • Compiz: Because who doesn’t like cool desktop effects? Alternatively, KDE users can also use the built-in Kwin just by going to System Settings.
  • Our Lifehacker Pack for Linux and our Linux App Directory: For finding all the best apps to get your new system started.

The Cheapest NBN 50 Plans

Here are the cheapest plans available for Australia’s most popular NBN speed tier.

At Lifehacker, we independently select and write about stuff we love and think you'll like too. We have affiliate and advertising partnerships, which means we may collect a share of sales or other compensation from the links on this page. BTW – prices are accurate and items in stock at the time of posting.

Comments


17 responses to “Build A Killer Customised Arch Linux Installation”

Leave a Reply