Source: ArchWiki (90%) --> will update source for each topic later
Stuff | My Stuff |
---|---|
DE | GNOME |
GPU | INTEL+NVIDIA |
SWAP | SWAPFILE |
DRIVE | SSD |
SHELL | ZSH |
KERNEL | LINUX & LINUX-LTS |
EDITOR | NANO |
NETWORK | WIFI |
FILESYSTEM | BTRFS |
BOOTLOADER | GRUB |
timedatectl set-ntp true
(default is US, so you don't have to do this)
2a. localectl list-keymaps | list <your-keyboard-layout>
Eg:
localectle list-keymaps | list us
2b. loadkeys "<your-keymap>"
Eg:
loadkeys "us"
iwctl
This opens an interactive prompt to connect to wifi
3a. device list
This lists all the wifi adapter connected
3b. station <device-name> scan
station wlan0 scan
(assuming wlan0 is your adapter)
3c. station wlan0 get-networks
This returns the scanned neworks near you.
3d. station wlan0 connect <SSID>
Eg:
station wlan0 connect FTTH-DDC
Then enter passphrase.
- Wait for few seconds & exit out of there by typing
exit
.
-
lsblk
this lists out the details of the block device connected. -
Use
cfdisk
orfdisk
or something else to make your partitions.
Create a partition with more than 300MB for boot.
Create root partition
A Home partition if needed.
Swap partition if necessary, else we could use swapfile
Also create any other partitions that you need. We can use these as Local Disk D,E,F as in windows.
- Format the partitions with a file system.
I made a boot partition
/dev/sda1
of 512MB size (your partition name/number may differ).Made a root partition
/dev/sda2
of 350GB.Made another partition
/dev/sda3
as a seperate partition for my Projects (130Gb) .Have decided not to make a seperate HOME partition as I've got only a 480GB ssd. Eventually HOME or ROOT may want more space, so by not making a seperate HOME, i got to not physically limit HOME or ROOT, & using a seperate partition for all my Important project files.
7a. mkfs.fat -F32 /dev/sda1
Formatting boot as EFI:
7b. mkfs.btrfs /dev/sda2
Formatting root as btrfs (butter filesystem):
7c. mkfs.btrfs -L Projects /dev/sda3
Formatting my other partition also as btrfs, also labelling the partition as "Projects":
-
mount /dev/sda2 /mnt
Mounting root partition into "/mnt" -
btrfs subvolume create /mnt/@
Make a root subvolume inside our root partition
- if you want to use timeshft, you need to make root subvolume as
@root
instead of@
which is for using with snapper. - I don't use both, so it doesn't matter for me.
-
btrfs su cr /mnt/@home
Same command, but shortened version, create a home subvolume (because we can), & this ain't a partition with physical size defined. so... -
btrfs su cr /mnt/@swap
We have to create a swap subvolume in btrfs to use a swapfile -
umount /mnt
Unmount the/mnt
partition that we mounted.
-
mkdir -p /mnt/{boot,home,.swap}
This makes boot, home & swap directory inside the /mnt. -
mount -o noatime,ssd,compress=lzo,space_cache=v2,subvol=@ /dev/sda2 /mnt
Mounts root subvolume into root folder. -
mount -o noatime,ssd,compress=lzo,space_cache=v2,subvol=@home /dev/sda2 /mnt/home
Mounts home subvolume into home folder. -
mount -o nodatacow,subvol=@swap /dev/sda2 /mnt/.swap
Mounts swap subvolume into swap folder. -
mount /dev/sda1 /mnt/boot
Mounts the boot partition into the boot folder.
pacstrap /mnt base base-devel linux linux-headers linux-lts linux-lts-headers linux-firmware nano intel-ucode networkmanager btrfs-progs wpa_supplicant grub efibootmgr dosfstools grub-btrfs
Installs the base package needed + few extra for me.genfstab -U /mnt >> /mnt/etc/fstab
This generates a fstab file to go.arch-chroot /mnt
Change root to the base system install
git clone https://aur.archlinux.org/yay-bin.git ~/yay-bin
cd ~/yay-bin
makepkg -si
cd ~
rm -rf ~/yay-bin
truncate -s 0 /.swap/swapfile
chattr +C /.swap/swapfile
btrfs property set /.swap/swapfile compression none
dd if=/dev/zero of=/.swap/swapfile bs=1G count=5 status=progress
This creates a swapfile of 5 Gb.chmod 600 /.swap/swapfile
Sets the right permissionmkswap /.swap/swapfile
Format the file as swapswapon /.swap/swapfile
Turn on the swap filenano /etc/fstab
Edit the fstab file to add an entry for the swap file:/.swap/swapfile none swap defaults 0 0
- We have to pass 2 params to the
GRUB_CMDLINE_LINUX_DEFAULT
param under/etc/default/grub
. For that, do the following:
31a. Find the UUID of our / from fstab by runnng cat /etc/fstab
- Append this UUID as "resume=UUID={your_uuid}" to the end of
GRUB_CMDLINE_LINUX_DEFAULT
, without the quotes and curly braces, but within the quotes of theCMDLINE
parameter.
31b. To find resume_offset:
- Download the file
curl -o btrfs_map_physical https://raw.githubusercontent.com/osandov/osandov-linux/master/scripts/btrfs_map_physical.c
- Compile it
gcc -O2 -o btrfs_map_physical btrfs_map_physical.c
- Run the file generated after compilation, pointing to our swap file:
./btrfs_map_physical /.swap/swapfile
- It will give output similar to this:
FILE OFFSET EXTENT TYPE LOGICAL SIZE LOGICAL OFFSET PHYSICAL SIZE DEVID PHYSICAL OFFSET
0 regular 4096 2927632384 268435456 1 4009762816
4096 prealloc 268431360 2927636480 268431360 1 4009766912
268435456 prealloc 268435456 3251634176 268435456 1 4333764608
536870912 prealloc 268435456 3520069632 268435456 1 4602200064
805306368 prealloc 268435456 3788505088 268435456 1 4870635520
1073741824 prealloc 268435456 4056940544 268435456 1 5139070976
1342177280 prealloc 268435456 4325376000 268435456 1 5407506432
1610612736 prealloc 268435456 4593811456 268435456 1 5675941888
- Take note of what value comes first under
PHYSICAL_OFFSET
, here in this example, it's 4009762816. - Also note the pagesize, which is the first value under
LOGICAL_SIZE
, here its 4096. (pagesize can also be found withgetconf PAGESIZE
) - Note down the
resume_offset
by dividing the PHYSICAL_OFFSET with the PAGESIZE. - Append this to the end of
GRUB_CMDLINE_LINUX_DEFAULT
as "resume_offset={your_offset}", without the quotes and curly braces, but within the quotes of theCMDLINE
parameter.
- Add "reume" option (without the quotes) to the end of the HOOKS section in
/etc/mkinitcpio.conf
, within the quotes of HOOKS.
We need to edit this file again, so we will generate the initramfs later.
- Set timezone
ln -sf /usr/share/zoneinfo/Asia/Kolkata /etc/localtime
- Set hw clock to system clock
hwclock --systohc
- Uncomment
en_IN UTF-8
anden_US.UTF-8 UTF-8
from/etc/locale.gen
file, to set locale - Run
locale-gen
to generate locale file - Edit
/etc/locale.cong
and add"LANG=en_US.UTF-8"
- Add the keymap to
/etc/vconsole.conf
For ex:KEYMAP=us
orKEYMAP=in
- Set a hostname for your PC by adding the name to
/etc/hostname
file. For as example, I set it to archlinux - Edit hosts file
/etc/hosts
and add the following for networking part
127.0.0.1 localhost
127.0.1.1 archlinux
::1 archlinux.localdomain archlinux
(It's a TAB & not space)
- Create your root password by typing
passwd
- Enable
multilib
repo to run 32 bit applications: Uncomment[multilib]
andInclude
frometc/pacman.conf
- Install other package that you need/might need
pacman -S git reflector zsh zsh-completions bluez cups cups-pdf xdg-utils xdg-user-dirs xdg-user-dirs-gtk xdg-desktop-portal-gtk xdg-desktop-portal-gnome alsa-utils alsa-card-profiles pulseaudio pulseaudio pulseaudio-alsa pulseaudio-bluetooth pulseaudio-equalizer inetutils firefox vlc lollypop gimp shotwell transmission telegram-desktop steam wine winetricks mousetweaks optimus-manager optimus-manager-qt
- Install intel drivers.
pacman -S mesa lib32-mesa mesa vulkan-intel intel-media-driver
- Install xorg group
pacman -S xorg
- Install nvidia drivers
pacman -S nvidia nvidia-utils lib32-nvidia-utils nvidia-lts nvidia-dkms
&yay -S libva-vdpau-driver-vp9-git
- Install gnome:
pacman -S gnome gnome-extra gdm
- Edit
/etc/mkinitcpio.conf
& do the following:
47a. Add "btrfs"
to the MODULES section.
47b. Add "resume"
to the end of HOOKS section, just before "filesystems" This is for resume support for Hibernation.
47c. Add "numlock"
to HOOKS section.
- Generate initramfs:
mkinitcpio -p linux
mkinitcpio -p linux-lts
- Install GRUB:
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB
- Generate Grub config:
grub-mkconfig -o /boot/grub/grub.cfg
- Create User (archguy for this example) & add it to groups:
useradd -mG wheel -s /bin/zsh archguy
passwd archguy
- Type in
EDITOR=nano visudo
and uncomment the line"wheel ALL=(ALL) ALL"
- Enable Services:
systemctl enable NetworkManager
systemctl enable bluetooth.service
systemctl enable cups.service
systemctl enable systemd-timesyncd.service
- Exit from chroot by running
exit
- Unmount all
umount -a
- Reboot
reboot
- https://kenharris.xyz/posts/linux-tweaks#base-install
yay -S gvfs gvfs-mtp polkit udisks2 adb zsh zsh-syntax-highlighting zsh-autosuggestions
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
- Add following at end of .zshrc file
alias vim=nvim source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh