Your message has been sent.
This article has been saved to your account.
Go to my account
This article has been emailed to your Kindle.
Send this article
Arch Linux is a very flexible distribution and this article by Ike Devolder, author of Arch Linux Environment Setup How-to will guide you to the point where you can get a basic system in place. From there on you can go in any direction you want. A simple server, a full-blown desktop system with all the bells and whistles. In the end, Arch Linux is always what you make of it.
These days the installation of Arch Linux might look like a work of insanity, as there is no installer available in the official media, just a guideline to follow. The installation without an installer is as easy as it can be. For experienced users, installing without an installer is even more convenient. The newest ISOs require that you have your machine connected to the Internet, as there are no longer packages available on the installation media.
(For more resources related to this topic, see here.)
You can get the official ISO image file from https://www.archlinux.org/download/. On this page you will find a download link to the latest release. Depending on your preference, download the torrent file or the ISO image file immediately.
The following list describes the main tasks that we will perform in this recipe:
Preparing, booting, and setting keyboard layout: We are going to get the ISO file from the download page of the Arch Linux website and store it on the preferred media of our choice. At the time of writing this article, there is a dual ISO image file that contains both i686 and x86-64 architectures on one disk. Start your PC with your preferred installation media (CD or USB stick). On most PC systems, you can access the boot menu by pressing one of the function keys, usually between F8 and F12 depending on the motherboard manufacturer. On older machines where you do not yet have a boot menu, you might need to change the boot order in the BIOS where the CD-ROM (or DVD/Blu-ray) has to be chosen as the first device to try booting from. We'll also explain how to use a different keyboard layout than the default one in this recipe.
Creating, formatting, and mounting partitions: You can partition the disks the way you want using cfdisk (for MBR disk partitioning) or cgdisk (for GUID disk partitioning). After creating the partitions, we can choose to format our created partitions with specific filesystems. When all partitions are formatted, we need to mount the partitions. First we will mount the root partition to /mnt. The other partitions will be mounted later on after you have created the specific folders. We'll designate our device with /dev/sdX; in your case this can be /dev/sda, and so on.
Connecting to the Internet: To be able to continue installing the ISO you need to connect to the Internet, because there are no packages available for installation on the ISO. For a wireless network you will need to use netcfg. When connected to a wired network, just use dhcpcd or dhclient.
Installing the base system and boot loader: These days the base system gets installed by running a simple script pacstrap. Pacstrap takes multiple parameters, the target location, and the packages or groups you want to install. For people who want to develop on their machines, the best base install is adding base-devel to the default installation. For normal end users, just base will be sufficient to start.
Configuring the system: In this recipe, we'll describe the flow of what to do during the configuration.
How to do it...
The following steps will guide you in preparing, booting, and setting keyboard layout:
Once you have downloaded the ISO image file, you should also verify its integrity by downloading the sha1sums.txt file from the download page.
These days you can also check if the ISO is completely valid by verifying the signature of the ISO.
Verify the integrity by issuing the sha1sum -c sha1sums.txt command and you'll see whether your download was successful or not. Also check if the signature of the ISO is correct by running gpg -v archlinux-...iso.sig:
sha1sum -c sha1sums.txt gpg -v archlinux-2012-08-04-dual.iso.sig
The following screenshot shows the execution of this step:
As you can see in the previous screenshot, the ISO's checksum is ok and the signature is valid.
Now that we are sure our ISO is ok, we can burn this to a CD with our favorite burning program.
Insert the CD into the drive, or insert the USB stick into the USB port of your PC.
Enter the boot menu, or let your computer automatically boot from the inserted installation media.
If the previous steps are performed correctly, you will see the following screenshot:
Select the architecture you want and press Enter, and we'll be on our way.
Search the keyboard layout desired for your region. The available keyboard layouts can be found at /usr/share/kbd/keymaps/.
Set the desired keyboard layout with loadkeys keyboardlayout.
Now let's perform the following steps to create, format, and mount partitions:
Start cfdisk or cgdisk, having the first parameter as the device you want to partition:
cfdisk /dev/sdX cgdisk /dev/sdX
Create your partition scheme.
Store the partition scheme.
Use the mkfs command to create a filesystem on a specific partition:
mkfs -t vfat /dev/sdX mkfs.ext4 -L root /dev/sdX
Mount your root partition to /mnt:
mount /dev/sdX3 /mnt
Make directories under mount for your other partitions:
mkdir -p /mnt/boot
Mount the other partitions:
mount /dev/sdX1 /mnt/boot
The following steps are needed to connect to the Internet:
When we need a wireless network, create a netcfg profile and run netcfg mywireless.
Use dhclient or dhcpcd to get an IP address.
The following steps should be performed for installing the base system and boot loader:
Run pacstrap with the desired parameters:
pacstrap /mnt base base-devel
Install the desired boot loader: the best choice at this moment is Syslinux.
The final installation of the boot loader will be done in a chroot during the initial configuration.
We'll now list the steps to do during the configuration:
Generate fstab with genfstab:
genfstab -p /mnt >> /mnt/etc/fstab
Change the root into the system location:
Set your hostname in /etc/hostname.
Create /etc/localtime symlink.
Set your locale in /etc/locale.conf.
Uncomment the configured locale in /etc/locale.gen.
Generate your initial ramdisk:
mkinitcpio -p linux
Finish installation of your boot loader.
Set the root password with passwd.
Leave the chroot environment (exit).
How it works...
We downloaded the ISO image file via torrent, or via HTTP from the mirror sites listed on the download page. The sha1sum command lets us verify the integrity of the downloaded ISO. On top of the checksum, we can also check the integrity by verifying the signature available for the ISO. So now, we can rest assured that the downloaded file is the real one. The ISO contains a fully working operating system. It also contains all the necessary tools to perform system recovery and installation.
The keyboard configuration set with loadkeys will make sure that the key you press on your keyboard will be translated to the correct letter on your screen. Using a different keyboard layout from the one on your physical keyboard might be confusing.
We then created a partition scheme on the selected disk with the appropriate tool (cfdisk or cgdisk). Make Filesystem (mkfs) is a unified frontend to create a filesystem. Using it we created our filesystem layout manually under/mnt by creating our default partition layout in our root, and mounting the specific partitions accordingly.
You can make a connection with your wireless network (if needed), and then use dhcpcd or dhclient to obtain an IP address that enables you to access the Internet.
Pacstrap will run pacman with a modified root location to install the desired packages into the newly created system.
For example, installing Syslinux:
pacstrap /mnt syslinux
The specific configuration files will ensure we don't have to do all those steps over and over again on every boot.
This article explained the procedure to get Arch Linux installed on your system using the official installation media.
Resources for Article :
- Compression Formats in Linux Shell Script [Article]
- Making a Complete yet Small Linux Distribution [Article]
- Linux Shell Script: Tips and Tricks [Article]
eBook Price: $9.99
Book Price: $19.99
About the Author :
Ike Devolder started playing around with Linux in 1999 and became a full-time Linux user in 2002. At that time his preferred distribution was Slackware, which he used for many years without complaints. In 2005 he rediscovered Arch Linux (he had already played around with it in the past) and started considering switching all his desktops from Slackware to Arch Linux. In 2006 it was done, with his laptop and desktop both running smoothly on Arch Linux, and since then he has gradually stopped being a distrohopper.
These days Ike is a Web Developer for Studio Emma in Belgium. He uses Arch Linux in his day job too.