Last active
February 3, 2019 12:40
-
-
Save codeitlikemiley/18788c4f84ac3e7db980781aba1d2609 to your computer and use it in GitHub Desktop.
ARCH - BTRFS (CUSTOM GUIDE)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## Arch Linux | |
| #### Misc Tweaks | |
| ###### Disable turbo boost: | |
| `# echo 1 > /sys/devices/system/cpu/intel_pstate/no_turbo` | |
| ###### Disable systemd from handling lid close events: | |
| Edit `/etc/systemd/logind.conf` and set `HandleLidSwitch` to `ignore`. | |
| ### Installation procedures | |
| ###### Installation procedure (basic install): | |
| 1. Use wifi-menu to connect to network | |
| 2. Start ssh `# systemctl start sshd` | |
| 3. Connect to machine via SSH | |
| 4. Visit https://www.archlinux.org/mirrorlist/ on another computer, generate mirrorlist | |
| 5. Edit /etc/pacman.d/mirrorlist on the Arch computer and paste the faster servers | |
| 6. Update package indexes: `# pacman -Syyy` | |
| 7. Create root partition: | |
| `# fdisk /dev/sda` | |
| * o (to create an empty DOS partition table) | |
| * n | |
| * 1 | |
| * enter | |
| * +30G | |
| * w | |
| 8. Create home partition: | |
| `# fdisk /dev/sda` | |
| * n | |
| * 2 | |
| * enter | |
| * enter | |
| * w | |
| 9. `# mkfs.ext4 /dev/sda1` | |
| 10. `# mkfs.ext4 /dev/sda2` | |
| 11. `# mount /dev/sda1 /mnt` | |
| 12. `# mkdir /mnt/home` | |
| 13. `# mount /dev/sda2 /mnt/home` | |
| 14. `# pacstrap -i /mnt base` | |
| 15. `# genfstab -U -p /mnt >> /mnt/etc/fstab` | |
| 16. `# arch-chroot /mnt` | |
| 17. `# pacman -S base-devel openssh grub-bios linux-headers linux-lts linux-lts-headers` | |
| 18. If wireless: `# pacman -S dialog network-manager-applet networkmanager networkmanager-openvpn wireless_tools wpa_supplicant wpa_actiond` | |
| 19. `# mkinitcpio -p linux` | |
| 20. `# mkinitcpio -p linux-lts` | |
| 21. `# nano /etc/locale.gen` (uncomment en_US.UTF-8) | |
| 22. `# locale-gen` | |
| 23. `# passwd` (for setting root password) | |
| 24. `# grub-install --target=i386-pc --recheck /dev/sda` | |
| 25. `# cp /usr/share/locale/en\@quot/LC_MESSAGES/grub.mo /boot/grub/locale/en.mo` | |
| 26. `# grub-mkconfig -o /boot/grub/grub.cfg` | |
| 27. Create swap file: | |
| * `# fallocate -l 2G /swapfile` | |
| * `# chmod 600 /swapfile` | |
| * `# mkswap /swapfile` | |
| * `# echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab` | |
| 28. `$ exit` | |
| 29. `# umount -a` | |
| 30. `# reboot` | |
| ###### General Installation procedure (standard install on EFI): | |
| 1. Use wifi-menu to connect to network | |
| 2. Start ssh `# systemctl start sshd` | |
| 3. Connect to machine via SSH | |
| 4. Visit https://www.archlinux.org/mirrorlist/ on another computer, generate mirrorlist | |
| 5. Edit /etc/pacman.d/mirrorlist on the Arch computer and paste the faster servers | |
| 6. Update package indexes: `# pacman -Syyy` | |
| 7. Create efi partition: | |
| `# fdisk /dev/sda` | |
| * g (to create an empty GPT partition table) | |
| * n | |
| * 1 | |
| * enter | |
| * +300M | |
| * t | |
| * 1 (For EFI) | |
| * w | |
| 8. Create root partition: | |
| `# fdisk /dev/sda` | |
| * n | |
| * 2 | |
| * enter | |
| * +30G | |
| * w | |
| 9. Create home partition: | |
| `# fdisk /dev/sda` | |
| * n | |
| * 3 | |
| * enter | |
| * enter | |
| * w | |
| 10. `# mkfs.fat -F32 /dev/sda1` | |
| 11. `# mkfs.ext4 /dev/sda2` | |
| `# mkfs.ext4 /dev/sda3` | |
| `# mount /dev/sda2 /mnt` | |
| 12. `# mkdir /mnt/home` | |
| 13. `# mount /dev/sda3 /mnt/home` | |
| 14. `# pacstrap -i /mnt base` | |
| 15. `# genfstab -U -p /mnt >> /mnt/etc/fstab` | |
| 16. `# arch-chroot /mnt` | |
| 17. `# pacman -S base-devel grub efibootmgr dosfstools openssh os-prober mtools linux-headers linux-lts linux-lts-headers` | |
| 18. `# nano /etc/locale.gen` (uncomment en_US.UTF-8) | |
| 19. `# locale-gen` | |
| 20. Enable `root` logon via `ssh` | |
| 21. `# systemctl enable sshd.service` | |
| 22. `# passwd` (for setting root password) | |
| 23. `# mkdir /boot/EFI` | |
| 24. `# mount /dev/sda1 /boot/EFI` | |
| 25. `# grub-install --target=x86_64-efi --bootloader-id=grub_uefi --recheck` | |
| 26. `# cp /usr/share/locale/en\@quot/LC_MESSAGES/grub.mo /boot/grub/locale/en.mo` | |
| 27. `# grub-mkconfig -o /boot/grub/grub.cfg` | |
| 28. Create swap file: | |
| * `# fallocate -l 2G /swapfile` | |
| * `# chmod 600 /swapfile` | |
| * `# mkswap /swapfile` | |
| * `# echo '/swapfile none swap sw 0 0' | tee -a /etc/fstab` | |
| 29. `$ exit` | |
| 30. `# umount -a` | |
| 31. `# reboot` | |
| ###### Installation procedure (encrypted lvm on EFI): | |
| 1. Use wifi-menu to connect to network | |
| 2. Start ssh `# systemctl start sshd` | |
| 3. Connect to machine via SSH | |
| 4. Visit https://www.archlinux.org/mirrorlist/ on another computer, generate mirrorlist | |
| 5. Edit /etc/pacman.d/mirrorlist on the Arch computer and paste the faster servers | |
| 6. Update package indexes: `# pacman -Syyy` | |
| 7. Create efi partition: | |
| `# fdisk /dev/sda` | |
| * g (to create an empty GPT partition table) | |
| * n | |
| * 1 | |
| * enter | |
| * +300M | |
| * t | |
| * 1 (For EFI) | |
| * w | |
| 8. Create boot partition: | |
| `# fdisk /dev/sda` | |
| * n | |
| * 2 | |
| * enter | |
| * +400M | |
| * w | |
| 9. Create LVM partition: | |
| `# fdisk /dev/sda` | |
| * n | |
| * 3 | |
| * enter | |
| * enter | |
| * t | |
| * 3 | |
| * 31 | |
| * w | |
| 10. `# mkfs.fat -F32 /dev/sda1` | |
| 11. `# mkfs.ext2 /dev/sda2` | |
| 12. Set up encryption | |
| * `# cryptsetup luksFormat /dev/sda3` | |
| * `# cryptsetup open --type luks /dev/sda3 lvm` | |
| 13. Set up lvm: | |
| * `# pvcreate --dataalignment 1m /dev/mapper/lvm` | |
| * `# vgcreate volgroup0 /dev/mapper/lvm` | |
| * `# lvcreate -L 30GB volgroup0 -n lv_root` | |
| * `# lvcreate -L 250GB volgroup0 -n lv_home` | |
| * `# modprobe dm_mod` | |
| * `# vgscan` | |
| * `# vgchange -ay` | |
| 14. `# mkfs.ext4 /dev/volgroup0/lv_root` | |
| 15. `# mkfs.xfs /dev/volgroup0/lv_home` | |
| 16. `# mount /dev/volgroup0/lv_root /mnt` | |
| 17. `# mkdir /mnt/boot` | |
| 18. `# mkdir /mnt/home` | |
| 19. `# mount /dev/sda2 /mnt/boot` | |
| 20. `# mount /dev/volgroup0/lv_home /mnt/home` | |
| 21. `# pacstrap -i /mnt base` | |
| 22. `# genfstab -U -p /mnt >> /mnt/etc/fstab` | |
| 21. `# arch-chroot /mnt` | |
| 22. `# pacman -S base-devel grub efibootmgr dosfstools openssh os-prober mtools linux-headers linux-lts linux-lts-headers` | |
| 23. Edit `/etc/mkinitcpio.conf` and add `encrypt lvm2` in between `block` and `filesystems` | |
| 24. `# mkinitcpio -p linux` | |
| 25. `# mkinitcpio -p linux-lts` | |
| 26. `# nano /etc/locale.gen` (uncomment en_US.UTF-8) | |
| 27. `# locale-gen` | |
| 28. Enable `root` logon via `ssh` | |
| 29. `# systemctl enable sshd.service` | |
| 30. `# passwd` (for setting root password) | |
| 31. Edit `/etc/default/grub`: | |
| add `cryptdevice=<PARTUUID>:volgroup0` to the `GRUB_CMDLINE_LINUX_DEFAULT` line | |
| If using standard device naming, the option will look like this: `cryptdevice=/dev/sda3:volgroup0` | |
| 32. `# mkdir /boot/EFI` | |
| 33. `# mount /dev/sda1 /boot/EFI` | |
| 34. `# grub-install --target=x86_64-efi --bootloader-id=grub_uefi --recheck` | |
| 35. `# cp /usr/share/locale/en\@quot/LC_MESSAGES/grub.mo /boot/grub/locale/en.mo` | |
| 36. `# grub-mkconfig -o /boot/grub/grub.cfg` | |
| 37. Create swap file: | |
| * `# fallocate -l 2G /swapfile` | |
| * `# chmod 600 /swapfile` | |
| * `# mkswap /swapfile` | |
| * `# echo '/swapfile none swap sw 0 0' | tee -a /etc/fstab` | |
| 38. `$ exit` | |
| 39. `# umount -a` | |
| 40. `# reboot` | |
| ###### Installation procedure (lvm with no encryption): | |
| 1. Use wifi-menu to connect to network | |
| 2. Start ssh `# systemctl start sshd` | |
| 3. Connect to machine via SSH | |
| 4. Visit https://www.archlinux.org/mirrorlist/ on another computer, generate mirrorlist | |
| 5. Edit /etc/pacman.d/mirrorlist on the Arch computer and paste the faster servers | |
| 6. Update package indexes: `# pacman -Syyy` | |
| 7. Create efi partition: | |
| `# fdisk /dev/sda` | |
| * g (to create an empty GPT partition table) | |
| * n | |
| * 1 | |
| * enter | |
| * +300M | |
| * t | |
| * 1 (For EFI) | |
| * w | |
| 8. Create LVM partition | |
| `# fdisk /dev/sda` | |
| * n | |
| * 2 | |
| * enter | |
| * enter | |
| * t | |
| * 2 | |
| * 31 | |
| * w | |
| 9. `# mkfs.fat -F32 /dev/sda1` | |
| 10. Set up lvm: | |
| * Non-SSD: `# pvcreate /dev/sda2` | |
| * SSD: `# pvcreate --dataalignment 1m /dev/sda2` | |
| * `# vgcreate volgroup0 /dev/sda2` | |
| * `# lvcreate -L 30GB volgroup0 -n lv_root` | |
| * `# lvcreate -L 250GB volgroup0 -n lv_home` | |
| * `# modprobe dm_mod` | |
| * `# vgscan` | |
| * `# vgchange -ay` | |
| 11. `# mkfs.ext4 /dev/volgroup0/lv_root` | |
| 12. `# mkfs.xfs /dev/volgroup0/lv_home` | |
| 13. `# mount /dev/volgroup0/lv_root /mnt` | |
| 14. `# mkdir /mnt/home` | |
| 15. `# mount /dev/volgroup0/lv_home /mnt/home` | |
| 16. `# pacstrap -i /mnt base` | |
| 17. `# genfstab -U -p /mnt >> /mnt/etc/fstab` | |
| 18. `# arch-chroot /mnt` | |
| 19. `# pacman -S base-devel grub efibootmgr dosfstools openssh os-prober mtools linux-headers linux-lts linux-lts-headers` | |
| 20. Edit `/etc/mkinitcpio.conf` and add `lvm2` in between `block` and `filesystems` | |
| 21. `# mkinitcpio -p linux` | |
| 22. `# mkinitcpio -p linux-lts` | |
| 23. `# nano /etc/locale.gen` (uncomment en_US.UTF-8) | |
| 24. `# locale-gen` | |
| 25. Enable `root` logon via `ssh` | |
| 26. `# systemctl enable sshd.service` | |
| 27. `# passwd` (for setting root password) | |
| 28. `# mkdir /boot/EFI` | |
| 29. `# mount /dev/sda1 /boot/EFI` | |
| 30. `# grub-install --target=x86_64-efi --bootloader-id=grub_uefi --recheck` | |
| 31. `# cp /usr/share/locale/en\@quot/LC_MESSAGES/grub.mo /boot/grub/locale/en.mo` | |
| 32. `# grub-mkconfig -o /boot/grub/grub.cfg` | |
| 33. Create swap file: | |
| * `# fallocate -l 2G /swapfile` | |
| * `# chmod 600 /swapfile` | |
| * `# mkswap /swapfile` | |
| * `# echo '/swapfile none swap sw 0 0' | tee -a /etc/fstab` | |
| 34. `$ exit` | |
| 35. `# umount -a | |
| 36. `# reboot` | |
| ###### Installation procedure (lvm, mbr): | |
| 1. Use wifi-menu to connect to network | |
| 2. Start ssh `# systemctl start sshd` | |
| 3. Connect to machine via SSH | |
| 4. Visit https://www.archlinux.org/mirrorlist/ on another computer, generate mirrorlist | |
| 5. Edit /etc/pacman.d/mirrorlist on the Arch computer and paste the faster servers | |
| 6. Update package indexes: `# pacman -Syyy` | |
| 7. Partition disk, create lvm partition: | |
| `# fdisk /dev/sda` | |
| * o | |
| * enter | |
| * w | |
| * n | |
| * p | |
| * 1 | |
| * enter | |
| * enter | |
| * t | |
| * 1 | |
| * 8E | |
| * w | |
| 8. Create lvm: | |
| * Non-SSD: `# pvcreate /dev/sda1` | |
| * SSD: `# pvcreate --dataalignment 1m /dev/sda1` | |
| * `# vgcreate volgroup0 /dev/sda1` | |
| * `# lvcreate -L 30GB volgroup0 -n lv_root` | |
| * `# lvcreate -L 250GB volgroup0 -n lv_home` | |
| * `# modprobe dm_mod` | |
| * `# vgscan` | |
| * `# vgchange -ay` | |
| 9. `# mkfs.ext4 /dev/volgroup0/lv_root` | |
| 10. `# mkfs.ext4 /dev/volgroup0/lv_home` | |
| 11. `# mount /dev/volgroup0/lv_root /mnt` | |
| 12. `# mkdir /mnt/home` | |
| 13. `# mount /dev/volgroup0/lv_home /mnt/home` | |
| 14. `# pacstrap -i /mnt base` | |
| 15. `# genfstab -U -p /mnt >> /mnt/etc/fstab` | |
| 16. `# arch-chroot /mnt` | |
| 17. `# pacman -S base-devel openssh grub-bios linux-headers linux-lts linux-lts-headers` | |
| 18. Edit `/etc/mkinitcpio.conf` and add `lvm2` in between `block` and `filesystems` | |
| 19. `# mkinitcpio -p linux` | |
| 20. `# mkinitcpio -p linux-lts` | |
| 21. `# nano /etc/locale.gen (uncomment en_US.UTF-8)` | |
| 22. `# locale-gen` | |
| 23. `# ln -s /usr/share/zoneinfo/America/Detroit /etc/localtime` | |
| 24. `# hwclock --systohc --utc` | |
| 25. Enable `root` logon via `ssh` | |
| 26. `# systemctl enable sshd.service` | |
| 27. `# passwd` (for root) | |
| 28. `# grub-install --target=i386-pc --recheck /dev/sda` | |
| 29. `# cp /usr/share/locale/en\@quot/LC_MESSAGES/grub.mo /boot/grub/locale/en.mo` | |
| 30. `# grub-mkconfig -o /boot/grub/grub.cfg` | |
| 31. Create swap file: | |
| * `# fallocate -l 2G /swapfile` | |
| * `# chmod 600 /swapfile` | |
| * `# mkswap /swapfile` | |
| * `# echo '/swapfile none swap sw 0 0' | tee -a /etc/fstab` | |
| 32. `$ exit` | |
| 33. `# umount /mnt/home` | |
| 34. `# umount /mnt` | |
| 35. `# reboot` | |
| ###### Post installation steps: | |
| 1. Fix GNOME app issues: `# localectl set-locale LANG="en_US.UTF-8"` | |
| 2. Add to `fstab`: | |
| `tmpfs /tmp tmpfs nodev,nosuid,size=2G 0 0` | |
| 3. If ssd, add `discard` to `fstab`. Example: | |
| `UUID=<UUID> / ext4 defaults,noatime,discard 0 2` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Enable Port Forwarding on Virtual Box | |
| https://stackoverflow.com/questions/5906441/how-to-ssh-to-a-virtualbox-guest-externally-through-a-host | |
| boot iso | |
| change password of root | |
| passwd | |
| systemctl enable sshd | |
| systemctl start sshd | |
| on your terminal connect to ssh of your vm | |
| ssh -p 3022 root@localhost | |
| vim /etc/pacman.d/mirrorlist | |
| add this mirror list and delete everything | |
| #Server = http://mirror.rise.ph/archlinux/$repo/os/$arch | |
| timedatectl set-ntp true | |
| # Check Device | |
| lsblk | |
| # Partition the disks | |
| fdisk /dev/sda - create one partition | |
| press n (new) | |
| press p (primary) | |
| press enter (default) | |
| press enter (default) | |
| press enter (default) | |
| press w (write) | |
| mkfs.btrfs -L "Arch" /dev/sda1 | |
| mount /dev/sda1 /mnt | |
| cd /mnt | |
| btrfs subvolume create ROOT | |
| cd .. | |
| umount /dev/sda1 | |
| mount -o ssd,compress=lzo,noatime,subvol=ROOT /dev/sda1 /mnt | |
| cd /mnt | |
| # Add All Your Subvolumes under ROOT | |
| btrfs subvolume create home | |
| btrfs subvolume create root | |
| btrfs subvolume create etc | |
| btrfs subvolume create mnt | |
| btrfs subvolume create opt | |
| btrfs subvolume create var | |
| btrfs subvolume create tmp | |
| cd .. | |
| # Install All Dependencies | |
| pacstrap -i /mnt base base-devel btrfs-progs vim networkmanager grub-bios open-ssh cronie | |
| genstab -U -p /mnt >> /mnt/etc/fstab | |
| # verify if there is a wrong partition | |
| cat /mnt/etc/fstab | |
| arch-chroot /mnt | |
| # note to boot again using iso you need to | |
| # mount /dev/sda1 | |
| # arch-chroot /mnt /bin/bash | |
| # so you can fix any error | |
| # Set Time Zone | |
| ln -sf /usr/share/zoneinfo/Asia/Manila /etc/localtime | |
| hwclock --systohc | |
| vim /etc/locale.gen | |
| # uncomment this | |
| # en_US.UTF-8 UTF-8 | |
| # Generate | |
| locale-gen | |
| # Network Configuration | |
| echo "archlinux" > /etc/hostname | |
| # Setting Host | |
| # ipadd domain hostname | |
| 127.0.0.1 localhost.localdomain localhost | |
| ::1 localhost.localdomain localhost | |
| 127.0.0.1 localhost.localdomain archlinux | |
| # If the system has a permanent IP address, it should be used instead of 127.0.1.1 | |
| # Install Grub Boot Loader | |
| grub-install /dev/sda | |
| # will check this out | |
| # if still needed | |
| mkinitcpio -p linux | |
| # only needed in RAID or with encryption | |
| # change password | |
| # ENABLE NETWORK MANAGER | |
| systemctl enable NetworkManager | |
| # ENABLE OPENSSH | |
| systemctl enable sshd | |
| # ENABLE CRON JOBS | |
| systemctl enable cronie | |
| passwd | |
| exit | |
| umount -R /mnt | |
| # if cannot unmount use -l | |
| reboot | |
| # Adding new User | |
| # Added to the group Wheel | |
| useradd -m -g users -G wheel -s /bin/bash username | |
| passwd username | |
| vim /etc/sudoers | |
| # uncomment | |
| # allows you to use sudo without entering password | |
| # %wheel ALL=(ALL)NOPASSWD: ALL | |
| # Avoid re-entering password when already input on another tty | |
| Defaults !!tty_tickets | |
| # Allow user to run serveral important commands like shutdown | |
| %wheel ALL=(ALL) NOPASSWD: /usr/bin/shutdown,/usr/bin/reboot,/usr/bin/systemctl suspend,/usr/bin/wifi-menu,/usr/bin/mount,/usr/bin/umount,/usr/bin/pacman -Syu,/usr/bin/pacman -Syyu,/usr/bin/packer -Syu,/usr/bin/packer -Syyu,/usr/bin/systemctl restart NetworkManager,/usr/bin/rc-service NetworkManager restart,/usr/bin/pacman -Syyu --noconfirm,/usr/bin/loadkeys,/usr/bin/yay,/usr/bin/pacman -Syyuw --noconfirm" | |
| # Then we need to login in our User Account | |
| # Install Graphical Interface | |
| sudo pacman -S pulseaudio pulseaudio-alsa | |
| sudo pacman -S xorg xinit | |
| # another one? | |
| sudo pacman -S xorg-server xorg-xinit | |
| # choose the correct graphic card for your computer | |
| echo "exec startkde" > ~/.xinitrc | |
| # for i3 | |
| echo "exec i3" > ~/.xinitrc | |
| sudo pacman -S plasma-desktop | |
| # install other packages you need | |
| # firefox , vscode, vim, google-chrome, php , nginx, composer ,nodejs,redis, bleachbit, tranmission , screenkey, android studio | |
| # install login manager | |
| sudo pacman -S sddm | |
| sudo systemctl enable sddm | |
| reboot | |
| # 10 things to do after fresh install | |
| sudo pacman -S linux-headers (needed by dropbox) | |
| # to check if your using lts | |
| uname -r | |
| # then remove non LTS kernel | |
| sudo pacman -Rs linux | |
| # install micro code | |
| # for intel | |
| sudo pacman -S intel-ucode | |
| # for amd | |
| sudo pacman -S linux-firmware | |
| #configure grub | |
| sudo grub-mkconfig -o /boot/grub/grub.cfg | |
| # Disable Grub Delay | |
| vim /etc/default/grub | |
| # achieve the fastest possible boot: | |
| GRUB_FORCE_HIDDEN_MENU="true" | |
| Then put file 31_hold_shift to /etc/grub.d/. | |
| Download 31_hold_shift https://goo.gl/nac6Kp | |
| Make it executable, and regenerate the grub configuration: | |
| sudo chmod a+x /etc/grub.d/31_hold_shift | |
| sudo grub-mkconfig -o /boot/grub/grub.cfg | |
| #install firewall | |
| sudo pacman -S ufw | |
| sudo ufw enable | |
| #Check its status: | |
| sudo ufw status verbose | |
| sudo systemctl enable ufw | |
| # Remove Orphans packages | |
| sudo pacman -Rns $(pacman -Qtdq) | |
| sudo pacman-optimize | |
| # Check for Errors | |
| sudo systemctl --failed | |
| sudo journalctl -p 3 -xb | |
| # Backup System | |
| sudo rsync -aAXvP --delete --exclude=/dev/* --exclude=/proc/* --exclude=/sys/* --exclude=/tmp/* --exclude=/run/* --exclude=/mnt/* --exclude=/media/* --exclude=/lost+found --exclude=/home/.ecryptfs / /mnt/backupDestination/ | |
| # set fonts manually | |
| ~/.config/fontconfig/fonts.conf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment