Bare-metal install procedure of Arch Linux.
===
Mostly extracted from shorter installation guide and a more detailed beginners guide.
Erase partition table
sgdisk --zap-all /dev/sd[ab]
Create GPT partitions and don’t use MBR partitioning scheme as there is a limit of 2TB, which it’s quite easy to reach nowadays:
parted /dev/sda mklabel gpt
# BIOS BOOT parition because of GTP partitioning
parted -a optimal /dev/sda mkpart biosboot 1M 2M
parted /dev/sda name 1 bios
parted /dev/sda set 1 bios_grub on
# Swap partition on last 5Gb on disk
parted -a optimal -- /dev/sda mkpart primary ext4 2M -5G
parted /dev/sda name 2 rootfs
parted /dev/sda set 2 raid on
parted -a optimal -- /dev/sda mkpart primary linux-swap -5G 100%
parted /dev/sda name 3 swap
Never prompt the user (--script
), set alignment for newly created
partitions (--align optimal
). Negative numbers count back from
the end of the disk, with -1s
indicating the sector at the end of the
disk. We can also use binary units like MiB
, GiB
, TiB
.
We will add --
after you are done with command line arguments so that
it will ignore anything else that looks like a -
or --
arg.
Read more in Parted User’s Manual.
Do the same for the second disk:
parted /dev/sdb mklabel gpt
parted -a optimal -- /dev/sdb mkpart primary ext4 2M -5G
parted /dev/sdb name 1 rootfs
parted /dev/sdb set 1 raid on
Finally, create a RAID:
mdadm --zero-superblock /dev/sd[ab]
mdadm --create /dev/md0 --level=1 --raid-devices=2 --metadata=1.0 --assume-clean /dev/sda2 /dev/sdb1
To avoid the initial resync with new hard drives add we addes --assume-clean
flag.
Whenever we want, we can watch resync process with the directive:
watch -n .1 cat /proc/mdstat
Create filesystems
mkfs.ext4 /dev/md0
And activate swap partition:
mkswap /dev/sda3
swapon /dev/sda3
Install base packages and configure the system
First, mount the disks to /mnt
:
mount /dev/md0 /mnt
Use the pacstrap script to install the base group of packages:
pacstrap /mnt base
Generate an fstab file:
genfstab -U -p /mnt >> /mnt/etc/fstab
nano /mnt/etc/fstab
arch-chroot /mnt
echo server > /etc/hostname
ln -sf /usr/share/zoneinfo/Europe/Belgrade /etc/localtime
Uncomment the needed locales in /etc/locale.gen
. Then generate locale
with:
locale-gen
echo LANG=en_US.UTF-8 > /etc/locale.conf
Set the root password (vrlo5igurno
):
passwd
Install bootloader
pacman -S grub
grub-install --target=i386-pc --recheck /dev/sda
grub-mkconfig -o /boot/grub/grub.cfg
Install RAID support
Update configuration file, but do it outside of the chroot
exit
mdadm --detail --scan >>/mnt/etc/mdadm.conf
Now, chroot again and add mdadm hook (mdadm_udev
) to HOOKS line in
mkinitcpio.conf
arch-chroot /mnt
nano /etc/mkinitcpio.conf
# HOOKS="base udev autodetect block mdadm_udev filesystems usbinput fsck"
And regenerate the initramfs image:
mkinitcpio -p linux
Reboot to the new environment
Exit the chroot environment and reboot:
exit
reboot
Set up static network
cd /etc/netctl
cp examples/ethernet-static mynet
nano mynet
Enable above created profile to start it at every boot:
netctl enable mynet
Setup SSH
pacman -S openssh
systemctl enable sshd
Setup Windows shares
By installing Samba:
pacman -S samba
cp /etc/samba/smb.conf.default /etc/samba/smb.conf
systemctl enable smbd nmbd
Now create a directory
mkdir /srv/cifs/public
And make it publicly accessible by just adding this immediatly after
security = user
line:
security = user
map to guest = Bad User
you must also make a share public
as explained more here.
Upgrade everything
At last, do this simple:
pacman -Syu
That’s it for now.