9.0 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
Absolutely, minimizing direct interaction with the device is a great idea, especially for convenience and security. Let's prioritize getting SSH set up quickly so you can manage your system remotely. We'll follow through with the initial setup and then immediately configure SSH to ensure you can access your system remotely as soon as possible.
Step-by-Step Opinionated Arch Linux Setup with Quick SSH Access
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 openssh
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
-
Set locale:
- Edit
/etc/locale.gento uncomment your locale (e.g.,en_US.UTF-8):vim /etc/locale.gen - Generate the locale:
locale-gen
- Edit
-
Set timezone:
ln -sf /usr/share/zoneinfo/America/New_York /etc/localtime hwclock --systohc
Step 7: Set Hostname and Hosts
-
Set hostname:
echo "spaceship.galaxy.local" > /etc/hostname -
Edit
/etc/hosts:vim /etc/hostsAdd 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: Configure SSH
-
Configure SSH:
- Open the SSH configuration file:
sudo nano /etc/ssh/sshd_config - Make the following changes:
- Change
PermitRootLogintoprohibit-password. - Change
PasswordAuthenticationtono. - Add
PubkeyAuthentication yes. - Add
AuthorizedKeysFile .ssh/authorized_keys.
- Change
- Save the file and restart the SSH service:
sudo systemctl enable sshd sudo systemctl start sshd
- Open the SSH configuration file:
-
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
- Generate an SSH key pair on your client machine:
Step 12: Exit Chroot and Reboot
Exit the chroot environment and reboot:
exit
umount -R /mnt
reboot
Post-Reboot Configuration
Step 13: Verify SSH Access
After rebooting, try to SSH into your new Arch Linux system from another machine:
ssh astronaut@your_server_ip
Replace your_server_ip with the actual IP address of your Arch Linux system.
Step 14: Network Configuration
-
Install NetworkManager:
sudo pacman -S networkmanager -
Enable NetworkManager:
sudo systemctl enable NetworkManager sudo systemctl start NetworkManager -
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
- Ensure the interface
Final Notes
- Firewall: Consider setting up a firewall using
ufworfirewalld. - Regular Updates: Regularly update your system using
sudo pacman -Syu. - Backup: Regularly back up important data.
By following these steps, you should have a secure and accessible Arch Linux system up and running quickly. You can now manage your system remotely via SSH, minimizing the need for direct interaction.
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
-
Set locale:
- Edit
/etc/locale.gento uncomment your locale (e.g.,en_US.UTF-8):vim /etc/locale.gen - Generate the locale:
locale-gen
- Edit
-
Set timezone:
ln -sf /usr/share/zoneinfo/America/New_York /etc/localtime hwclock --systohc
Step 7: Set Hostname and Hosts
-
Set hostname:
echo "spaceship.galaxy.local" > /etc/hostname -
Edit
/etc/hosts:vim /etc/hostsAdd 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
-
Install SSH:
sudo pacman -S openssh -
Configure SSH:
- Open the SSH configuration file:
sudo nano /etc/ssh/sshd_config - Make the following changes:
- Change
PermitRootLogintono. - Change
PasswordAuthenticationtono. - Add
PubkeyAuthentication yes. - Add
AuthorizedKeysFile .ssh/authorized_keys.
- Change
- Save the file and restart the SSH service:
sudo systemctl enable sshd sudo systemctl start sshd
- Open the SSH configuration file:
-
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
- Generate an SSH key pair on your client machine:
Step 13: Network Configuration
-
Install NetworkManager:
sudo pacman -S networkmanager -
Enable NetworkManager:
sudo systemctl enable NetworkManager sudo systemctl start NetworkManager -
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
- Ensure the interface
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.
-
Install Xorg:
sudo pacman -S xorg-server xorg-xinit -
Install a Window Manager:
sudo pacman -S i3 -
Configure Xinit:
- Create a
.xinitrcfile in your home directory:echo "exec i3" > ~/.xinitrc
- Create a
-
Start X:
startx
Final Notes
- Firewall: Consider setting up a firewall using
ufworfirewalld. - 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.