Last active
October 22, 2025 15:06
-
-
Save amishmm/e2dc93e65cf79116f2ef2d542f05e61b to your computer and use it in GitHub Desktop.
Revisions
-
amishmm revised this gist
Sep 13, 2022 . 1 changed file with 7 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -151,8 +151,12 @@ Name=en* Name=eth* [Network] # How to enable IPv6 on Oracle Cloud? - https://youtu.be/yxm3Bn7uHyw # Also open port 546 on IPv6. Nftables example: # nft add rule ip6 filter INPUT udp dport dhcpv6-client accept DHCP=yes IPv6AcceptRA=yes IPForward=no [DHCPv4] UseDNS=false @@ -202,4 +206,5 @@ Enjoy! 3. https://wiki.archlinux.org/title/Install_Arch_Linux_from_existing_Linux 4. https://mirror.cs.pitt.edu/archlinux/iso/2022.09.03/archlinux-bootstrap-2022.09.03-x86_64.tar.gz 5. https://wiki.archlinux.org/title/Working_with_the_serial_console 6. https://wiki.archlinux.org/index.php/installation_guide#Configure_the_system 7. https://youtu.be/yxm3Bn7uHyw (Enable IPv6 for Oracle Cloud Infrastructure) -
amishmm created this gist
Sep 13, 2022 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,205 @@ # Requirement * Console / Cloud Shell access (via https://cloud.oracle.com) * Go to the instance page and under Resources -> Console connection -> Launch Cloud Shell connection # Steps 1. In Ubuntu OR any other Free tier Linux OS ````shell # Download Alpine Linux and install it on disk 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 Linux (via Oracle Console Connection / Cloud Shell) * Wait for Alpine Linux to boot * Press Enter to see login prompt * Login as 'root' with no password. 3. Bring up networking in Alpine ````shell vi /etc/network/interfaces ```` add: ````conf auto eth0 iface eth0 inet dhcp ```` then in shell: ````shell /etc/init.d/networking restart ```` 4. Setup SSH in Alpine ````shell # in setup-sshd type 'yes' to 'Allow root ssh login?' # OR if you want to be more secure then setup ssh authorized_keys setup-sshd # setup root password for remote login passwd ```` Now you can ssh to your instance remotely ````shell ssh root@INSTANCE_IP ```` 5. Move Alpine from disk to RAM ````shell 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/ ```` 6. Setup APK repositories and get the Arch installation scripts, pacman and other required tools ````shell setup-apkrepos # enable community repository to fetch pacman etc. vi /etc/apk/repositories apk update apk add arch-install-scripts pacman dosfstools e2fsprogs ```` 7. Partition the disk and mount the partitions ````shell fdisk /dev/sda ```` in fdisk: (TIP: You may have to first delete all partitions using 'd' and then 'w' (save) and then proceed with following): ```` Press "g" (use gpt table) Press "n", partition 15, First sector default, Last sector +512M (set esp/EFI partition 15, size 512M) Press "t", then "1" (set type as EFI System) Press "n", partition 1 (set root partition 1, size remaining) Press "w" (save the changes) ```` then in shell: ````shell partprobe mkfs.vfat /dev/sda15 mkfs.ext4 /dev/sda1 mount /dev/sda1 /mnt mkdir -p /mnt/boot/EFI mount /dev/sda15 /mnt/boot/EFI ```` 8. Prepare Arch bootstrap (1GB RAM is not enough so we use HDD) ````shell mkdir /mnt/tmp cd /mnt/tmp wget -c https://mirror.cs.pitt.edu/archlinux/iso/2022.09.03/archlinux-bootstrap-2022.09.03-x86_64.tar.gz tar xf archlinux-bootstrap-2022.09.03-x86_64.tar.gz # uncomment any one mirror vi root.x86_64/etc/pacman.d/mirrorlist arch-chroot root.x86_64 # now we are inside Arch Installation process (as if booted through Arch ISO / Boot medium) pacman-key --init pacman-key --populate archlinux ```` 9. Install Arch on /mnt ````shell mount /dev/sda1 /mnt mount /dev/sda15 /mnt/boot/EFI pacstrap /mnt base linux linux-firmware amd-ucode e2fsprogs openssh vim grub efibootmgr genfstab -U /mnt >> /mnt/etc/fstab ```` 10. Configure the Arch system ```` arch-chroot /mnt # now we are inside our actual Arch system which we will be using in future # setup root password incase of serial console (see below) based recovery is required passwd # Setup swap (4GB) dd if=/dev/zero of=/swapfile bs=1M count=4096 status=progress chmod 600 /swapfile mkswap /swapfile echo '/swapfile none swap defaults 0 0' >> /etc/fstab # Configure the services systemctl enable systemd-networkd systemd-timesyncd sshd systemctl set-default multi-user.target # Basic Arch configuration ln -sf /usr/share/zoneinfo/YOURREGION/YOURCITY /etc/localtime hwclock --systohc # uncomment your locale(s) vim /etc/locale.gen locale-gen echo 'LANG=en_US.UTF-8' >> /etc/locale.conf echo 'TYPE_YOUR_HOSTNAME_HERE' >> /etc/hostname # sshd: PermitRootLogin with authorized_keys sed -i -e 's/^#PermitRootLogin/PermitRootLogin/g' /etc/ssh/sshd_config mkdir -p /root/.ssh chmod 700 /root/.ssh echo 'ssh-ed25519 TYPE_YOUR_SSH_KEY_HERE root@localhost' >> /root/.ssh/authorized_keys chmod 600 /root/.ssh/authorized_keys ```` 11. Configure Networking (DHCP) ````shell echo -e 'search localdomain\nnameserver 1.1.1.1\nnameserver 1.0.0.1' >> /etc/resolv.conf vim /etc/systemd/network/20-ethernet.network ```` add: ````conf [Match] Name=en* Name=eth* [Network] DHCP=yes IPv6PrivacyExtensions=yes [DHCPv4] UseDNS=false UseNTP=false [DHCPv6] UseDNS=false UseNTP=false [IPv6AcceptRA] UseDNS=false UseDomains=false ```` 12. Setup the Serial Console (ttyS0) This step is optional but helpful to get instance Console (ttyS0) / Cloud Shell access (via https://cloud.oracle.com) in case the system is not accessible via SSH or not booting. ````shell vim /etc/default/grub ```` append: ````conf GRUB_TERMINAL_INPUT="console serial" GRUB_TERMINAL_OUTPUT="gfxterm serial" GRUB_SERIAL_COMMAND="serial --unit=0 --speed=115200" GRUB_CMDLINE_LINUX_DEFAULT="${GRUB_CMDLINE_LINUX_DEFAULT/quiet/}" GRUB_CMDLINE_LINUX_DEFAULT="${GRUB_CMDLINE_LINUX_DEFAULT} console=tty0 console=ttyS0,115200" ```` 13. Configure EFI boot ````shell grub-install --efi-directory=/boot/EFI --bootloader-id=GRUB # create fallback boot loader too mkdir -p /boot/EFI/EFI/BOOT cp -dp /boot/EFI/EFI/GRUB/grubx64.efi /boot/EFI/EFI/BOOT/BOOTX64.EFI grub-mkconfig -o /boot/grub/grub.cfg ```` Also follow Arch Installation guide for any other steps that you may require: https://wiki.archlinux.org/index.php/installation_guide#Configure_the_system 14. Reboot and boot to your Arch! Enjoy! # References 1. https://wiki.alpinelinux.org/wiki/Replacing_non-Alpine_Linux_with_Alpine_remotely 2. https://dl-cdn.alpinelinux.org/alpine/v3.16/releases/x86_64/alpine-virt-3.16.2-x86_64.iso 3. https://wiki.archlinux.org/title/Install_Arch_Linux_from_existing_Linux 4. https://mirror.cs.pitt.edu/archlinux/iso/2022.09.03/archlinux-bootstrap-2022.09.03-x86_64.tar.gz 5. https://wiki.archlinux.org/title/Working_with_the_serial_console 6. https://wiki.archlinux.org/index.php/installation_guide#Configure_the_system