Software & Apps Linux How to Install Arch Linux Use updated, cutting-edge software and packages with this rolling-release model Share Pin Email Print Linux Switching from Windows By Jack Wallen Writer Jack Wallen is a former Lifewire writer, an award-winning writer for TechRepublic and Linux.com, and the voice of The Android Expert. our editorial process LinkedIn Jack Wallen Updated February 13, 2020 Arch Linux is a powerhouse Linux distribution that offers a rolling release, so all of your software is always up to date. But with that power comes a bit of operating system installation complexity. In other words, installing Arch Linux isn’t easy … but not impossible. Here you will learn how to install Arch Linux as a virtual machine (using VirtualBox). The process is the same if you’re installing on bare metal (the only difference being the need to create a bootable media, such as a USB drive or CD/DVD for the bare metal installation). Taking your first steps using a virtual machine makes the process of learning a bit easier. This tutorial will not detail the steps for creating the VirtualBox virtual machine. To learn how that process is completed, read Run Ubuntu Within Windows Using VirtualBox. The steps for creating a virtual machine in VirtualBox are similar, regardless of hosting platform. Download the ISO The first thing you must do is download the latest Arch Linux ISO file. Point your browser to the Arch Linux Download page and download the latest image to your hard drive. With that ISO image, you’ll create your virtual machine in the standard fashion. Once you’ve created the virtual machine, boot Arch Linux. You will eventually find yourself faced with a bash prompt (where you can begin running the necessary commands). Partition The Hard Drive The first thing to be done from the command prompt is partitioning the drive. Issue the command: fdisk /dev/sda Next, type n, and hit Enter. Now type p, and hit Enter. You will then want to keep the default partition number (1) by hitting Enter. Do the same when prompted to select the First sector and for the Last sector (just hit Enter). Finally, type w to write the changes to the disk. Formatting the Partition Now we have to format the newly created partition. To do this, issue the command: mkfs.ext4 /dev/sda1 Mount that newly formatted partition with the command: mount /dev/sda1 /mnt Installation And now we install base Arch Linux package. This will install the bare minimum needed to run the system (such as GNU BASH shell, data compression tool, file system utilities, C library, compression tools, Linux kernels and modules, library packages, system utilities, USB devices utilities, vi text editor, and more) and is accomplished with the command: pacstrap /mnt base base-devel Configuring the System Next, we need to configure the system. The first step in this process is to generate an /etc/fstab file, which defines how block device and remote file systems are mounted. Do this with the command: genfstab -U /mnt >> /mnt/etc/fstab Now we need to change the root directory for the currently running process with the command: arch-chroot /mnt Setting Timezone, Hardware Clock, and Locale We need to set both the timezone and the locale for the installation. This is done with the following commands: ln -sf /usr/share/<ZONEINFO>/<REGION>/<CITY> /etc/localtime Where ZONEINFO is the Country, REGION is the State, and CITY is the city. For example, if you are in Louisville, Kentucky, your command would be: ln -sf /usr/share/America/Kentucky/Louisville /etc/localtime Set the hardware clock with the command: hwclock --systohc --utc And now we set the locale, which defines the language and local settings. To do this, issue the command: vi /etc/locale.gen At this point, you are using the vi text editor, which is far from user-friendly. What you need to do is first hit the i key to enter insert mode. Next, scroll through and uncomment (remove the “#” symbol from the beginning of a line) the locale that suits your location/need. By default United States English is uncommented. If you are not located in America, you’ll want to comment that out and uncomment the best location. Once you’ve taken care of this change, hit the Escape key, followed by wq and Enter. This will save and close the file. Generate the necessary locale file with the commands: locale-genecho LANG=en_US.UTF-8 > /etc/locale.confexport LANG=en_US.UTF-8 Substitute your locale for en_US (if necessary). Set the Hostname and Install the Bootloader In order for your Arch Linux distribution to boot, you must install a bootloader. Before we do that, let’s set the hostname for the system (choose the hostname that suits your needs). The command for this is: echo HOSTNAME > /etc/hostname Where HOSTNAME is the name you’ve chosen. Install the bootloader with the following commands: pacman -Sy grubgrub-install /dev/sdagrub-mkconfig -o /boot/grub/grub.cfg Finally, set a root password with the command: passwd At this point, you have a base installation of Arch Linux. If you reboot the system, you’ll find yourself at a command prompt, where you can log in as the root user. Configure Networking Before continuing on, you’ll need to configure networking. If you attempt to ping something from the command line, it becomes all too clear that networking isn’t functioning yet. The first thing to be done is to find out the name of our networking device. That can be found with the command: ip link You’ll see a listing for lo (loopback) and one for a standard network interface. To configure the network interface, issue the command: vi /etc/systemd/network/DEVICE_NAME.network Where DEVICE_NAME is the name of your networking device. In this empty file, paste the following: [Match]name=en*[Network]DHCP=yes Save and close that file. Start and enable networking with the commands: systemctl restart systemd-networkdsystemctl enable systemd-networkd Next, create the necessary DNS entries with the command: vi /etc/resolv.conf In that file, add the following: nameserver 126.96.36.199nameserver 188.8.131.52 Save and close that file. Networking should now be functioning. Install a Desktop Environment Let’s install the GNOME desktop environment. To do this, issue the commands: pacman -S xorg xorg-serverpacman -S gnome gnome-extra During the above commands, hit Enter to select the defaults for all options. Finally, start and enable the display manager with the commands: systemctl enable gdm.servicesystemctl start gdm.service You should now be able to log into GNOME and enjoy your Arch Linux installation.