Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save axlroden/32fd5d683f9be8d427a76e921b0020cd to your computer and use it in GitHub Desktop.
Save axlroden/32fd5d683f9be8d427a76e921b0020cd to your computer and use it in GitHub Desktop.
DIY install debian on Oracle Cloud Infrastructure ( Free Tier ) - ARM64
sudo -i
sudo apt update && sudo apt dist-upgrade -y && sudo apt install lsof && sudo reboot
# ssh back in
sudo -i
snap remove --purge oracle-cloud-agent && sudo snap remove --purge core18
apt purge -y $(dpkg-query -Wf '${Package}\n' | grep header) $(apt list --installed | grep -oP "^linux.*\d\d\d\d-oracle" | grep -v "$(uname -r)") linux-modules-extra-$(uname -r) lxc* lxd* vim* && sudo apt -y autoremove && sudo apt -y autoclean && apt -y clean
rm -rf /var/log/* /var/lib/apt/lists/*
cd /
mount -t tmpfs -o size=1700m tmpfs mnt
tar --one-file-system -c . | tar -C /mnt -x
mount --make-private -o remount,rw /
mount --move dev mnt/dev
mount --move proc mnt/proc
mount --move run mnt/run
mount --move sys mnt/sys
sed -i '/^[^#]/d;' mnt/etc/fstab
echo 'tmpfs / tmpfs defaults 0 0' >> mnt/etc/fstab
cd mnt
mkdir old_root
mount --make-private /
unshare -m
pivot_root . old_root
/usr/sbin/sshd -D -p 1022 &
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 1022 -j ACCEPT
# reconnect on port 1022: I kept the old putty session (on port 22) open and it didn't disconnect
pkill agetty
pkill dbus-daemon
pkill atd
pkill iscsid
pkill rpcbind
pkill unattended-upgrades
kill 1
umount -l /dev/sda1
# rsync your generated arm tar
# rsync -arvz -e 'ssh -p 1022' ~/Downloads/oracle.tar.gz [email protected]:/home/ubuntu
tar xzOf /home/ubuntu/oracle.tar.gz | dd of=/dev/sda bs=1M
sync
# Now go force reboot the instance (dont use reboot only, or your waiting 15 minutes)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment