Arch Linux Install Guide
The following steps are what I did to install Arch linux on my Asus laptop and many other devices. The Beginners Install Guide is much more in-depth and explains some other features like MBR installs, full and partial disk encryption, and the GRUB boot loader.
Installation:
Bootable Arch Media:
Grab the latest ISO from here. I always grab one from one of the US mirrors, but they have a Torrent file as well.
Now lets create the install media:
sudo dd bs=512 if=/location/of/your/iso_file of=/dev/sdx && sync
- This will take about 5 minutes to complete, but it will depend on the quality of the flash media.
Install Arch:
Boot to the USB drive, and select the first boot option.
After the OS environment boots, take a look at the connected devices and determine where you will be installing Arch. If you know how large your target drive is, determining which device to use should be fairly straight forward.
lsblk -afm
Network Setup:
If you are connect to your network via Ethernet, then downloading packages shouldn’t be a problem, but if you need to connect to a wifi network, here are the commands to get you going:
Run ip addr
to get the name of the wireless interface. It will be something like “wlp2s0”
# ip addr
Next, use the following command to list the available wifi networks:
# wifi-menu -o [wireless_nic_id]
# ip addr
You should now be connected
Update the System Clock:
Update the system clock to ensure that it is up-to-date:
# timedatectl set-ntp true
Partition Setup:
Recall the device name that you found from the lsblk command from earlier. We are now going to partition the hard drive to get it ready for the file system that we will be creating. I will be creating a GPT partition table with 2 partitions. One for boot drive that will be formatted with FAT32 for UEFI BIOS setup and another larger drive that will be formatted with ext4. The larger partition will be used to create 3 Logical volumes or LVMs. One for Root, one for swap, and the last for the home directory.
# parted /dev/sdx
(parted) mklabel gpt
(parted) mkpart ESP fat32 1MiB 512MiB
(parted) set 1 boot on
(parted) mkpart primary ext4 513MiB 100%
(parted) print
(parted) quit
LVM Setup:
Run the lsblk command again to see your newly created partitions, and take note of the drive lettering now that you have created two partitions.
Create the Physical Volume using the following command:
# pvcreate /dev/sdax
Note: Do not write over the boot partition by accident
Create the Volume Group with the following command:
# vgcreate <VolumeName_of_your_choice> /dev/sdax
Create the logical volumes that we mentioned earlier (root, swap, and home):
# lvcreate -L 30G examplevg -n rootlv
# lvcreate -L 4G examplevg -n swaplv
# lvcreate -l +100%FREE examplevg -n homelv
-
To rename an logicl volume use the following command
lvrename [volumegroup-name] [lvoldname] [lvnewname]
or
lvrename /path/to/vgroup-name/lvoldname /path/to/vgroup-name/lvnewname
If you want to display the different volumes that you just created:
# pvdisplay
# vgdisplay
# lvdisplay
Create the File System & Enable Swap:
Use lsblk again to see how the LVMs are named.
Now lets create the file system:
# mkfs.ext4 /dev/mapper/examplevg-rootlv
# mkfs.ext4 /dev/mapper/examplevg-homelv
# mkfs.fat -F32 /dev/sda1
# mkswap /dev/mapper/examplevg-swaplv
# swapon /dev/mapper/examplevg-swaplv
# mount /dev/mapper/examplevg-rootlv /mnt
# mkdir /mnt/boot
# mount /dev/sda1 /mnt/boot
# mkdir /mnt/home
# mount /dev/mapper/examplevg-homelv /mnt/home
Installation:
Edit the Mirror List:
The mirror list is how Arch knows where to look for packages and updates to install.
# vim /etc/pacman.d/mirrorlist
Uncomment (remove the #) from the lines relevant to our country.
If the mirrors are already uncommented, move the one(s) that
you want to use to the top of the list. You technically don't
have to edit anything if you don't want to.
Save the file and exit
Install the Base Packages:
Now we get to install the base system packages to the root filesystem that was created earlier:
# pacstrap -i /mnt base base-devel (Yes, there is a space between base and base-devel)
Press enter when prompted to install packages.
Configuring Arch:
Generate fstab
Generate the fstab (file system table) file. This is how Arch knows how to mount devices to your filesystem. The -U flag tells the command to UUIDs to identify partitions and devices.
# genfstab -U /mnt >> /mnt/etc/fstab
You can verify that the fstab file was generated by viewing the following file:
# vim /mnt/etc/fstab
Change to root of your Arch install:
# arch-chroot /mnt /bin/bash
Generating locale
Use the following command to append your locale to the end of the file */etc/locale.gen
# echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen
This will tell your system which language it should use among other things.
Now generate the locale
# locale-gen
Now create the locale.conf file in /ect
# echo LANG=en_US.UTF-8 > /etc/locale.conf
I didn’t use quotes this time because the line that I echoed into the file didn’t have any spaces for line breaks in it.
Time Zone:
Follow the prompts
# tzselect
Create the symbolic link to /etc/localtime
# ln -s /usr/share/zoneifo/America/New_York /etc/localtime
Set the time standard to UTC
# hwclock --systohc --utc
Initramfs
Make sure to edit /etc/mkinitcpio.conf with the following information before generate the Initial RAM File System. You can use nano or any other text terminal text editor that you prefer. I chose vim here because it is what I am use to.
# vim /etc/mkinitcpio.conf
Add find the line that starts with "HOOKS". It should be near the bottom.
Add "lvm2" right before the word "filesystem"
<esc> :x
Save the file and exit
Run the following command to build the initial RAM filesystem:
# mkinitcpio -p linux
or
# mkinitcpio -p linux-lts (You must download the lts kernel and lts-headers first)
Install the Boot Loader
UEFI/GPT
Install systemd-boot to the EFI system partition
# bootctl install
Create the boot entry
For LVM installations, create the following file:
# vim /boot/loader/entries/arch-lvm.conf
title <Your_Choice>
linux /vmlinuz-linux
initrd /initramfs-linux.img
options root=/dev/mapper/<VolumeGroup-RootLogicalVolume> rw
Save the file and exit. If you used the LTS linux image then replace vmlinuz-linux & initramfs-linux.img vmlinuz-linux-lts & initramfs-linux-lts.img. If anything goes wrong(at least in my experience) with the boot process, it will be in this file.
Other boot entry schemes can be found Here
Network Configuration
Wired (Ethernet)
# systemctl enable dhcpd@<interface_name>.service
Wireless
Install iw, wpa_supplicant, and dialog
# pacman -S iw wpa_supplicant dialog
If you setup the Wifi network with wifi-menu, repeat the same steps
Generate the Root Password
# passwd
Create your user
# useradd -m -g wheel -d /home/captam3rica -s /bin/bash -c "[Long Name Here]" [username]
# passwd [username]
(it is best to make this password something other than the root password)
# chage -d 0 [username] (This will force a password change upon first log
on)
Sudoers File
Edit the /etc/sudorers file so that you will be able to run commands as root to install packages and edit other files as necessary.
Find the line looks like this "# %wheel" and uncomment it.
After save the file, you will be able to use your user to perform commands as root.
Desktop Environment
Gnome3
I am installing Gnome3 as my desktop environment, but there are many others to choose from. I recommend playing around with a few until you find one that you like. Other Desktops
# pacman -S gnome gome-tweak-tool
Here are some extra packages that I like to install along with gnome3
- exfat-utils util-linux fuse-expat (for creating and mont exfat file system types)
- gedit (A really nice text editor)
- gnome-remote-desktop (I think it’s obvious)
- gnome-documents (Document and ebook reader for Gnome)
- aspell-en (Spell checker for LibreOffice)
- Chromium
- inkscape
- gimp
Enabe the gdm service
After the Gnome installation completes, enable the desktop manager service
# systemctl enable gdm
Start the NetworkManager service
Note: If you are already connected to Wi-Fi there is no need to use the ip
link
command below.
ip link set <your NIC> up
systemctl enable NetworkManager
systemctl start NetworkManager
Enabling these services will allow them to startup automatically each time you have to reboot or power off your system.
Final Steps
Exit from the chroot environment
# exit
Unmount the partitions
# umount -R /mnt
Reboot the system
# reboot
Once the system comes backup (as long as everything was configured correctly), you should boot to the Gnome3 login screen. Login with the user credentials that you created and enjoy!