Files
the_information_nexus/tech_docs/linux/arch_deploy.md

4.6 KiB

Theme: Space Exploration

Username: astronaut

Password: stardust123 (Note: Use a strong password in a real setup)

Hostname: spaceship

Domain Name: galaxy.local

Step-by-Step Opinionated Arch Linux Setup with Space Theme

Step 1: Verify Boot Mode

Ensure your system is booting in UEFI mode:

ls /sys/firmware/efi/efivars

If this directory exists, you are in UEFI mode.

Step 2: Partition the Disk

Format and mount the partitions:

mkfs.fat -F32 /dev/sda1  # EFI partition
mkswap /dev/sda2         # Swap partition
mkfs.ext4 /dev/sda3      # Root partition

mount /dev/sda3 /mnt
mkdir /mnt/boot
mount /dev/sda1 /mnt/boot
swapon /dev/sda2

Step 3: Install the Base System

Install the base packages:

pacstrap /mnt base linux linux-firmware vim

Step 4: Generate fstab

Generate the fstab file:

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

Step 5: Chroot into the New System

Change root into the new system:

arch-chroot /mnt

Step 6: Set Locale and Timezone

  1. Set locale:

    • Edit /etc/locale.gen to uncomment your locale (e.g., en_US.UTF-8):
      vim /etc/locale.gen
      
    • Generate the locale:
      locale-gen
      
  2. Set timezone:

    ln -sf /usr/share/zoneinfo/America/New_York /etc/localtime
    hwclock --systohc
    

Step 7: Set Hostname and Hosts

  1. Set hostname:

    echo "spaceship.galaxy.local" > /etc/hostname
    
  2. Edit /etc/hosts:

    vim /etc/hosts
    

    Add the following lines:

    127.0.0.1	localhost
    ::1		localhost
    127.0.1.1	spaceship.galaxy.local	spaceship
    

Step 8: Set Root Password

Set a strong password for the root user:

passwd

For this guide, we'll use stardust123 as the root password.

Step 9: Create a Regular User Account

Create a user account and add it to the sudo group:

useradd -m astronaut
usermod -aG sudo astronaut
passwd astronaut

For this guide, we'll use stardust123 as the user password.

Step 10: Install Bootloader

Install GRUB for UEFI:

pacman -S efibootmgr grub
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=ArchLinux
grub-mkconfig -o /boot/grub/grub.cfg

Step 11: Exit Chroot and Reboot

Exit the chroot environment and reboot:

exit
umount -R /mnt
reboot

Post-Installation Configuration

Step 12: Secure SSH

  1. Install SSH:

    sudo pacman -S openssh
    
  2. Configure SSH:

    • Open the SSH configuration file:
      sudo nano /etc/ssh/sshd_config
      
    • Make the following changes:
      • Change PermitRootLogin to no.
      • Change PasswordAuthentication to no.
      • Add PubkeyAuthentication yes.
      • Add AuthorizedKeysFile .ssh/authorized_keys.
    • Save the file and restart the SSH service:
      sudo systemctl enable sshd
      sudo systemctl start sshd
      
  3. Set Up SSH Keys:

    • Generate an SSH key pair on your client machine:
      ssh-keygen -t rsa -b 4096
      
    • Copy the public key to your Arch Linux server:
      ssh-copy-id astronaut@your_server_ip
      

Step 13: Network Configuration

  1. Install NetworkManager:

    sudo pacman -S networkmanager
    
  2. Enable NetworkManager:

    sudo systemctl enable NetworkManager
    sudo systemctl start NetworkManager
    
  3. Configure DHCP for Ethernet:

    • Ensure the interface enp0s25 (or whatever your interface is named) is set to use DHCP:
      nmcli d
      nmcli con mod enp0s25 ipv4.method auto
      nmcli con up enp0s25
      

Step 14: Install a Minimal Desktop Environment (Optional)

If you want a minimal desktop environment, consider installing Xorg and a lightweight window manager like i3 or dwm.

  1. Install Xorg:

    sudo pacman -S xorg-server xorg-xinit
    
  2. Install a Window Manager:

    sudo pacman -S i3
    
  3. Configure Xinit:

    • Create a .xinitrc file in your home directory:
      echo "exec i3" > ~/.xinitrc
      
  4. Start X:

    startx
    

Final Notes

  • Firewall: Consider setting up a firewall using ufw or firewalld.
  • Regular Updates: Regularly update your system using sudo pacman -Syu.
  • Backup: Regularly back up important data.

This setup guide provides a secure, minimal, and opinionated configuration for Arch Linux with a fun space-themed scheme. Adjustments can be made based on your specific needs and preferences.