-
-
Save onsails/6a8325a8aa92219e6db1 to your computer and use it in GitHub Desktop.
Instructions to replace a live Debian installation with Arch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Download latest archlinux bootstrap package, see https://www.archlinux.org/download/ | |
wget http://ftp.nluug.nl/os/Linux/distr/archlinux/iso/2016.01.01/archlinux-bootstrap-2016.01.01-x86_64.tar.gz | |
# Make sure you'll have enough entropy for pacman-key later. | |
apt-get install haveged | |
# Install the arch bootstrap image in a tmpfs. | |
mount -t tmpfs none /mnt | |
cd /mnt | |
tar xvf ~/archlinux-bootstrap-2016.01.01-x86_64.tar.gz --strip-components=1 | |
cp -r /root/.ssh root | |
cp /etc/resolv.conf etc | |
vi etc/pacman.d/mirrorlist # Uncomment one or more mirrors. | |
# Swap / and /mnt | |
mount --make-rprivate / | |
for i in run proc sys dev; do mount --move /$i /mnt/$i; done | |
pivot_root . mnt | |
exec chroot . | |
# Setup pacman and install the tools we need. | |
pacman-key --init | |
pacman-key --populate archlinux | |
pacman -Sy systemd-sysvcompat psmisc openssh | |
# Restart sshd in the new root. | |
cp /mnt/etc/ssh/* /etc/ssh | |
killall -HUP sshd | |
# You'll have to reconnect at this point. Let's hope it works. | |
# Make sure nothing is using the old filesystem anymore. | |
killall haveged agetty cron rsyslogd systemd-udevd systemd-journald | |
telinit u | |
# Unmount the old filesystem. | |
umount /mnt | |
# If umount complains that /mnt is still busy, install and use | |
# lsof to check which other processes you need to kill: | |
# pacman -S lsof | |
# lsof +f -- /mnt | |
# kill ... | |
# umount /mnt | |
# Install arch as usual: (See https://wiki.archlinux.org/index.php/installation_guide) | |
mkfs.ext4 /dev/xvda2 | |
mount /dev/xvda2 /mnt | |
pacstrap /mnt base openssh grub vim | |
genfstab /mnt >> /mnt/etc/fstab | |
cp -r /root/.ssh /mnt/root | |
arch-chroot /mnt | |
echo archbox > /etc/hostname | |
ln -s /usr/share/zoneinfo/Europe/Amsterdam /etc/localtime | |
vim /etc/locale.gen | |
locale-gen | |
echo LANG=en_GB.UTF-8 > /etc/locale.conf | |
mkinitcpio -p linux | |
passwd | |
grub-mkconfig -o /boot/grub/grub.cfg | |
grub-install /dev/... # No need for grub-install when Xen Pygrub is used. | |
systemctl enable sshd | |
vim /etc/netctl/internet | |
netctl enable internet | |
exit | |
reboot # And pray it'll boot. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment