2020-12-13 11:20:03 +01:00
|
|
|
Install Arch Linux
|
|
|
|
==================
|
|
|
|
|
|
|
|
This is my personal setup almost every time I install Arch Linux.
|
|
|
|
This is meant for me as being something I can quickly reference.
|
|
|
|
|
|
|
|
Change localkeys to my keyboard layout
|
|
|
|
--------------------------------------
|
|
|
|
|
|
|
|
You can find your keymap file by using localectl:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
localectl list-keymaps
|
|
|
|
```
|
|
|
|
|
2022-07-04 22:32:12 +02:00
|
|
|
|
|
|
|
In my case I have a Serbian keyboard layout.
|
2020-12-13 11:20:03 +01:00
|
|
|
|
|
|
|
```bash
|
2022-07-04 22:32:12 +02:00
|
|
|
loadkeys sr-latin
|
2020-12-13 11:20:03 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
Create Partitions
|
|
|
|
-----------------
|
|
|
|
|
2022-07-04 22:32:12 +02:00
|
|
|
To list block devices :
|
2020-12-13 11:20:03 +01:00
|
|
|
```bash
|
2022-07-04 22:32:12 +02:00
|
|
|
lsblk
|
|
|
|
```
|
|
|
|
Now, select a device to partition
|
|
|
|
|
|
|
|
```bash
|
|
|
|
cfdisk /dev/DEVICE
|
2020-12-13 11:20:03 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
Set up the partions, mount and use swap
|
|
|
|
---------------------------------------
|
|
|
|
|
|
|
|
Let us say you have a simple setup:
|
|
|
|
|
2020-12-13 11:33:38 +01:00
|
|
|
- /boot/efi partition (vfat)
|
|
|
|
- / partition (ext4)
|
|
|
|
- /home partition (ext4)
|
|
|
|
|
2020-12-13 11:20:03 +01:00
|
|
|
|
|
|
|
NOTE: `lsblk` is a very nice tool to doublecheck your partition(s) structure.
|
|
|
|
|
|
|
|
First we format to the file systems we want:
|
|
|
|
|
|
|
|
```bash
|
2022-07-04 22:32:12 +02:00
|
|
|
mkfs.fat -F32 /dev/PART (/boot/efi)
|
|
|
|
mkfs.ext4 /dev/PART (/, /home)
|
2020-12-13 11:20:03 +01:00
|
|
|
```
|
|
|
|
|
2021-07-30 21:16:11 +02:00
|
|
|
And then mount the file systems to /mnt:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
# Mount / (root)
|
|
|
|
mount /dev/sdaxY /mnt
|
|
|
|
```
|
2020-12-13 11:20:03 +01:00
|
|
|
Create /mnt structure, one-liner:
|
|
|
|
|
|
|
|
```bash
|
2022-07-04 22:32:12 +02:00
|
|
|
mkdir -p /mnt/{boot,home}
|
2020-12-13 11:20:03 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
```bash
|
2021-07-30 21:16:11 +02:00
|
|
|
# Mount /boot, /home
|
2022-07-04 22:32:12 +02:00
|
|
|
mount /dev/PART /mnt/<point>
|
2020-12-13 11:20:03 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
|
2020-12-13 11:33:38 +01:00
|
|
|
Installing the actual base system and doas
|
2020-12-13 11:20:03 +01:00
|
|
|
------------------------------------------
|
|
|
|
|
2022-07-04 22:32:12 +02:00
|
|
|
Install the base system, with some packages I like as well.
|
2020-12-13 11:20:03 +01:00
|
|
|
|
|
|
|
```bash
|
2022-07-04 22:32:12 +02:00
|
|
|
pacstrap /mnt base base-devel opendoas neovim iwd dhcpcd linux linux-headers linux-firmware
|
2020-12-13 11:20:03 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
Generate the fstab (so it knows how things are mounted)
|
|
|
|
-------------------------------------------------------
|
|
|
|
|
|
|
|
This is why we had to mount everything as first, so genfstab
|
|
|
|
would know what to do when generating the fstab.
|
|
|
|
|
|
|
|
```bash
|
|
|
|
genfstab -U -p /mnt >> /mnt/etc/fstab
|
|
|
|
```
|
|
|
|
|
|
|
|
chroot into the installed system with /bin/bash
|
|
|
|
-----------------------------------------------
|
|
|
|
|
|
|
|
```bash
|
|
|
|
arch-chroot /mnt /bin/bash
|
|
|
|
```
|
|
|
|
|
|
|
|
Locale (system language)
|
|
|
|
------------------------
|
|
|
|
|
|
|
|
Depending on what you want, you change the /etc/locale.gen file:
|
|
|
|
|
|
|
|
```bash
|
2020-12-13 11:33:38 +01:00
|
|
|
nvim /etc/locale.gen
|
2020-12-13 11:20:03 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
NOTE: Use UTF-8 whenever possible.
|
|
|
|
|
|
|
|
DOUBLE NOTE: If you are from America, you don't need to change the file.
|
|
|
|
|
|
|
|
When done, you simply generate the locales you want and tell the system what you
|
|
|
|
want to use.
|
|
|
|
|
|
|
|
Generate:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
locale-gen
|
|
|
|
```
|
|
|
|
|
|
|
|
Tell the system what we use:
|
|
|
|
|
|
|
|
```bash
|
2020-12-13 11:33:38 +01:00
|
|
|
echo LANG=en_US.UTF-8 > /etc/locale.conf
|
|
|
|
export LANG=en_US.UTF-8
|
2020-12-13 11:20:03 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
Timezone
|
|
|
|
--------
|
|
|
|
|
|
|
|
Symlink/Set your timezone:
|
|
|
|
|
|
|
|
```bash
|
2022-07-04 22:32:12 +02:00
|
|
|
ln -s /usr/share/zoneinfo/CONTINENT/CITY /etc/localtime
|
2020-12-13 11:20:03 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
Set system to the Hardware Clock
|
|
|
|
--------------------------------
|
|
|
|
|
|
|
|
```bash
|
2022-07-04 22:32:12 +02:00
|
|
|
hwclock --systohc --local
|
2020-12-13 11:20:03 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
Hostname
|
|
|
|
--------
|
|
|
|
|
|
|
|
Choose an awesome hostname:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
echo myhostname > /etc/hostname
|
|
|
|
```
|
|
|
|
|
2020-12-13 11:33:38 +01:00
|
|
|
Edit /etc/vconsole.conf:
|
|
|
|
|
|
|
|
```bash
|
2021-07-30 21:16:11 +02:00
|
|
|
KEYMAP=sr-latin
|
2020-12-13 11:33:38 +01:00
|
|
|
```
|
2020-12-13 11:20:03 +01:00
|
|
|
|
2020-12-13 11:33:38 +01:00
|
|
|
Add matching entries to hosts:
|
2020-12-13 11:20:03 +01:00
|
|
|
|
|
|
|
```bash
|
2020-12-13 11:33:38 +01:00
|
|
|
127.0.0.1 localhost
|
2022-07-04 22:32:12 +02:00
|
|
|
::1 localhost
|
2020-12-13 11:33:38 +01:00
|
|
|
127.0.1.1 myhostname.localdomain myhostname
|
2020-12-13 11:20:03 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
Ramdisk
|
|
|
|
-------
|
|
|
|
|
|
|
|
Initial ramdisk environment.
|
|
|
|
|
|
|
|
```bash
|
2020-12-13 11:33:38 +01:00
|
|
|
mkinitcpio -P
|
2020-12-13 11:20:03 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
This actually ran under the pacstrap process, I just like to be safe.
|
|
|
|
|
|
|
|
Root Password
|
|
|
|
-------------
|
|
|
|
|
|
|
|
Be stronk:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
passwd
|
|
|
|
```
|
|
|
|
|
|
|
|
Grub (Bootloader)
|
|
|
|
-----------------
|
|
|
|
|
|
|
|
Well, we need a bootloader:
|
|
|
|
|
|
|
|
```bash
|
2022-07-04 22:32:12 +02:00
|
|
|
pacman -S refind
|
2020-12-13 11:20:03 +01:00
|
|
|
```
|
2022-07-04 22:32:12 +02:00
|
|
|
It's as simple as
|
2020-12-13 11:20:03 +01:00
|
|
|
|
|
|
|
```bash
|
2022-07-04 22:32:12 +02:00
|
|
|
refind-install
|
2020-12-13 11:20:03 +01:00
|
|
|
```
|
|
|
|
|
2022-07-04 22:32:12 +02:00
|
|
|
Also, it will break on first boot. You will have to find a way to boot without it and do refind-install again within the system.
|
|
|
|
|
|
|
|
|
2020-12-13 11:20:03 +01:00
|
|
|
Exit arch-chroot
|
|
|
|
----------------
|
|
|
|
|
|
|
|
```bash
|
|
|
|
exit
|
|
|
|
```
|
|
|
|
|
|
|
|
Umount /mnt and reboot
|
|
|
|
----------------------
|
|
|
|
|
|
|
|
Unmount EVERYTHING and reboot the system.
|
|
|
|
|
|
|
|
```bash
|
2022-07-04 22:32:12 +02:00
|
|
|
umount -R /mnt
|
2020-12-13 11:20:03 +01:00
|
|
|
reboot
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
Login as Root to Arch Linux and permantly set the keymap (keyboard)
|
|
|
|
-------------------------------------------------------------------
|
|
|
|
|
|
|
|
Now we want to make our keyboard layout permanent:
|
|
|
|
|
|
|
|
```bash
|
2021-07-30 21:16:11 +02:00
|
|
|
localectl set-keymap --no-convert sr-latin
|
2020-12-13 11:20:03 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
Add User and set Password
|
|
|
|
-------------------------
|
|
|
|
|
|
|
|
```bash
|
2022-07-04 22:32:12 +02:00
|
|
|
useradd -m -g users -G audio,video,network,games,wheel -s /bin/bash username
|
2020-12-13 11:20:03 +01:00
|
|
|
passwd username
|
|
|
|
```
|
|
|
|
|
2020-12-13 11:33:38 +01:00
|
|
|
Change sudoers file using nvim
|
2020-12-13 11:20:03 +01:00
|
|
|
------------------------------
|
|
|
|
|
|
|
|
```bash
|
2020-12-13 11:33:38 +01:00
|
|
|
EDITOR=nvim visudo
|
2020-12-13 11:20:03 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
Uncomment wheel group.
|
|
|
|
|
|
|
|
`# %wheel ALL=(ALL:ALL) ALL`
|
|
|
|
|
2022-07-04 22:32:12 +02:00
|
|
|
Enable services :
|
|
|
|
-----------------
|
|
|
|
|
|
|
|
```bash
|
|
|
|
systemctl enable --now dhcpcd iwd
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
2020-12-13 11:20:03 +01:00
|
|
|
Logout of Root
|
|
|
|
--------------
|
|
|
|
|
|
|
|
```bash
|
|
|
|
exit
|
|
|
|
```
|
|
|
|
|
|
|
|
Login as your username and test sudo with pacman
|
|
|
|
------------------------------------------------
|
|
|
|
|
|
|
|
```bash
|
2022-07-04 22:32:12 +02:00
|
|
|
sudo pacman -Syyu ...
|
2020-12-13 11:20:03 +01:00
|
|
|
```
|