Home server step 2: install Arch Linux

Okay, the test passed and the drive works fine. Now I’m largely following the Arch Linux instructions.

Let’s create a single root partition:

> fdisk /dev/sda
...

and put an ext4 filesystem on it:

> mkfs.ext4 /dev/sda1

Oops, what is this: an error message says “/dev/sda1 is apparently in use by the system” and mkfs is refusing to create a file system here. After some Googling, it turns out that the OS thinks the drive is part of a RAID array (it used to be in a former life). To stop it thinking that:

> cat /proc/mdstat
md127
# yeah, right
> mdadm --stop /dev/md127
> mkfs.ext4 /dev/sda1

Now it works.

Next: put a system on. Arch Linux is “a bit” manual compared to other Linux distro’s, but never mind. Mount the new root drive at /mnt, so we can put stuff on it:

mount /dev/sda1 /mnt

Now we need a network. DHCP client is already configured. (Here, the narrative is interrupted by puzzlement and poking around in /etc/dhcpc.conf, and a Duh, and the network cable is plugged into the right port, this time.)

Network is here:

> ip addr

and we can install the base system:

> pacstrap /mnt base

Generate fstab. I didn’t know about using UUIDs instead of device names. That seems like a good idea:

> genfstab -p /mnt >> /mnt/etc/fstab

Arch Linux loves chroots. Here’s one. I’m just going to write down commands uncommented if it is obvious what they do.

> arch-chroot /mnt
% echo myhost > /etc/hostname
% ln -s /usr/share/zoneinfo/America/Los_Angeles /etc/localtime
% mkinitcpio -p linux
% passwd

Now we need a bootloader. This turned out to be a bit more complicated than expected because the Arch Linux wiki was missing the second one of these commands (I corrected it), and upon reboot, grub would attempt to boot off somebody else’s disks instead of mine. Surprisingly disks with somebody else’s UUIDs weren’t found in my computer…

% pacman -S grub
% grub-mkconfig -o /boot/grub/grub.cfg
% grub-install --target=i386-pc --recheck /dev/sda

Now, quit the chroot environment, sync for better measure, remove boot memory stick, and:

shutdown -r now

Voila, a new system. Go to step 3.

 

Links to all parts: Step 1: assemble and test hardware; Step 2: install Arch Linux; Step 3: networking; Step 4: make it an Indie Box!; Step 5: deploy Shaarli via Indie Box.