Skip to content

Instantly share code, notes, and snippets.

@omauriciofala
Last active December 20, 2023 14:55
Show Gist options
  • Save omauriciofala/16e038a94e5cd9a4f0bf57d8961ee7a9 to your computer and use it in GitHub Desktop.
Save omauriciofala/16e038a94e5cd9a4f0bf57d8961ee7a9 to your computer and use it in GitHub Desktop.
uaiso-install.sh
#!/bin/bash
# Defina as variáveis personalizadas
HOSTNAME="archlinux"
USERNAME="seu_usuario"
PASSWORD="sua_senha"
DISK="/dev/sda"
# Particionamento do disco
parted --script $DISK mklabel gpt
parted --script $DISK mkpart primary 1MiB 512MiB
parted --script $DISK set 1 esp on
parted --script $DISK mkpart primary 512MiB 60GB
parted --script $DISK mkpart primary 60GB 100%
mkfs.vfat -F32 ${DISK}1
mkfs.btrfs ${DISK}2
mkfs.btrfs ${DISK}3
mount ${DISK}2 /mnt
btrfs subvolume create /mnt/root
umount /mnt
# Montar o sistema de arquivos
mount -o noatime,compress=zstd,space_cache,subvol=root ${DISK}2 /mnt
mkdir -p /mnt/home
mount -o noatime,compress=zstd,space_cache,subvol=home ${DISK}3 /mnt/home
mkdir -p /mnt/boot/efi
mount ${DISK}1 /mnt/boot/efi
# Configurar o fuso horário
ln -sf /usr/share/zoneinfo/America/Sao_Paulo /mnt/etc/localtime
arch-chroot /mnt hwclock --systohc
# Configurar o idioma
echo "pt_BR.UTF-8 UTF-8" >> /mnt/etc/locale.gen
arch-chroot /mnt locale-gen
echo "LANG=pt_BR.UTF-8" > /mnt/etc/locale.conf
# Configurar o layout do teclado
echo "KEYMAP=br-abnt2" > /mnt/etc/vconsole.conf
# Configurar o hostname
echo "$HOSTNAME" > /mnt/etc/hostname
echo -e "127.0.0.1\tlocalhost\n::1\t\tlocalhost\n127.0.1.1\t$HOSTNAME.localdomain\t$HOSTNAME" >> /mnt/etc/hosts
# Instalar o sistema base
arch-chroot /mnt pacstrap /mnt base base-devel
# Gerar o arquivo fstab
genfstab -U /mnt >> /mnt/etc/fstab
# Configurar a senha do root
arch-chroot /mnt bash -c "echo 'root:$PASSWORD' | chpasswd"
# Criar um novo usuário
arch-chroot /mnt useradd -m -G wheel -s /bin/bash $USERNAME
arch-chroot /mnt bash -c "echo '$USERNAME:$PASSWORD' | chpasswd"
# Habilitar o acesso do sudo para o grupo wheel
arch-chroot /mnt sed -i '/%wheel ALL=(ALL) ALL/s/^#//' /etc/sudoers
# Instalar o sistema base
arch-chroot /mnt pacstrap /mnt base base-devel git
# Configurar o gerenciador de pacotes yay
arch-chroot /mnt sudo -u $USERNAME git clone https://aur.archlinux.org/yay.git /tmp/yay
arch-chroot /mnt bash -c "cd /tmp/yay && sudo -u $USERNAME makepkg -si --noconfirm"
arch-chroot /mnt rm -rf /tmp/yay
# Instalar pacotes adicionais, incluindo o KDE Plasma
arch-chroot /mnt sudo -u $USERNAME yay -Syu --noconfirm plasma-desktop sddm sddm-kcm
# Ativar serviços
arch-chroot /mnt systemctl enable sddm
echo "A instalação do Arch Linux com o ambiente de desktop Plasma foi concluída. Por favor, reinicie o sistema."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment