Skip to content

Instantly share code, notes, and snippets.

@flyingluscas
Last active June 18, 2021 16:36
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save flyingluscas/7e873273098efd38597df4b5d24179c4 to your computer and use it in GitHub Desktop.
Save flyingluscas/7e873273098efd38597df4b5d24179c4 to your computer and use it in GitHub Desktop.

Instalação do arch linux com full disk encription LVM on LUKS

Garantir se fez o boot utilizando EFI

ls /sys/firmware/efi # Deve haver arquivos nesse folder

Checar conexão com a internet.

ping 1.1.1.1

Caso não conseguir pingar Cloudflare(1.1.1.1) ou Google(8.8.8.8), provavelmente você precisará configurar o acesso wireless. (https://wiki.archlinux.org/index.php/installation_guide#Connect_to_the_Internet) Particionar o disco da seguinte forma - 512 MB para sdX1, todo o resto em sdX2

gdisk /dev/sdX # onde X é a letra que define o seu disco
o<enter>
y<enter>
n<enter>
<enter>
<enter>
+512M<enter>
EF00<enter>
n<enter>
<enter>
<enter>
8e00<enter>
w<enter>

Setup de criptografia e LVM

cryptsetup luksFormat /dev/sdX2 #crie um password para a criptografia
cryptsetup open --type luks /dev/sdX2 cryptolvm
pvcreate /dev/mapper/cryptolvm
vgcreate vg0 /dev/mapper/cryptolvm
lvcreate -L 8G vg0 -n swap
lvcreate -l 100%FREE vg0 -n root
mkfs.ext4 /dev/mapper/vg0-root
mount /dev/mapper/vg0-root /mnt

Setup da partição de boot

mkfs.fat -F32 /dev/sdX1
mkdir /mnt/boot/
mount /dev/sdX1 /mnt/boot

Setup do Swap

mkswap /dev/mapper/vg0-swap
swapon /dev/mapper/vg0-swap

Configurando o mirrorlist e instalando os pacotes base

cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak
rankmirrors/etc/pacman.d/mirrorlist.bak > /etc/pacman.d/mirrorlist #deixe rodar por uns 10-20 segundos e cancele com ctrl+c	
pacstrap /mnt base base-devel
genfstab -p /mnt >> /mnt/etc/fstab
arch-chroot /mnt
pacman -S gnome networkmanager sudo vim
rm /etc/localtime
ln -s /usr/share/zoneinfo/America/Sao_Paulo /etc/localtime
hwclock --systohc --utc
passwd #setar o password de root
vim /etc/locale.gen #tirar o comentário de en_US.UTF-8 UTF-8
locale-gen
locale > /etc/locale.conf
vim /etc/hostname #inserir o hostname
vim /etc/mkinitcpio.conf 
#HOOKS=(...keyboard encrypt lvm2 filesystems ...)
mkinitcpio -p linux

Configurando o bootloader com o systemd

bootctl --path=/boot/ install
cd /boot/loader
vim loader.conf

Salvar o arquivo loader.conf com as 2 linhas abaixo:

timeout 3
default arch
cd entries
vim arch.conf

Inserir no arquivo arch.conf as 4 linhas abaixo:

title Arch Linux
linux /vmlinuz-linux
initrd /initramfs-linux.img
options cryptdevice=UUID=<sdX2 UUID>:cryptolvm root=/dev/mapper/vg0-root rw

Nesse momento, não salve e feche o arquivo arch.conf. Continuando no vim, pular uma linha e rodar o seguinte comando no vim <esc> :r !blkid /dev/sdX2 pegar o valor do UUID entre àspas e colar no lugar do <sdX2 UUID> sem àspas e depois deletar o que restou do output do comando deixando somente as 4 linhas (title,linux,initrd e options)

exit
umount -R /mnt
reboot
systemctl enable gdm NetworkManager
useradd -m -G wheel <your-username>
passwd <your-username> # and set your password
passwd # set root password
vim /etc/sudoers # and uncomment wheel permissions
systemctl start gdm NetworkManager

Após executar esses passos, voce deve ser apresentado a tela de login do GNOME.

Eu ainda instalo mais algumas coisinhas úteis:

pacman -S gst-plugins-good gst-pugins-bad gst-plugins-ugly gst-libav # various codecs
pacman -S gnome-tweak-tool # change system themes, font size, etc
pacman -S gnome-boxes # better than virtual box

INFO: É possível colocar todos pacotes em um so pacman -S, não é necessário rodar linha a linha se quiser ter todos os programas

Outra coisa legal no Arch Linux é o Arch User Repository (ou AUR). Pra instalar um wrapper do pacman que também instala coisas do AUR (necessário pra instalar o chrome):

cd /tmp
curl -L https://aur.archlinux.org/cgit/aur.git/snapshot/package-query.tar.gz -o package-query.tar.gz
curl -L https://aur.archlinux.org/cgit/aur.git/snapshot/yaourt.tar.gz -o yaourt.tar.gz
tar xvzf package-query.tar.gz
tar xvzf yaourt.tar.gz
cd package-query
makepkg -si
cd ../yaourt
makepkg -si

A partir disso, vc pode sempre usar o yaourt. Para instalar o Google Chrome:

yaourt -S --noconfirm google-chrome

Tem mais coisas úteis no AUR:

yaourt -S --noconfirm wps-office ttf-wps-fonts # a microsoft office compatible clone
yaourt -S --noconfirm telegram-desktop-bin # telegram desktop client
yaourt -S --noconfirm tilix # the best terminal application
yaourt -S --noconfirm zoom # the video conference tool
yaourt -S --noconfirm nasc-git # text editor like calculator
yaourt -S --noconfirm watchman # useful for improving webpack file watcher
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment