# **Arch Linux** ![](https://i.imgur.com/TAUkHtU.png) ## **What is Arch Linux?** >Arch Linux is a wonderful, lightweight and flexible Linux distribution that has one purpose, to "keep it simple". --- ### **In this guide we're going to install and configure Arch Linux on a virtual machine.** --- ## **Pre-Instalation** To install Arch Linux, first off all we need to download Arch's Live CD from https://www.archlinux.org/download/. ![](https://i.imgur.com/RPaMJmJ.png) A live CD is an OS install cd, capable of running the OS on the computer without having to be installed and hard drive storage space is not required. * ### **Step 1** After setting up our virtual machine and booting up our Arch iso, we need to change our keyboard layout, because Arch by default loads the en_us layout. (In this guide, a pt-pt keyboard is being used). So we're going to run the following command: ``` loadkeys /usr/share/kbd/keymaps/i386/qwerty/pt-latin1 ``` ![](https://i.imgur.com/VHyLxMb.png) --- * ### **Step 2** Now we need to make sure that we have a working internet connection, because Arch will need one to download the packages for the instalation. To test our connection, we're going to ping a website (I chose www.atec.pt) ``` ping www.atec.pt ``` ![](https://i.imgur.com/rGdM4an.png) --- * ### **Step 3** Now we're going to set up our partition table for Arch. We're going to use *cfdisk* because it's one of the most user friendly partition tools. ``` cfdisk ``` In this virtual machine we're going to handle 100GB of hard disk. Now since this virtual machine has 8GB of RAM, we're going to create a 16GB swap partition, since it's recomended to create one with the double of your RAM size. Then we'll create a partition with the rest of our disk space, which will be 84GB. This will be the partition where Arch is going to be installed on, so we're also going to mark a *bootable* flag on this partition. Our partition table should look like this: ![](https://i.imgur.com/ZXnAvVb.png) Now after writing the partition table, we need to work on our created partitions. To configure our swap partition we need to run the following commands: ``` mkswap /dev/sda1 swapon /dev/sda1 ``` ![](https://i.imgur.com/tIE7Pwb.png) Next, we nedd to format and mount our main Arch partition, to do so we'll run the following commands: ``` mkfs.ext4 /dev/sda2 mount /dev/sda2 /mnt ``` ![](https://i.imgur.com/6WlBIX6.png) ![](https://i.imgur.com/BU6RT4H.png) --- * ### **Step 4** Now we're going to edit our mirror list, so that Arch will download from a nearby server instead of it's default download location. (This is not a mandatory step). To do so we need to change the /etc/pacman.d/mirrorlist file, and write the mirrors that are closest to us, they can be obtained through https://www.archlinux.org/mirrorlist/. ``` nano /etc/pacman.d/mirrorlist ``` ![](https://i.imgur.com/qYRam2R.png) --- * ### **Step 5** To start the instalation itself we need to run ``` pacstrap -i /mnt base ``` ![](https://i.imgur.com/MWUHGpj.png) This will download and install the basic Arch Linux files into our hard drive. --- * ### **Step 6** Now we're going to download our bootloader. We´re going to use GRUB. To download it, we'll input the following commannd ``` pacstrap /mnt grub-bios ``` ![](https://i.imgur.com/DMQAFdY.png) --- * ### **Step 7** Now we're going to create a file that allows Arch to recoginize the partitions. ``` genfstab -p /mnt >> /mnt/etc/fstab ``` ![](https://i.imgur.com/k3gH1rg.png) --- * ### **Step 8** Now we are going to start to configure our new installed system. To do so we'll input: ``` arch-chroot /mnt /bin/bash ``` First we'll change the *locale* file, to set our system's location ``` nano /etc/locale.gen ``` ![](https://i.imgur.com/kqoh3g4.png) Then we'll run the following command to generate a file based on locale.gen ``` locale-gen ``` ![](https://i.imgur.com/J1tr9e8.png) To set our system language, we'll input ``` echo LANG=pt_PT.UTF-8 > /etc/locale.conf ``` To finish our location settings, we'll input ``` export LANG=pt_PT.UTF-8 ``` To change the keyboard layout, we need to modify the *vconsole.conf* file. So for that, we'll input ``` nano /etc/vconsole.conf ``` ![](https://i.imgur.com/ZyuKSqF.png) --- * ### **Step 9** Now we're going to set our system timezone. First we need to remove the current localtime file ``` rm -rf /etc/localtime ``` After that, we'll execute ``` ln -s /usr/share/zoneinfo/Europe/Lisbon /etc/localtime ``` ![](https://i.imgur.com/YmHLjtc.png) Now we need to set our hardware clock to UTC, because Arch recommends to do so. To do that, we'll type ``` hwclock --systohc --utc ``` ![](https://i.imgur.com/IxshO7u.png) --- * ### **Step 10** Now we're going to give our machine a hostname. To do that, we'll input ``` echo archatec > /etc/hostname ``` Then we're going to modify the *hosts* file to add our hostname ``` nano /etc/hosts ``` ![](https://i.imgur.com/h8jnnzC.png) ![](https://i.imgur.com/81pDK4i.png) --- * ### **Step 11** Now to be able to access the internet in our Arch Linux, we need to enable the DHCP service, which will grant our machine an IP address. To enable the service, we'll input ``` systemctl enable dhcpcd.service ``` ![](https://i.imgur.com/e0pKJNK.png) --- * ### **Step 12** Now we're going to change our root password. To do so, we'll input ``` passwd root ``` ![](https://i.imgur.com/4mAwsCS.png) Then we'll add an additional user and change its password ``` useradd -m -g users -G wheel -s /bin/bash rodrigo passwd rodrigo ``` ![](https://i.imgur.com/KtVqfb9.png) ![](https://i.imgur.com/WOBtRA0.png) --- * ### **Step 13** Now we're going to install and configure our GRUB bootloader, that we've downloaded on Step 6. We'll type the following command ``` grub-install /dev/sda ``` Then to make the configuration file, we'll input ``` grub-mkconfig -o /boot/grub/grub.cfg ``` To finish our system configuration, we'll run mkinitcpio, that will create an initial ramdisk environment to load kernel modules and create a basic setup of the system before handing over control to init. So, we'll input ``` mkinitcpio -p linux ``` After that, we'll reboot the system and log in as *root*. ![](https://i.imgur.com/K0mtWDo.png) ![](https://i.imgur.com/5JA4KWE.png) ![](https://i.imgur.com/L1327Ei.png) --- * ### **Step 14** Now that we're inside our fresh installed system, first we're going to update it ``` pacman -Syu ``` ![](https://i.imgur.com/HQ7Cjly.png) * ### **Step 15** Now that we have our Arch Linux installed and updated, it's time to make it more user friendly. To do that we're going to install a window manager (Xorg) and a graphical user interface (GUI), that for this example will be GNOME. First, to install Xorg, we'll input ``` pacman -Sy xorg xterm xorg-twm xorg-xinit ``` ![](https://i.imgur.com/gJ14xmi.png) Then to install GNOME, we'll input ``` pacman -Sy gnome gnome-extra gnome-tweak-tool ``` ![](https://i.imgur.com/waSmnam.png) To end this guide we need to enable the GDM service, that is used for enabling the graphical login interface. To enable it, we'll type ``` systemctl enable gdm.service ``` ![](https://i.imgur.com/o4cJCNc.png) Now we'll reboot the machine, and after logging in with our user, we'll customize Arch as we please. At the end of this guide, we should be seeing something like this ![](https://i.imgur.com/n3azeOX.png) --- **Sources:** * https://wiki.archlinux.org/index.php/Installation_guide * http://www.wikihow.com/Install-Arch-Linux * https://www.youtube.com/watch?v=Nojq2Ihy_3s Made by: Rodrigo Oliveira TIIGR0916B