install-arch

 avatar
unknown
sh
10 months ago
2.8 kB
1
Indexable
#!/bin/bash

# Exit script on any error
set -e

# Update system clock
timedatectl set-ntp true

# Partition the disk (replace /dev/sda with your disk identifier)
(
echo g # Create a new GPT partition table
echo n # Create a new partition (root)
echo 1 # Partition number
echo   # First sector (Accept default: 2048)
echo +20G # Last sector (20GB root partition)
echo n # Create a new partition (swap)
echo 2 # Partition number
echo   # First sector (Accept default: start after root partition)
echo +2G # Last sector (2GB swap partition)
echo n # Create a new partition (home)
echo 3 # Partition number
echo   # First sector (Accept default: start after swap partition)
echo   # Last sector (Accept default: remaining disk space)
echo w # Write changes
) | fdisk /dev/sda

# Format the partitions
mkfs.ext4 /dev/sda1 # Root partition
mkfs.ext4 /dev/sda3 # Home partition
mkswap /dev/sda2    # Swap partition

# Mount the file systems
mount /dev/sda1 /mnt
mkdir /mnt/home
mount /dev/sda3 /mnt/home
swapon /dev/sda2

# Select mirrors
reflector --country Mexico --age 12 --sort rate --save /etc/pacman.d/mirrorlist

# Install essential packages
pacstrap /mnt base linux linux-firmware vim

# Generate fstab
genfstab -U /mnt >> /mnt/etc/fstab

# Change root into the new system
arch-chroot /mnt

# Set the time zone (adjust to your region and city)
ln -sf /usr/share/zoneinfo/America/Mexico_City /etc/localtime
hwclock --systohc

# Localization
echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen
locale-gen
echo "LANG=en_US.UTF-8" > /etc/locale.conf
export LANG=en_US.UTF-8

# Network configuration
echo "archlinux" > /etc/hostname
echo "
127.0.0.1	localhost
::1		localhost
127.0.1.1	archlinux.localdomain	archlinux
" > /etc/hosts

# Install and configure network manager
pacman -Syu --noconfirm networkmanager
systemctl enable NetworkManager

# Set root password
echo "Set root password"
passwd

# Bootloader installation
pacman -Syu --noconfirm grub
grub-install /dev/sda
grub-mkconfig -o /boot/grub/grub.cfg

# Exit chroot
exit

# Unmount partitions and reboot
umount -R /mnt
swapoff -a
reboot

# After reboot, login as root and proceed with the rest of the installation

# Create a new user (replace 'your_username' with your desired username)
useradd -m -G wheel -s /bin/bash rwcephei
echo "Set password for new user"
passwd rwcephei
echo "%wheel ALL=(ALL) ALL" >> /etc/sudoers

# Install Xorg
pacman -Syu --noconfirm xorg

# Install desktop environment (GNOME in this example)
pacman -Syu --noconfirm gnome gnome-extra
systemctl enable gdm

# Install additional packages
pacman -Syu --noconfirm firefox

# Enable and start graphical interface
systemctl enable gdm
systemctl start gdm

# Install Hyper-V packages for enhanced performance
pacman -Syu --noconfirm hyperv

echo "Installation complete! Rebooting..."
reboot
Editor is loading...
Leave a Comment