Arch Install Guide
Making a bootable Arch flash drive
Depending on your OS, it's a different process.
Regardless of your OS, first download the ISO image from archlinux.org. I recommend using the magnet link.
If you're on Windows, I recommend Rufus. Just set it to your flash drive and under Format Options > Create bootable disk using select ISO image and select the Arch ISO file.
If you're on Linux, just use dd
in this format
dd if=/path/to/file.iso of=/dev/sdx status="progess"Replace sdx with your drive letter. Find this using lsblk.
If you're on Mac, figure it out. (unetbootin, how-to)
The last part is booting from the flash drive. Look up how to do it on your computer (it's usually just holding F2, F12 or Del during boot)
Once you do that, you'll be greeted with a black terminal. Now it's time to prepare you computer for the installation.
Preparations
Before you begin:
- Make sure you have an Internet connection, preferably Ethernet.
- Check if you have BIOS or UEFI:
Ifls /sys/firmware/efi/efivars
doesn't return anything, then you have BIOS and you can follow the rest of this guide. - Run
timedatectl set-ntp true
to set the system clock.
Making the partitions
Partitioning, simply put, is making sections on your hard drive. Those sections are where certain parts of the OS are going to be installed.
Most commonly, you need 4 partitions for almost any OS:
- a
boot
partition - this holds all the necessary files for system boot. - a
swap
partition - this holds temporary memory for programs and makes reading that memory a lot faster. - a
root
partition - this holds all the programs and system files for Arch. - and a
home
partition (optionally) - this holds you personal files and data.
Now you need to make those partitions, and you do that with fdisk
.
fdisk
needs to be run with on a specific hard drive.
To find your hard drive, run lsblk
to see all the hard drives and their partitions. You should be able to able to find the hard drive based on the size of it.
Once you do, memorize the drive letter (should look like sdX, where X is a, b, c...)
Then run
fdisk /dev/sdX
fdisk
has a couple of options that you need.
- p - prints existing partitions
- d - deletes the selected partition
- n - makes a new partition
- w - writes the new partitions to disk
If you already have partitions of a previous system on the drive, remove them with the d
option. You have to go through every partition on the drive one-by-one. This will delete everything on those partitions.
Once you have a clean partition table, you can start making the new partitions.
The process of making a new partition is simple. The only part of the you have to pay attention to much space you give to the new partition.
The process is made up of choosing the partition type, partition number, its first sector and last sector (this is where you choose the size, essentially you choose the begging and the end of the partition).
You only need to adjust the Last Sector. Leave everything else to its default value.
As for the size, that's really up to personal preference. I'll give you some pointers and you shouldn't have any problems using the same sizes I use.
boot
- 200Mswap
- debated topic, you'll be fine with half of your RAM size.root
- really depends on how much programs you're going to have and drive size, somewhere between 20-50G is goodhome
- the rest, leave last sector empty
Now that every partition is made, use lsblk
to find their drive number.
For the rest of this tutorial, I'm going to assume you made the partitions in the order I did and that they have the same drive numbers (boot is 1, swap is 2...)
Making filesystems
Now that you have partitions, you need to put filesystems on them.
I'm going to put the ext4
filesystem on every partition except the swap partition.
This is done with
mkfs.ext4 /dev/sdX(1, 3, 4) (boot, root, home)
Do this for each partition and with the appropriate drive letter and number.
As for the swap
partition, it's a bit different.
mkswap /dev/sdX2 swapon /dev/sdX2
Now the swap
partition is made and mounted. Next we mount the rest of the partitions.
Mounting the filesystems
These partitions exist, but they aren't usable untill we mount them. Simply put, we're giving them a specific location on our computer to access them and install our system there.
We do this with mount
.
/mnt
is commonly the designated place to mount drives, so that's what we'll be using.
Imagine that /mnt
is the root folder of our system.
It only makes sense that we mount the root
partition here.
We do this with
mount /dev/sdX3 /mnt
Now the root
partition of our drive can be accessed through /mnt
.
As for the other partitions, we'll mount them where they will be on our system, so the boot
partition at /boot
and home
at /home
.
First we make those folder and then we mount the partitions there.
mkdir /mnt/boot mount /mnt/boot mkdir /mnt/home mount /mnt/home
Run lsblk
to check if you mounted everything correctly.
Installing Arch
Now that everything is mounted, you can install Arch on your new system with
pacstrap /mnt base
This will install only the base system on /mnt
.
Configuration
Generating fstab file
As you already saw, for you to access a drive or a partition on a drive, you first need to mount it. But, what mounts the system partitions, they need to be mounted automatically during boot to make your computer usable?
That's what the fstab file is for. It just a list of partitions that you want mounted automatically during startup.
For this, we're going to use genfstab
.
If you run
genfstab /mnt
it'll output all the the mounted partitions and their information.
This is just a preview. To output this to a file run
genfstab -U /mnt >> /mnt/etc/fstabThe
-U
part is to make sure it uses UUIDs instead of drive locations as identifiers, which is a way better system.
Output the fstab
file to make sure it worked with
cat /mnt/etc/fstab
Chroot into the new system
Now it's time to chroot (change root) into the new Arch system.
arch-chroot /mnt
Installing the boot loader (GRUB)
GRUB is the thing that loads the OS and all its components when you turn on your computer.
To install it, we're going to use pacman
, Arch's package manager.
pacman -S grubEnter 'Y' when it propts you to.
When it finishes installing the package, you now need to actually install the GRUB boot loader onto your drive.
grub-install --target=i386-pc /dev/sdXReplace X with your drive letter, not to the boot partition, the whole drive.
When that's done, all that's left is to make the default config file for GRUB.
grub-mkconfig -o /boot/grub/grub.cfg
Setting the locale
You need to set the locale. In this example in going to use the US English locale.
Go to /etc/locale.gen
and remove "#" from the locales you want to enable.
Then go to /etc/locale.conf
and add the line
LANG=en_US.UTF-8
or whatever your language is and run
locale-gen
Configuring Network Manager and finishing up
Network Manager is there to configure and make connections, but also connect to the Internet on startup.
pacman -S networkmanager systemctl enable NetworkManager #enables it to run on startup
Set the hostname with
echo hostname > /etc/hostname
And set the root password with
passwd
And you're done! All that's left to do is exit
the Arch environment and unmount all the /mnt
partitions with
umount -R /mnt
Now just reboot
and unplug your flash drive.
If all went well, you should boot into your fresh Arch install.
original upload date: Wed, 02 Jan 2019 23:09[last edited: Wed, 02 Jan 2019 23:09]
tags: