til/install-archlinux.md

314 lines
5.6 KiB
Markdown
Raw Normal View History

2020-05-24 10:44:40 +00:00
# Install Arch Linux
2020-02-02 04:02:43 +00:00
2020-05-24 10:44:40 +00:00
Install Arch Linux is thing I always want to do for my laptop/PC since I had my laptop in ninth grade.
2020-02-02 04:02:43 +00:00
This is not a guide for everyone, this is just save for myself in a future and for anyone who want to taste a bit.
2020-02-24 15:33:09 +00:00
Assume your laptop/PC is UEFI-capable.
2020-03-13 04:04:51 +00:00
## [Installation guide](https://wiki.archlinux.org/index.php/Installation_guide)
2020-02-02 04:02:43 +00:00
2021-04-02 11:10:49 +00:00
### Pre-installation
2020-05-20 09:14:22 +00:00
Check disks carefully:
2020-05-19 18:49:39 +00:00
```sh
lsblk
```
2021-04-02 11:10:49 +00:00
[USB flash installation medium](https://wiki.archlinux.org/index.php/USB_flash_installation_medium)
2021-04-02 11:07:14 +00:00
#### Verify the boot mode
2020-02-02 04:02:43 +00:00
2021-04-02 11:07:14 +00:00
Check UEFI mode:
```sh
ls /sys/firmware/efi/efivars
```
#### Connect to the internet
2020-02-02 04:02:43 +00:00
2021-04-22 03:37:59 +00:00
Use [iwd](https://wiki.archlinux.org/index.php/Iwd).
2021-04-02 11:10:49 +00:00
#### Update the system clock
```sh
timedatectl set-ntp true
```
2020-02-02 04:02:43 +00:00
2021-04-02 11:07:14 +00:00
#### Partition the disks
2020-02-02 04:02:43 +00:00
2020-03-13 04:04:51 +00:00
Partition:
```sh
2021-04-02 11:07:14 +00:00
# For convert GPT
cgdisk
2021-04-22 03:37:59 +00:00
# For easy partition
2020-03-13 04:04:51 +00:00
cfdisk
```
2021-04-27 04:00:35 +00:00
[Partition scheme](https://wiki.archlinux.org/index.php/Partitioning#Partition_scheme)
UEFI/GPT layout:
2020-03-28 14:38:17 +00:00
| Mount point | Partition type | Suggested size |
| ----------- | -------------------- | -------------- |
2020-10-07 08:40:52 +00:00
| `/mnt/efi` | EFI system partition | 512 MiB |
| `/mnt/boot` | Linux extended boot | 1 GiB |
2021-04-02 11:07:14 +00:00
| `/mnt` | Linux | |
2021-04-27 04:00:35 +00:00
| `/mnt/var` | Linux | >= 12 GiB |
2020-10-07 08:40:52 +00:00
| `/mnt/home` | Linux | |
2021-04-02 11:07:14 +00:00
| | Linux swap | RAM x 2 |
2020-03-28 14:38:17 +00:00
2020-05-19 18:49:39 +00:00
Format:
```sh
2021-04-02 11:07:14 +00:00
# efi
mkfs.fat -F32 /dev/efi_system_partition
# boot
mkfs.fat -F32 /dev/boot_system_partition
2020-05-19 18:49:39 +00:00
2021-04-02 11:07:14 +00:00
# root
2021-04-21 11:50:36 +00:00
mkfs.ext4 -L ROOT /dev/root_partition
mkfs.btrfs -L ROOT /dev/root_partition
2021-04-02 11:07:14 +00:00
2021-04-17 06:23:46 +00:00
# var
2021-04-21 11:50:36 +00:00
mkfs.ext4 -L VAR /dev/var_partition
mkfs.btrfs -L VAR /dev/var_partition
2021-04-17 06:23:46 +00:00
2021-04-02 11:07:14 +00:00
# home
2021-04-21 11:50:36 +00:00
mkfs.ext4 -L HOME /dev/home_partition
mkfs.btrfs -L HOME /dev/home_partition
2021-04-02 11:07:14 +00:00
# swap
mkswap /dev/sdxY
2020-05-19 18:49:39 +00:00
```
2020-08-11 06:05:09 +00:00
Mount:
```sh
2021-04-02 11:07:14 +00:00
# root
mount /dev/root_partition /mnt
2020-10-07 08:40:52 +00:00
2021-04-02 11:07:14 +00:00
# efi
mkdir /mnt/efi
mount /dev/efi_system_partition /mnt/efi
2020-08-11 06:05:09 +00:00
2021-04-02 11:07:14 +00:00
# boot
mkdir /mnt/boot
mount /dev/boot_system_partition /mnt/boot
2020-08-11 06:05:09 +00:00
2021-04-17 06:23:46 +00:00
# var
mkdir /mnt/var
mount /de/var_partition /mnt/var
2021-04-02 11:07:14 +00:00
# home
mkdir /mnt/home
mount /dev/home_partition /mnt/home
2020-10-11 17:26:10 +00:00
2021-04-02 11:07:14 +00:00
# swap
swapon /dev/swap_partition
2020-08-11 06:05:09 +00:00
```
2020-08-11 17:00:24 +00:00
### Installation
```sh
2021-04-21 11:50:36 +00:00
pacstrap /mnt base linux linux-firmware
2021-04-02 11:07:14 +00:00
# LTS
pacstrap /mnt linux-lts
# Performance
pacstrap /mnt linux-zen
2021-03-30 03:34:16 +00:00
# AMD
pacstrap /mnt amd-ucode
2021-02-13 06:45:01 +00:00
2021-03-30 03:34:16 +00:00
# Intel
2021-02-13 06:45:01 +00:00
pacstrap /mnt intel-ucode
2021-04-04 09:55:44 +00:00
2021-04-21 11:50:36 +00:00
# Btrfs
pacstrap /mnt btrfs-progs
# Text editor
pacstrap /mnt neovim
2021-02-13 06:45:01 +00:00
```
2021-04-02 11:07:14 +00:00
### Configure
#### Fstab
```sh
genfstab -U /mnt >> /mnt/etc/fstab
```
#### Chroot
```sh
arch-chroot /mnt
```
#### Time zone
```sh
ln -sf /usr/share/zoneinfo/Region/City /etc/localtime
hwclock --systohc
```
#### Localization:
Edit `/etc/locale.gen`:
```txt
2021-04-02 11:10:49 +00:00
# Uncomment en_US.UTF-8 UTF-8
2021-04-02 11:07:14 +00:00
```
Generate locales:
```sh
locale-gen
```
Edit `/etc/locale.conf`:
```txt
LANG=en_US.UTF-8
```
#### Network configuration
Edit `/etc/hostname`:
```txt
myhostname
```
Edit `/etc/hosts`:
```txt
127.0.0.1 localhost
::1 localhost
127.0.1.1 myhostname.localdomain myhostname
2021-04-02 11:07:14 +00:00
```
#### Root password
```sh
passwd
```
#### Boot loader
2020-03-13 04:04:51 +00:00
2020-08-11 17:00:24 +00:00
[systemd-boot](Applications/System/systemd-boot.md)
2020-03-13 04:04:51 +00:00
## [General recommendations](https://wiki.archlinux.org/index.php/General_recommendations)
2020-02-02 04:02:43 +00:00
2020-03-28 14:38:17 +00:00
Always remember to check **dependencies** when install packages.
2020-02-23 17:54:34 +00:00
2020-03-13 04:04:51 +00:00
### System administration
2020-08-11 17:00:24 +00:00
Add user:
2020-03-28 14:38:17 +00:00
```sh
2021-04-17 05:38:55 +00:00
useradd -m -G wheel -s /bin/bash -c "The Joker" joker
2020-03-28 14:38:17 +00:00
```
2020-08-11 17:00:24 +00:00
Set password:
```sh
passwd username
```
Enable sudo:
```sh
2021-04-21 11:50:36 +00:00
pacman -Syu sudo
2020-08-11 17:00:24 +00:00
2021-04-21 11:50:36 +00:00
EDITOR=nvim visudo
2020-08-11 17:00:24 +00:00
# Uncomment group wheel
```
### Desktop Environment
2020-02-02 04:02:43 +00:00
2020-05-19 19:27:28 +00:00
Install [Xorg](https://wiki.archlinux.org/index.php/Xorg):
2020-02-02 04:02:43 +00:00
2020-05-19 19:27:28 +00:00
```sh
pacman -Syu xorg-server
2021-03-30 03:14:33 +00:00
# AMD
pacman -Syu xf86-video-amdgpu mesa
# Intel
pacman -Syu xf86-video-intel mesa
# NVIDIA
pacman -Syu xf86-video-nouveau mesa
2020-05-19 19:27:28 +00:00
```
2020-02-02 04:02:43 +00:00
2021-04-03 15:58:00 +00:00
#### [GNOME](https://wiki.archlinux.org/index.php/GNOME)
2020-02-02 04:02:43 +00:00
2021-02-13 06:17:05 +00:00
```sh
2021-04-21 04:29:08 +00:00
pacman -Syu gnome-shell \
gdm \
networkmanager \
gnome-control-center \
gnome-terminal gnome-backgrounds gnome-screenshot \
gnome-system-monitor gnome-keyring \
nautilus xdg-user-dirs-gtk file-roller p7zip unrar \
evince eog gedit
2021-02-13 06:17:05 +00:00
2021-04-03 15:58:00 +00:00
# Login manager
2020-05-19 19:27:28 +00:00
systemctl enable gdm.service
2021-04-04 08:38:34 +00:00
2021-04-22 03:33:35 +00:00
# Network
systemctl enable NetworkManager.service
2021-04-04 08:38:34 +00:00
2021-04-22 03:33:35 +00:00
# Bluetooth
2020-08-11 17:00:24 +00:00
systemctl enable bluetooth.service
2021-04-04 08:38:34 +00:00
2021-04-22 03:33:35 +00:00
# Clock
2020-03-13 04:04:51 +00:00
timedatectl set-ntp true
```
## [List of applications](https://wiki.archlinux.org/index.php/List_of_applications)
2020-05-06 18:38:17 +00:00
### [pacman](https://wiki.archlinux.org/index.php/pacman)
2020-10-07 08:40:52 +00:00
Uncomment in `/etc/pacman.conf`:
2020-05-06 18:38:17 +00:00
```txt
# Misc options
Color
```
2021-03-29 17:38:38 +00:00
## [Improving performance](https://wiki.archlinux.org/index.php/improving_performance)
2021-04-22 03:33:35 +00:00
[Swappiness](https://wiki.archlinux.org/index.php/swap#Swappiness)
2021-03-29 17:38:38 +00:00
2021-04-22 03:33:35 +00:00
[Journal size limit](https://wiki.archlinux.org/index.php/Systemd/Journal#Journal_size_limit)
2021-03-29 17:38:38 +00:00
2021-04-22 03:33:35 +00:00
[Disabling automatic core dumps](https://wiki.archlinux.org/index.php/Core_dump#Disabling_automatic_core_dumps)
2021-03-29 18:00:18 +00:00
2021-04-22 03:33:35 +00:00
[Periodic TRIM](https://wiki.archlinux.org/index.php/Solid_state_drive#Periodic_TRIM)
2021-03-29 17:38:38 +00:00
2021-04-22 03:33:35 +00:00
[Improving system responsiveness under low-memory conditions](https://wiki.archlinux.org/index.php/Improving_performance#Improving_system_responsiveness_under_low-memory_conditions)
2021-03-29 17:38:38 +00:00
2021-03-29 17:43:15 +00:00
[Watchdogs](https://wiki.archlinux.org/index.php/improving_performance#Watchdogs)
2021-03-30 05:59:30 +00:00
[Staggered spin-up](https://wiki.archlinux.org/index.php/Improving_performance/Boot_process#Staggered_spin-up)
2021-04-04 17:45:58 +00:00
[Silent boot](https://wiki.archlinux.org/index.php/Silent_boot)
2021-03-29 18:11:35 +00:00
[Hardware video acceleration](https://wiki.archlinux.org/index.php/Hardware_video_acceleration)
2021-03-30 03:16:54 +00:00
[Kernel mode setting](https://wiki.archlinux.org/index.php/Kernel_mode_setting)
2021-03-29 17:48:20 +00:00
[Turn off CPU exploit mitigations](https://wiki.archlinux.org/index.php/improving_performance#Turn_off_CPU_exploit_mitigations)
2021-03-29 17:43:15 +00:00
2020-03-13 04:04:51 +00:00
## In the end
2020-02-04 13:19:22 +00:00
2020-03-28 14:38:17 +00:00
This guide is updated regularly I promise.