Created
December 10, 2024 04:21
-
-
Save perseoq/7c808a6466ee3d3b64b794b4d0ef27eb to your computer and use it in GitHub Desktop.
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
| #!/bin/bash | |
| # Variables | |
| DISK="/dev/sdX" # Reemplaza con tu disco (ej. /dev/sda) | |
| EFI_PART="${DISK}1" | |
| SWAP_PART="${DISK}2" | |
| ROOT_PART="${DISK}3" | |
| HOSTNAME="archlinux" | |
| LOCALE="es_MX.UTF-8" | |
| TIMEZONE="America/Mexico_City" | |
| ROOT_PASSWORD="123456a" | |
| # Paso 1: Configuración inicial | |
| echo "Configurando teclado y conexión a internet..." | |
| loadkeys la-latin1 | |
| echo "Conecta a Internet usando iwctl (se abrirá una consola interactiva)" | |
| iwctl | |
| # Paso 2: Particionado | |
| echo "Particionando el disco..." | |
| parted -s $DISK mklabel gpt | |
| parted -s $DISK mkpart ESP fat32 1MiB 513MiB | |
| parted -s $DISK set 1 esp on | |
| parted -s $DISK mkpart primary linux-swap 513MiB 8705MiB | |
| parted -s $DISK mkpart primary ext4 8705MiB 100% | |
| # Formatear particiones | |
| mkfs.fat -F32 $EFI_PART | |
| mkswap $SWAP_PART | |
| swapon $SWAP_PART | |
| mkfs.ext4 $ROOT_PART | |
| # Montar particiones | |
| mount $ROOT_PART /mnt | |
| mkdir -p /mnt/boot | |
| mount $EFI_PART /mnt/boot | |
| # Paso 3: Instalación base | |
| echo "Instalando el sistema base..." | |
| pacstrap /mnt base linux linux-firmware | |
| # Configuración del sistema | |
| echo "Generando fstab..." | |
| genfstab -U /mnt >> /mnt/etc/fstab | |
| echo "Configurando sistema base..." | |
| arch-chroot /mnt /bin/bash <<EOF | |
| # Zona horaria | |
| ln -sf /usr/share/zoneinfo/$TIMEZONE /etc/localtime | |
| hwclock --systohc | |
| # Localización | |
| echo "$LOCALE UTF-8" >> /etc/locale.gen | |
| locale-gen | |
| echo "LANG=$LOCALE" > /etc/locale.conf | |
| # Hostname | |
| echo "$HOSTNAME" > /etc/hostname | |
| echo -e "127.0.0.1\tlocalhost\n::1\tlocalhost\n127.0.1.1\t$HOSTNAME.localdomain $HOSTNAME" > /etc/hosts | |
| # Contraseña de root | |
| echo "root:$ROOT_PASSWORD" | chpasswd | |
| # Instalación de paquetes | |
| echo "Instalando paquetes esenciales..." | |
| pacman -S --noconfirm grub efibootmgr networkmanager git curl base-devel python python-virtualenv mariadb gnome gnome-tweaks firefox clang cmake make autoconf automake gcc g++ jdk-openjdk | |
| # Configuración de GRUB | |
| grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB | |
| grub-mkconfig -o /boot/grub/grub.cfg | |
| # Habilitar servicios | |
| systemctl enable NetworkManager | |
| systemctl enable gdm | |
| EOF | |
| # Paso 4: Finalizar | |
| echo "Saliendo del entorno chroot y desmontando particiones..." | |
| umount -R /mnt | |
| swapoff $SWAP_PART | |
| echo "¡Instalación completa! Reinicia el sistema." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment