Skip to content

Instantly share code, notes, and snippets.

@tjcim
Last active October 13, 2019 04:16
Show Gist options
  • Save tjcim/86e553532b37d78ad76505ac68fe5ad5 to your computer and use it in GitHub Desktop.
Save tjcim/86e553532b37d78ad76505ac68fe5ad5 to your computer and use it in GitHub Desktop.
Archlinux - GPT and Grub2 on one disk
# Download and verify iso
gpg --verify archlinux-2017.01.01-dual.iso.sig
# Burn iso to USB
dd if=archlinux-*.iso of=/dev/sdX bs=16M && sync
# Boot usb image and set root passwd (this is a temp password used for install only)
passwd
# Ensure time is correct
timedatectl set-ntp true
# Start ssh to connect using another computer
systemctl start sshd.service
# Get IP address
ip addr
# Log into computer from another machine using root user
ssh root@<ip address>
# This gist is designed to work with one harddrive - sda
# I will have a bios boot partition (1M), swap (16G), and the rest will be mounted to /
gdisk /dev/sda
o<enter> Y<enter>
n<enter> 1<enter> <enter> +1M<enter> ef02<enter>
n<enter> 2<enter> <enter> +16G<enter> 8200<enter>
n<enter> 3<enter> <enter> <enter> 8300<enter>
# Verify partitions
p<enter>
# Write partitions
w<enter> Y<enter>
# Format partitions
mkswap /dev/sda2
swapon /dev/sda2
mkfs.ext4 /dev/sda3
# Mount the volumes
mount /dev/sda3 /mnt
# Check pacman.d mirrolist and comment out any that you do not want to use
vim /etc/pacman.d/mirrorlist
# Install Arch
pacstrap /mnt base base-devel vim linux linux-firmware
genfstab -U /mnt >> /mnt/etc/fstab # The -U option pulls in all the correct UUIDs for your mounted filesystems.
cp /etc/pacman.d/mirrorlist /mnt/etc/pacman.d/mirrorlist
arch-chroot /mnt
unlink /etc/localtime
ln -s /usr/share/zoneinfo/US/Mountain /etc/localtime
hwclock --systohc
sed -i '/#en_US.UTF-8 UTF-8/s/^#//' /etc/locale.gen
locale-gen
echo "LANG=en_US.UTF-8" > /etc/locale.conf
# Assign your hostname
echo "ew" > /etc/hostname
echo "127.0.0.1 localhost" >> /etc/hosts
echo "::1 localhost" >> /etc/hosts
echo "10.0.0.7 ew.tjc.im ew" >> /etc/hosts
# Enable dhcpcd
systemctl enable dhcpcd.service
# Set root password
passwd
# Create user
useradd -m -G wheel -s /bin/bash trevor
passwd trevor
visudo # Uncomment line: '%wheel ALL=(ALL) ALL'
pacman -Sy grub
grub-install --target=i386-pc /dev/sda
grub-mkconfig -o /boot/grub/grub.cfg
# Exit Your New Arch System
exit
# Unmount all partitions
umount -R /mnt
swapoff -a
# Reboot
reboot
# Login locally to the machine and install openssh
sudo pacman -S openssh python
# Start the SSH server
sudo systemctl start sshd.socket
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment