February 2, 2017

Arch Linux: The Simple Linux

arch-linux.png

Arch Linux
The author's Arch Linux Xfce desktop.

Arch Linux is called the simple Linux because it eschews the layers of abstraction and "helper" apps that come with so many Linux distributions. It as close to vanilla Linux as a packaged distribution can get.

Consequently, you need to be more comfortable with do-it-yourself than with most modern distributions, and more comfortable with the command line and editing text files. I would rather take 10 seconds to edit a text configuration file than spend all kinds of time wading through graphical configuration menus. You know what would make me like graphical configurations more? Batch operations. Sometimes I like to change more than one thing at a time. No, really, it's true.

But I digress. Arch's being simpler means more work for you. Installation is a lengthy manual process, and you'll have a lot of post-installation chores such as creating a non-root user, setting up networking, configuring software repositories, configuring mountpoints, and installing whatever software you want. The main reason I see for using Arch is to have more control over your Linux system than other distros give you. You can use Arch for anything you want, just like any other Linux: server, laptop, desktop. I had Arch on an ancient Thinkpad that was left behind by modern Linux distributions.

Arch is a rolling release, so updating your installation regularly keeps it current. It has its own dependency-resolving package manager, pacman. Arch's standout features are the superb documentation, stellar maintenance, and stability.

Arch does not try to be all things to all users. The maintainers are phasing out the i686 version by November 2017 and supporting only x86_64, so anyone who needs a 32-bit Linux won't be able to use Arch. The installer doesn't include ready-made multimedia functionality, wireless drivers, Java, or Adobe Flash. These are all available post-installation. The Arch team does not support ARM devices, but the Arch Linux ARM project does.

Installation

The Arch installation image is a live bootable image. After you download it, refer to the installation page for complete instructions. Installing it to your hard disk is a manual process: you will manually partition your drive, install the base system, create /etc/fstab, set your locale and time zone, hostname, and configure networking.

When the live image starts, you'll be looking at a root Zsh prompt. If you have wired Ethernet, then you'll automatically have networking, with DHCP enabled. If you have a wireless networking interface, then you'll have to configure networking manually. Fortunately, Arch provides a thorough document on how to do this; hang on to the installation guide because it links to numerous howtos.

Press Shift+Page Up/Page Down to page up and down your console screen.

Partitioning is a bit of a bugaboo, so I'll walk through a simple partitioning scheme using gdisk. You may use fdisk for the old-fashioned MS-DOS partitioning, or the newfangled GUID Partition Table, GPT. I prefer GPT because you can have as many partitions as you want, numbered sequentially and are not limited to four primary partitions.

These commands create a new partition table on /dev/sda (be sure to use your own hard disk designation!), a 1MB BIOS boot partition that is required if you use the GRUB bootloader, a root partition, and a swap partition.

# gdisk /dev/sda
Command (? for help): o
This option deletes all partitions and creates a new protective MBR.
Proceed? (Y/N): y

Command (? for help): n
Partition number (1-128, default 1): 1
First sector (34-26580030, default = 2048) or {+-size KMGTP}: 2048
Last sector (2048-26580030, default = 26580030) or {+-size KMGTP}: +1M
Current type is 'Linux filesystem'
Hex code or GUID (L to show codes, Enter = 8300): ef02
Changed type of partition to 'BIOS boot partition'

Command (? for help): n
Partition number (2-128, default 2): 2
First sector (34-26580030, default = 4096) or {+-size KMGTP}: 4096
Last sector (4096-26580030, default = 26580030) or {+-size KMGTP}: +10G
Current type is 'Linux filesystem'                                                                         
Hex code or GUID (L to show codes, Enter = 8300):
Changed type of partition to 'Linux filesystem'

Command (? for help): n
Partition number (3-128, default 3): 3
First sector (34-26580030, default = 20975616) or {+-size KMGTP}:
Last sector (20975616-26580030, default = 26580030) or {+-size KMGTP}:
Hex code or GUID (L to show codes, Enter = 8300): 8200
Changed type of partition to 'Linux swap'

Command (? for help): w

Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!

Do you want to proceed? (Y/N): y
OK; writing new GUID partition table (GPT) to /dev/sda.
The operation has completed successfully.

Then you must create your filesystem. In my example only /dev/sda2 needs this, which I create with mkfs.ext4 /dev/sda2.

You do not mount the BIOS boot partition, but you need to mount your other filesystems. Check out the swap howto to set up your swap partition correctly.

Lean and Mean

If you followed all the steps correctly, you will reboot to a nice new Arch Linux system. If you didn't, then you will get an exercise in debugging.

Assuming your nice new Arch system boots, which it should, log in as root using the password you created during installation, and your reward is a plain shell prompt. I ran du -sh / on my test system to see how much disk space it used immediately after installation. It showed 1.1 GB. free revealed memory usage of 41K. Kilobytes, friends, remember what those are? Of course, the more additional software you install the more system resources it will use.

You should create at least one non-root user, especially if you will log in remotely to your Arch system or install a graphical desktop.

Building Your System

So, what the heck do you do now? Why, all sorts of things. You can install and run servers; it's a lean installation at 1.1 gigabytes so if you are cruft-averse, you won't have much to remove. You could install SSH for secure remote logins. You can install a graphical desktop. Let's take a quick look at pacman, the dependency-resolving package manager.

Search for packages to install:

$ pacman -Ss [name]

Install a package:

# pacman -S [packagename]

Update your repositories and upgrade the whole system:

# pacman -Syu

Remove a package and retain dependencies:

# pacman -R [packagename]

Remove a package and dependencies if they not required by other packages:

# pacman -Rs [packagename]

List files installed by package:

# pacman -Ql [packagename]

What package installed this file?

$ pacman -Qo /path/to/file

I like Arch as a nice clean distro that sometimes vexes me by making me do more work than I want to, that stays relatively free of cruft, and I especially like it for headless servers. Give it a try; see the installation page to get started, and see Installation steps for Arch Linux guests for instructions on running it in VirtualBox.

Learn more about Linux through the free "Introduction to Linux" course from The Linux Foundation and edX.

Click Here!