Home Server How to Switch Oracle Ubuntu VM to Debian.

How to Switch Oracle Ubuntu VM to Debian.

Frustrated with Ubuntu limitations on your Oracle VM? Our guide unveils a seamless Step-by-Step process to migrate to Debian and unlock its full potential!

101
0
How to Switch Oracle Ubuntu VM to Debian.
How to Switch Oracle Ubuntu VM to Debian.

Content.id – How to Switch Oracle Ubuntu VM to Debian. Sometime someone want to use debian instead of ubuntu on oracle. If you one of this kind here is how to switch your oracle VM from Ubuntu to Debian Os.

Refs:
1. http://mirror.cs.pitt.edu/archlinux/iso/2023.09.01/archlinux-bootstrap-2023.09.01-x86_64.tar.gz
2. https://dl-cdn.alpinelinux.org/alpine/v3.18/releases/x86_64/alpine-virt-3.18.0-x86_64.iso
3. https://wiki.alpinelinux.org/wiki/Replacing_non-Alpine_Linux_with_Alpine_remotely
4. https://www.debian.org/releases/bookworm/amd64/apds03.en.html

Prerequirment:

  • Oracle account
  • Oracle VM.Standard.E2.1.Micro
  • Ubuntu OS Installed
  • COFFEE

Requirement:

Console access.

Step By Step How to Convert your Ubuntu to Debian on your Oracle

Prepare alpine linux, which can be configured to run from ram only.
Alpine is leveraged to do the conversion.

1. In any linux (ubuntu/debian/arch tested) become root first:

sudo su -
cd /tmp && wget https://dl-cdn.alpinelinux.org/alpine/v3.18/releases/x86_64/alpine-virt-3.18.0-x86_64.iso
dd if=alpine-virt-3.18.0-x86_64.iso of=/dev/sda && sync && reboot

2. After reboot, go to your Oracle account. Login to Oracle and access the “Console Access” menu on the left.

In Alpine with console:

3.  [Bring up networking]

ip li set eth0 up
udhcpc eth0

4. [Setup SSH, answer RET, yes, RET]

setup-sshd

5.  [set temp alpine password for alpine login over SSH]

passwd

After you Add the password for root, at this point it’s easier to use SSH to copy & paste. E.g. “ssh root@”]

6. Login to Oracle VM using SSH client or PuTTY or any SSH Client you love to use.

7. [Per Ref #3. Move alpine to ram only]

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/

8. [Setup apk and bring in pacman]

setup-apkrepos

9. [enable community] by uncomment on the community repo

vi /etc/apk/repositories

10. Do update for the alpine and install dosfstools e2fsprogs util-linux-misc debian-archive-keyring debootstrap arch-install-scripts

apk update
apk add dosfstools e2fsprogs util-linux-misc debian-archive-keyring debootstrap arch-install-scripts

11 [Disk partitioning & mounting]

Use gpt table, set esp partition 15 size 256M), set root partition 1 size remaining

Follow this on fdisk: g, n, 15, RET, +256m, t, 1, n, RET, RET, RET, p, w

fdisk /dev/sda

12. Check /dev/ folder if there is sda15 and sda1

ls /dev/sda*

# if sda1 or sda15 is missing, do “/etc/init.d/devfs restart”

13. Format the partition

mkfs.vfat /dev/sda15
mkfs.ext4 /dev/sda1

14. Mount the partition

mount -t ext4 /dev/sda1 /mnt
mkdir /mnt/boot
mount /dev/sda15 /mnt/boot

15. Debootstrap debian system to /mnt/

# [Per Ref #4] Coffee time.

debootstrap --include systemd --arch amd64 bookworm /mnt/ http://ftp.us.debian.org/debian

15. chroot to /mnt/

arch-chroot /mnt/

16. Create root password for debian

# This is your debian root password. Choose carefully and remember it

passwd

17 Edit fstab

cat > /etc/fstab << EOF
# /etc/fstab: static file system information.
#
# file system    mount point   type    options                  dump pass
/dev/sda1         /             ext3    defaults                 0    1
/dev/sda15        /boot         vfat    nosuid,nodev             0    2
proc              /proc         proc    defaults                 0    0
EOF

18. Bring the interface up

cat >> /etc/network/interfaces << EOF
auto lo
iface lo inet loopback
auto ens3
iface ens3 inet dhcp
EOF

19. Add nameserver

cat > /etc/resolv.conf << EOF
nameserver 1.1.1.1
nameserver 4.2.2.2
nameserver 8.8.8.8
EOF

20. Add hostname in /etc/hostname

echo deb12 > /etc/hostname

21. Add debian repo

cat >> /etc/apt/sources.list << EOF
deb http://security.debian.org/ bookworm-security main
EOF

22. Install update and linux-image

apt update && apt -y install linux-image-cloud-amd64 grub-efi-amd64 ssh

23. Add SSH authorize keys

cat > ~/.ssh/authorized_keys << EOF

EOF

24. install grub to /boog

grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB
vi /etc/default/grub
  # Better console. Comparison below:
  #GRUB_CMDLINE_LINUX_DEFAULT="quiet"
  GRUB_CMDLINE_LINUX_DEFAULT="console=ttyS0,115200"

# Or use perl/sed to replace
# perl -pi.bak -e “s/quiet/console=ttyS0,115200/” /etc/default/grub
# sed -i.bak -e “s/quiet/console=ttyS0,115200/” /etc/default/grub
grub-mkconfig -o /boot/grub/grub.cfg

25. Exit from debian

exit

26. Reboot

reboot

Now your systemc at oracle switched from ubuntu to debian.