How to Install Arch Linux

by gerald on May 25, 2013

arch linux

One of the main reasons why we use Linux is to have more control over our system. We want to be in charge of everything, making sure we only install the packages we want and customize the environment to our liking.

Ubuntu is a good choice for beginners starting with Linux, it gives you a whole range of built in packages that get you up and running. But after a while, you’d want more control. That’s where Arch Linux comes in. It is a Linux distro that lets you customize your system.

Note: Arch Linux is not for beginners, it does not come with an installer that can do everything for you. You should at least know basic commands in Linux before proceeding. My main reason for using Arch Linux was to learn more about Linux. If that’s also what you want, then Arch Linux is what you’re looking for.

So just a quick recap of what you’ll get with Arch:

  • You’ll learn more about how Linux systems work
  • You can build a customized Linux machine
  • You’ll have the latest software because of Arch’s rolling release

So if everything’s clear, let’s start installing Arch Linux!

1. Setting up your disk

The easiest way to setup your partitions is to boot from a Linux Live CD or flash drive and use GParted. If you still have your Ubuntu or other Linux distro on a flash drive or disk, you can just boot from there and run GParted, format the target drive as ext4. It would be best if you create two partitions, one for Arch Linux and the other one for your home folder. This makes your files easier to manage and to back up.

For this guide, we’ll assume you have the Arch Linux partition as /dev/sda1 and the home folder partition as /dev/sda2. You can always have them in a different disk, just take note of the partition name and adjust accordingly. If you don’t have a Linux distro to use for formatting the disk, you can also partition the disk while installing Arch, but note that you should be comfortable with using fdisk for doing this.

2. Running Arch Linux from bootable media

The next step is to download Arch Linux. Before downloading, you should decide which version you should download. To check if you have a 64-bit cpu, you can run grep flags /proc/cpuinfo  and if you see lm on the output, you have a 64-bit cpu. In choosing between 32-bit and 64-bit, the main thing to consider is your memory. If you have more than 4GB memory, you’ll need 64-bit operating system in order to address that memory. In general, using 64-bit OS will take up more memory in exchange for a boost in CPU performance. So it’s up to you.

Next, as usual will be downloading Arch Linux and setting up a bootable flash drive. We already assume you know how to do this. If not, a quick google search will help you. Now, it’s time to boot up Arch Linux. Select Boot Arch Linux and you will be given a command line to install Arch. Note that installing Arch will require internet connection. The easier way is to connect your machine via Ethernet because wireless adapters don’t work out of the box for Arch Linux and you can just install your wireless drivers afterwards. Try to ping google and see if internet connection works, if not you should check Arch Linux wiki for your network drivers.

Now, remember those partitions you have prepared a while ago, it’s time to mount them. You can check  the partitions using

and mount them

And you can now access your partitions under /mnt and /mnt/home.

If you’ve accidentally mounted different partitions, you can simply unmount the drives by entering:

and

3. Installing Arch Linux

Before installing, you should first select a mirror for downloading your packages. Simply enter

and select the server that is closest to you. Copy paste that to the top of the file. (alt +6 for copying, ctrl +u for pasting). Now, you can install Arch Linux. Simple enter

Remember that before you can run the install script, you should have already prepared your partitions, have internet connection, and have selected a mirror from the list. After installing, you just need to configure a few things.

FSTAB (File systems table)

FStab contains the list of drives and partitions you have in your system. You will usually have to add entries here when specifying internal drives that you want to use.  To create the Fstab file for your drive, just enter

You don’t have to enter anything right now, but if you’re adding drives in the future, this is where you should look.

Locale and time

We also have to configure the locale and time. In order to do this, we need to chroot into our newly installed Arch Linux. Chroot is the process used to login to a system without booting from the actual system. Just enter

and you’ll be given a terminal. First, we’ll need to configure the locale, just enter

and uncomment the correct locale by removing the # sign at the start of the line.

Next create a locale.conf in /etc.

Next, we should configure our time and zone. To check the list of zones, just run

pick a category and you can choose a subcategory, like

Then you can configure this as such

After setting your timezone, you can now set the clock by running

4. Setting up your network

If you’re using a dynamic ip address, you might have noticed that you need to run dhcpcd before you can obtain an ip address and access the internet. Having to enter this command all the time is a bit troublesome, what we need is a background service that will handle that for us. Systemd is a system and service manager for Linux systems and we can use this to enable dhcp. To do this, simple enter

where eth0 is usually the first Ethernet network interface, you can use commands like ifconfig to check yours.

If you’re planning to use your wireless card, you will need to install the following first

Then run

to connect to wireless networks. And also add it using systemctl

That’s it! Your network should be up and running.

5. Configuring your package manager

As you might have already noticed, we used pacman to install packages. Pacman is the package manager of Arch Linux. If you’ve used apt before, then you’d very comfortable with pacman. Pacman is very easy to use. Simple enter pacman Syu  for upgrading packages, pacman S  for downloading and installing specific packages from the repository, pacman Rns  for removing packages, and pacman U  for installing from a file. There a bunch of other flags but these are the ones you’ll work with most of the time.

But first, if you’re on 64-bit, we need to configure /etc/pacman.conf , just add this to the bottom of the file to enable you to install 64-bit programs.

By the way, pacman S  will get packages from the Arch User Repository (AUR). AUR is the community driven repository for Arch Linux. You will need to go to AUR for packages from time to time, you check check them out now.

6. Setting up your account

Up to now, you’re still using the root account, so let’s create a new user. First, you can set your root password using passwd.

Then add a user

Set his password

Now, we can give your user the ability to do admin tasks. Yep, you guessed it right, using sudo.

To install sudo, just run

After that, you should edit the sudoers file

Uncomment this line to allow all users belonging to group wheel to use sudo

7. Installing your bootloader

It’s time to install your bootloader, so that you can boot into your newly installed Arch Linux. Let’s install grub, the popular bootloader that’s the default in many linux distros.

Then run the following where /dev/sda is the drive that contains your partitions.

If you’re booting multiple operating systems, run

Finally, generate the grub config file

Now, it’s time to test your fresh Arch Linux system!

8. Setting up your sound

First, you probably want to install drivers for sound. Just run

And run

and you’ll get a nice looking screen for sound controls.

9. Setting up your desktop

Before setting up your desktop, it would be best to know more about how Linux desktop works.

This is the part that confuses most people. You might have heard terms like X, Xorg, Unity, Gnome, GDM and a whole lot more. If you’re confused what each one does exactly, do not worry, you’re not the only confused. So let’s clear up the confusion.

The first step to set up your Linux desktop is to install X. X is the window system that is used for many desktop environments. To install X, just run

If you want 3d support, just install

After installing X, we need to install the drivers for your video card. There are mainly 2 graphics card manufacturers, Nvidia and ATI. If you’re using recent video cards from Nvidia, you should have no problem at all. But for ATI and older cards, you might need a little bit more configuration. In choosing video drivers, there are generally 2 types of drivers, proprietary and open source. Proprietary drivers are often more stable and performance wise, the better of the two. You can get proprietary drivers from the manufacturer’s website (Nvidia or ATI). The open source driver however may support a wider range of hardware than the proprietary one. You can get them at community repositories. If you’re using a recent graphics card, it is usually better to use proprietary drivers.

So assuming your graphics card is not that old, we’re going to install proprietary drivers. For Nvidia cards, you can just run

Alternatively, you can go to the Nvidia website and download the latest drivers. For ATI cards, you can go to their website and download the latest drivers. If you’re having problems with the proprietary drivers, you should check out the supported graphics card list and search for alternative open source drivers. ATI cards for instance have the Radeon drivers, which supports more cards than the proprietary driver.

For trackpad support, if they’re still not working, run

Now, we can install the default environment for X

and run

x

Now you have a working environment, but let’s face it, it sucks, so let’s go ahead and install a desktop environment.

First, install some fonts

And we’re ready to install a desktop environment. But first, what’s a desktop environment?

Well, obviously, it is the environment you see on your desktop. It is the interface that sits between you and the operating system. There are a lot of desktop environments available, some of the common desktop environments are Unity, Gnome, Cinnamon, Mate, XFCE, etc. For this tutorial, we’ll use gnome. You can always try out other desktop environments later.

I personally like Cinnamon for everyday computing. It looks a lot like Windows and is very user friendly. For development purposes, I like XMonad, which is much like a window manager and can be very efficient for having lots of terminals and editors around.

Now, back  to gnome

Gnome also comes with a display manager, gdm. So what are display managers?

Display managers are basically login managers which give you a UI when logging into your linux machine. You might also have noticed that display managers give you the ability to choose which desktop environment to run by clicking that button beside your login name. This is very helpful when you want to have multiple desktop environments.

But you should know that display managers are not really necessary. It would still work if you don’t have display managers, you would just get login terminal. If you would like to start different environments, you can start them by modifying your ~/.xinitrc  file and indicating your preferred desktop environment.

But going back to gdm, to turn it on, simply run

Reboot, and there you go, your own customized Arch Linux machine!

That’s it for this tutorial! Did you find something wrong with this guide? Or do you have other comments or suggestions? Let me know through mail or simply leave a comment. Thanks!

What’s next? Check out Linux from Scratch!

{ 0 comments… add one now }

Leave a Comment

Previous post:

Next post: