-
-
Save pranaypratyush/a8aea2880afbf0b701a20af620a211ff to your computer and use it in GitHub Desktop.
Replace Oracle Cloud Linux with Arch Linux remotely
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
Refs: | |
1. http://mirror.cs.pitt.edu/archlinux/iso/2021.02.01/archlinux-bootstrap-2021.02.01-x86_64.tar.gz | |
2. https://dl-cdn.alpinelinux.org/alpine/v3.13/releases/x86_64/alpine-virt-3.13.1-x86_64.iso | |
3. https://wiki.alpinelinux.org/wiki/Replacing_non-Alpine_Linux_with_Alpine_remotely | |
4. https://wiki.archlinux.org/index.php/installation_guide#Configure_the_system | |
Requirement: | |
Console access. | |
1. In Ubuntu | |
cd / | |
wget https://dl-cdn.alpinelinux.org/alpine/v3.16/releases/x86_64/alpine-virt-3.16.2-x86_64.iso | |
dd if=alpine-virt-3.16.2-x86_64.iso of=/dev/sda | |
sync | |
reboot | |
2. In Alpine | |
setup-alpine -q | |
# [Bring up networking] | |
vi /etc/network/interfaces | |
#add: | |
``` | |
auto eth0 | |
iface eth0 inet dhcp | |
ifup eth0 | |
``` | |
/etc/init.d/networking restart | |
# [Setup SSH] | |
passwd | |
setup-sshd | |
adduser tempuser | |
# [apk rep] | |
echo -e "http://nl.alpinelinux.org/alpine/v3.13/main\nhttp://nl.alpi | |
nelinux.org/alpine/v3.14/community" >> /etc/apk/repositories | |
apk update | |
#apk add fish tree tmux nano | |
# [Check /etc/ssh/sshd_config to enable ssh access] | |
``` | |
PasswordAuthentication yes | |
PermitRootLogin yes | |
PermitEmptyPasswords yes | |
``` | |
/etc/init.d/sshd restart | |
# [At this point it's easier to use SSH to copy & paste] | |
ssh root@[public-ip] | |
# [Per Ref #3] | |
mkdir /media/setup | |
cp -a /media/sda/* /media/setup | |
mkdir /lib/setup | |
cp -a /.modloop/* /lib/setup | |
/etc/init.d/modloop stop | |
umount /dev/sda | |
mv /media/setup/* /media/sda/ | |
mv /lib/setup/* /.modloop/ | |
# [Setup apk and bring in pacman] | |
setup-apkrepos | |
vi /etc/apk/repositories, enable community | |
apk update | |
apk add dosfstools e2fsprogs cfdisk sfdisk pacman arch-install-scripts btrfs-progs parted multipath-tools lsblk hparm partx | |
# [Disk partitioning & mounting] | |
cfdisk /dev/sda(use gpt table, set esp partition 15 size 260M), set root partition 1 size remaining) | |
partprobe; kpartx /dev/sda; | |
mkfs.vfat /dev/sda15 | |
mkfs.btrfs /dev/sda1 | |
mount /dev/sda1 /mnt | |
mkdir -p /mnt/boot/EFI | |
mount /dev/sda15 /mnt/boot/EFI | |
# [1G ram is not enough to hold arch bootstrap. Use HDD for now.] | |
mkdir /mnt/tmp | |
cd /mnt/tmp | |
wget http://mirror.cs.pitt.edu/archlinux/iso/2021.02.01/archlinux-bootstrap-2021.02.01-x86_64.tar.gz | |
tar xf archlinux-bootstrap-2021.02.01-x86_64.tar.gz | |
vi root.x86_64/etc/pacman.d/mirrorlist | |
arch-chroot root.x86_64/ | |
pacman-key --init | |
pacman-key --populate archlinux | |
# [Any other way than mount again?] | |
mount /dev/sda1 /mnt | |
pacstrap /mnt base linux linux-firmware | |
genfstab -U /mnt >> /mnt/etc/fstab | |
follow https://wiki.archlinux.org/index.php/installation_guide#Configure_the_system | |
# [EFI boot] | |
pacman -S grub efibootmgr | |
grub-install --efi-directory=/boot/efi --bootloader-id=GRUB | |
grub-mkconfig -o /boot/grub/grub.cfg | |
# [Any other way than fallback?] | |
mv /boot/EFI/grub /boot/EFI/BOOT | |
mv /boot/EFI/BOOT/grubx64.efi esp/EFI/BOOT/BOOTX64.EFI |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment