- Introduction
- Pre-Installation
- Installation
- System Configuration
- Final Steps
- Booting Up
- If You're Dropped into an Emergency Shell
- Logging In
- Connecting
- Desktop Environment
- Automating Boot Process
- Disk Format Guidelines
This guide will guide you through the process of installing Arch Linux from a live USB to another drive. For the purposes of this guide, the former will be /dev/live_usb
and the latter will be /dev/install
.
Before you start, I encourage you to read through the FAQ. It'll be helpful in this process. If you are unclear about anything, please visit the Arch Linux Wiki here.
Get yourself an iso image from the official download page. If you're a beginner, I recommend not getting the netboot image. Just get the regular iso.
- Find the section that is closest to you. For example, "United States".
- Select a mirror. I usually select one that ends with .edu.
- Select your desired download.
- From the mirror, download the sig file. It should look like this:
archlinux-version-x86_64.iso.sig
Make sure the .sig file is downloaded to the same folder that the iso file is. In a file tree, it would look like this:
Downloads
|- archlinux-version-x86_64.iso
|- archlinux-version-x86_64.iso.sig
Using a software like unetbootin or using the dd
command, flash the iso file to the disk. Here, I am going to use dd
.
sudo dd if=/PATH/archlinux-version-x86_64.iso of=/dev/live_usb bs=4M status=progress
Please replace PATH with the path to the folder in which the iso is stored.
This code will decompress the ISO file to the live USB and display its progress to you.
- Get out the drive to which you would like to install Arch Linux. Keep in mind that it can not be the one that you want to install from.
- Format the drive. Using a software on any computer (for macOS, Disk Utility, etc.), format the drive to which you would like to install to any format. Important information on formatting that you definitely should read
Using whatever method your computer uses to change boot devices, boot up the live USB.
You may see multiple error messages. These are likely worth ignoring, the live USB will still boot.
This is only necessary if you don't have a regular American keyboard. Or if you don't like the really ugly font. Couldn't blame you, it hurts my eyes to look at it.
- List the available key maps.
ls /usr/share/kbd/keymaps/**/*.map.gz
- Use
loadkeys
to load the map.
loadkeys de-latin1
- Change the font with
setfont
. The fonts are stored in/usr/share/kbd/consolefonts/
.
setfont 737-16
To make sure the computer is UEFI, we need to verify the boot mode.
If the following returns with 32
or 64
, you are in UEFI:
cat /sys/firmware/efi/fw_platform_size
In order to get our network interface, we need to use the following:
ip link
Look for something along the lines of wlan0
or eth0
, for Wi-Fi and Ethernet respectively.
Here, we will be connecting through Wi-Fi.
To connect to Wi-Fi, we should use the iwctl
command. Run the following commands:
iwctl device list
iwctl station INTERFACE scan
iwctl station INTERFACE get-networks
iwctl station INTERFACE connect SSID --passphrase=PASSWORD
Please replace INTERFACE with the device you find in iwctl device list
, SSID with the SSID of the network to which you want to connect, and PASSWORD with the passphrase of the Wi-Fi network.
Check your connection by running lynx
. If the page successfully loads, you are connected to Wi-Fi successfully.
If you are not located in the UTC time zone, then we need to change the system clock.
To check the system clock, run timedatectl
. If it's not right, do the following:
timedatectl list-timezones | less
timedatectl set-timezone REGION/CITY
It's time to partition the disk to which you want to install Arch Linux. Plug it in to the computer now.
Give it a few seconds to recognize the disk, then run:
lsblk
This will list all devices.
Please make sure you have the right device. Please do not write to the computer's internal hard drive unless you actually want to.
After you've got the right device, run:
fdisk /dev/install
Replace /dev/install
with the /dev path to your drive.
- In the
fdisk
shell, typed
and hit enter. This will delete any existing partitions. - Type
o
and hit enter. This will create an empty DOS MBR table. - Type
n
and hit enter. This will create a new partition. When prompted for the first sector, use the default value. When prompted for the last sector, type +600M. - Type
t
and hit enter. TypeL
to see a list of all partition types. Scroll through the list to find something like "Linux swap. There might be an alias present so you can just type
swap`. - Type
n
and hit enter. Go through the new partition process again. For the first and last sectors of this partition, please use the preset default values. - Type
t
and hit enter. In the list of partition types, find "Linux". - Type
p
and hit enter. This will display the partition table. Verify that it is how you want it. - Type
write
and hit enter. This will write the changes to the drive.
- In the
fdisk
shell, rund
to delete any existing partitions. - Run
g
. This will create an empty GUID Partition Table. - Run
n
. This will start the partitioning process. For the first sector, use the preset default value. For the last sector, use +400M if you're using one kernel (recommended) or +1G for multiple kernels. - Run
t
. Use the list to find "EFI System Partition" or "EFI System". There may be an alias present so you can useuefi
to change the partition type to ESP. - Create a new partition with a first sector of the default value and a last sector of +600M.
- Change the newest partition's type to "Linux swap" or "swap".
- Create a new partition with a first and last sector of the default values. This is the root partition.
- Change the root partition's type to "Linux x86-64 root".
- Run
write
to write the changes to the device.
From this point forward in the guide, the root partition will be expressed with /dev/root_partition
, the swap with /dev/swap
, and the ESP (EFI System Partition) with /dev/esp
. The device itself will still be referred to as /dev/install
.
Now that we have all of our partitions, they need to be formatted with a certain type of filesystem. I recommend using ext4
, but for the most part, you can use whatever one you want.
Now we will format the root partition.
mkfs.ext4 /dev/root_partition
Initialize the swap partition by running:
mkswap /dev/swap
Warning: Only do the following if you created the EFI System Partition during the partitioning step in this guide. Erasing an existing EFI System Partition could destroy important data.
Format the EFI System Partition by running:
mkfs.fat -F 32 /dev/esp
Now we need to mount the drive to which we want to install Arch Linux. Make sure you have the right drive before you start this step.
To mount the drive, run the following:
mount /dev/root_partition /mnt
Mount the EFI System Partition:
mount /dev/esp /mnt/boot
Enable the swap volume:
swapon /dev/swap
pacstrap
is a software made to install kernels and base packages from Arch Linux Live Media.
Use pacstrap
to install the essential packages to the root partition:
pacstrap -K /mnt base linux linux-firmware
This will install the packages base
, linux
, and linux-firmware
to /mnt
.
Please note that when you boot into installed Arch Linux, you will not have all of the packages or utilities that you have in the live USB. If you want to install additional packages to the drive, append their names to the command above. Some that I recommend getting are nano
, man
, wpa_supplicant
, dhcpcd
, netctl
, and other necessary networking utilities.
Now we need to generate the fstab
file. This determines how different devices should be mounted.
genfstab -U /mnt >> /mnt/etc/fstab
Now we will use chroot
to "enter" our disk to which we are installing.
To do this, run:
arch-chroot /mnt
To set the time zone, run the following:
ln -sf /usr/share/zoneinfo/REGION/CITY /etc/localtime
The REGION and CITY parts are the same as they would be when using timedatectl
.
Use hwclock
to generate our /etc/adjtime
:
hwclock --systohc
We now need to generate the locale. This guide assumes that your locale is en_US.UTF-8 UTF-8
, but you can change yours. Here is how you can change your locale.
If you used pacstrap
to install a text editor, (in this case, we will use nano
), then run the following:
nano /etc/locale.gen
And un-comment (remove the # in front of) your desired locale.
If you did not install a text editor, you can use sed
to uncomment your locale.
sed -i 's/#en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/g' /etc/locale.gen
Adjust the sed
command according to the results when you cat
the file.
If you changed the keyboard layout, make the changes consistent in the /etc/vsonsole.conf
file. Modify the KEYMAP
section. For example:
KEYMAP=de-latin1
We now need to make the hostname
file.
You can run:
touch /etc/hostname && echo "HOSTNAME" >> /etc/hostname
Replace "HOSTNAME" with your desired hostname.
We will connect to the internet on the installed device later.
Make sure your networking client is installed. If it's not, install it and other desired packages now:
pacman -Syu package1 package2 package3
It's usually not required, but I recommend using mkinitcpio
to create a new initramfs.
To create a new initramfs, run:
mkinitcpio -P
This may take a while, please do not kill the process.
Set the root password:
passwd
For this guide, I will be using GRUB as my boot loader because it's superior.
First, two packages must be installed: grub and efibootmgr:
pacman -Syu grub efibootmgr
Then, we can install GRUB to /boot
:
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB
If everything worked, you should see a message that looks like "Installation complete. No error returned". Don't worry, you're almost done.
- To exit the
chroot
environment, usectrl+D
. - Unmount the drive that you're installing Arch to by running:
umount -R /mnt
- Restart your machine. I recommend using
halt
and manually turning it on after a few seconds to give your computer more time to recognize the drive.
Turn on your computer.
Select the boot source. Using whatever method is appropriate for your computer, use it to select the boot disk. It should make itself clear. Boot it up.
Inspect the partitions. Use ls
to look through the partitions for the ESP. For example:
> ls (hd1,gpt1)/
The / is important because it allows us to see the files inside of the partition.
Load the kernel. Because we didn't create a GRUB config file, we need to manually boot. You should run something like:
> linux (hd1,gpt1)/vmlinuz-linux
Load the initramfs. This is a necessary step in booting up. Don't worry though, you won't have to type all of this every time you boot up.
To load the initramfs, you can run:
> initrd (hd1,gpt1)/initramfs-linux.img
Please replace all of the file paths with the accurate one for your device.
Boot up. After you've loaded the kernel and initramfs, run:
> boot
In all above examples of the GRUB shell, please omit the preceding >
character.
- Don't panic. Don't cry, either. Your hard work is not in vain.
- In this shell, we do not have lsblk, fdisk, parted, pacman, or any other basic utilities. We need to work with our bare-minimum utilities. Run:
ls /dev | grep "sd"
- The above command should have returned roughly what running
lsblk
would have. Your device's /dev location likely changed. If, when you were installing Arch from live media, and your device's /dev location wassdc
, it is likelysdb
now. Please account for this. - Mount the new root:
mount /dev/sdX /new_root
- Replace /dev/sdX with the path to your device.
- Use ^D to boot up Arch. After a little bit of waiting, you should see a login screen.
Sign in as root
with the password that you set using passwd
.
In this guide, we will only be connecting to WiFi. We will use netctl
.
- Enter the
/etc/netctl
directory. It should have been created when you installed netctl. - Create a new profile configuration file. You can call it whatever you want. This can be done by running:
touch /etc/netctl/my-wifi-connection
- Replace
my-wifi-connection
with your desired profile name. - In the file, enter:
Description='Description'
Interface=[WIRELESS INTERFACE] # You can show all interfaces by running `ip link`.
Connection=wireless
Security=wpa-configsection # If it's a secured network. Use "open" if it has no security.
IP=dhcp
WPAConfigSection=(
'ssid="SSID"'
'key_mgmt=WPA-PSK'
'psk="PASSWORD"'
)
- Replace "SSID" with your SSID and PASSWORD with your network's password
- To start the connection, run:
netctl start my-wifi-connection
- Replace
my-wifi-connection
with the name of the file in/etc/netctl
. - Check the status of your connection:
netctl status my-wifi-connection
- Enable the profile on startup:
netctl enable my-wifi-connection
- Restart
systemd-networkd
:
systemctl restart systemd-networkd
- Optional: Restart your computer.
If you haven't already, please install sudo
:
pacman -Syu sudo
We need to install four packages: xorg
, xfce
, lightdm
, and lightdm-gtk-greeter
:
sudo pacman -Syu xorg xfce lightdm lightdm-gtk-greeter
Now, enable lightdm:
sudo systemctl enable lightdm
We need to install four packages: xorg
, gnome
, gdm
, and optionally gnome-extra
:
sudo pacman -Syu xorg gnome gdm gnome-extra
Now, we have to enable gdm on startup:
sudo systemctl enable gdm
We need to install the following packages: xorg
, gnome
, lightdm
, lightdm-gtk-greeter
, and optionally gnome-extra
:
sudo pacman -Syu xorg gnome lightdm lightdm-gtk-greeter gnome-extra
Now we enable lightdm:
sudo systemctl enable lightdm
We need to install the following: xorg
, plasma-meta
, sddm
, and optionally kde-applications
:
sudo pacman -Syu xorg plasma-meta sddm kde-applications
Now we enable SDDM:
sudo systemctl enable sddm
We need to install the following packages: xorg
, plasma-meta
, lightdm
, lightdm-gtk-greeter
, and optionally kde-applications
:
sudo pacman -Syu xorg plasma-meta lightdm lightdm-gtk-greeter kde-applications
Enable LightDM:
sudo systemctl enable lightdm
After installing your DE of choice, reboot your system. When you start it up again, follow the no GRUB config boot process.
sudo reboot
If you don't want to have to manually boot up, then you can use a grub.cfg file to do it for you. There are two ways you can do this:
To make the config file, you can run:
grub-mkconfig -o /boot/grub/grub.cfg
- Create the configuration file:
sudo touch /boot/grub/grub.cfg
- Edit the file. In it, put something like the following:
menuentry "Boot up Arch Linux" {
linux (hdX,gptX)/vmlinuz-linux
initrd (hdX,gptX)/initramfs-linux.img
boot
}
- Add any other things you want to the cfg file, but make sure you replace "hdX,gptX" and any other aspects to match what you did in the manual boot-up process.
UEFI Computer | BIOS Computer | |
---|---|---|
Partition Maps | GUID Partition Table | Master Boot Record |
EFI System Partition rqd. | Yes | No |
SWAP Partition rqd. | Yes | Yes |
Root Partition rqd. | Yes | Yes |