Install Arch Linux on ESX 5.5
December 24, 2013
I have been meaning to delve into Linux with Arch for a while. I’ve been using a VM in ESX to learn the install process. The installation has been pretty easy maybe because I have spent a fair number of years using Linux. The Arch wiki is an awesome resource and one mistake I keep making is not reading the whole page. This causes many headaches that could be avoided if I didn’t just gloss over the information.
Anyways, I wanted to provide a simple step-by-step tutorial to serve as a quick checklist. Remember that these steps can quickly get out of date as Arch moves fast. So always reference the Arch wiki first. Here are the major steps.
- Download Arch installer
- Create VM
- Boot VM and install Arch
I downloaded the dual 2013.12.01 version of the installer: archlinux-2013.12.01-dual.iso. The VM I created was of “type” Red Hat Enterprise Linux 6 (64-bit) and had 2 dual-core CPUs, 2GB memory, 100GB disk, and EFI was enabled. I attached the installer ISO and started the VM. These instructions begin from when you get the root console after boot up.
Initial Steps
Check to make sure EFI is recognized and working.
efivar -l
I didn’t have DHCP running so instead used static IP. Find the name of your NIC; mine was ens32.
ip link
Setup IP address and gateway
ip addr add 192.168.0.55/24 dev ens32
ip route add default via 192.168.0.1
Configure DNS.
echo "nameserver 8.8.8.8" >> /etc/resolv.conf
echo "search codeghar.com" >> /etc/resolv.conf
Disk Partitioning
Get the name of the disk. It was sda in my case.
lsblk
I used LVM because I wanted to learn a bit more about it. I also prefer to have a single root partition because it makes things easier for me. I used parted to partition my disk into four partitions: 1 for boot and 3 for root.
parted /dev/sda print
parted /dev/sda mklabel gpt
parted /dev/sda mkpart primary 1049KB 2GB
parted /dev/sda mkpart primary 2GB 19GB
parted /dev/sda mkpart primary 19GB 49GB
parted /dev/sda mkpart primary 49GB 99GB
parted /dev/sda set 1 boot on
parted /dev/sda set 2 lvm on
parted /dev/sda set 3 lvm on
parted /dev/sda set 4 lvm on
parted /dev/sda print
lsblk
LVM
pvdisplay
pvcreate /dev/sda2
pvcreate /dev/sda3
pvdisplay
vgdisplay
vgcreate vgcodeghar /dev/sda2
vgextend vgcodeghar /dev/sda3
vgdisplay
lvdisplay
lvcreate -L 25G vgcodeghar -n lvroot
lvdisplay
modprobe dm-mod
vgscan
vgchange -ay
Format the first partition as FAT32 because we’ll use it for /boot and EFI requires(?) the boot partition to be FAT32.
mkfs.fat -F32 /dev/sda1
mkfs.ext4 /dev/mapper/vgcodeghar-lvroot
Base Install
mount /dev/mapper/vgcodeghar-lvroot /mnt
mkdir -p /mnt/boot
mount /dev/sda1 /mnt/boot
pacstrap /mnt base
genfstab -U -p /mnt >> /mnt/etc/fstab
cat /mnt/etc/fstab
Base Configuration (Start)
arch-chroot /mnt
Base Configuration – Swap File
Instead of a swap partition I decided to use a swap file.
fallocate -l 4G /swapfile
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
echo "/swapfile none swap defaults 0 0" >> /etc/fstab
cat /etc/fstab
Base Configuration – Locale
sed -i -e 's/#en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/g' /etc/locale.gen
locale-gen
echo LANG=en_US.UTF-8 > /etc/locale.conf
export LANG=en_US.UTF-8
Base Configuration – Time
ln -s /usr/share/zoneinfo/US/Pacific /etc/localtime
hwclock --systohc --utc
Base Configuration – Network
echo codeghar > /etc/hostname
cp /etc/netctl/examples/ethernet-static /etc/netctl/ens32.cfg
Edit the file ens32.cfg and provide your static IP information.
nano /etc/netctl/ens32.cfg
Enable the configuration.
cd /etc/netctl
netctl enable ens32.cfg
Base Configuration – initram
Edit file /etc/mkinitcpio.conf and add lvm2 between block and filesystems in the HOOKS settings.
nano /etc/mkinitcpio.conf
Before:
HOOKS="base udev ... block filesystems ..."
After:
HOOKS="base udev ... block lvm2 filesystems ..."
mkinitcpio -p linux
Base Configuration – grub
mount -t efivarfs efivarfs /sys/firmware/efi/efivars
pacman -S grub efibootmgr
There seems to be a bug where I couldn’t get grub to work properly. The solution was to add an entry to the /etc/default/grub file.
nano /etc/default/grub
Add to file:
GRUB_DISABLE_SUBMENU=y
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=arch_grub --recheck
grub-mkconfig -o /boot/grub/grub.cfg
Base Configuration – User
Set root password.
passwd root
Create new user. I tried to follow the example of a user account from Fedora.
groupadd cguser
useradd -m -g cguser -G users,wheel,storage,power -s /bin/bash cguser
passwd cguser
Base Configuration – Remote Access
pacman -S openssh
Configure SSH to disable root access and make any other changes you want.
nano /etc/ssh/sshd_config
systemctl enable sshd.service
Base Configuration (End)
I like to use vim so I install it as well.
pacman -S vim
Exit out of the chroot.
exit
umount -R /mnt
reboot
First Boot
You should now be able to boot to Arch and login via console or SSH.
Recent Comments