Skip to content

Instantly share code, notes, and snippets.

@stephonchen
Last active April 14, 2023 12:06
Show Gist options
  • Save stephonchen/65cd9e1d703efe3612f7cee79d8aaab2 to your computer and use it in GitHub Desktop.
Save stephonchen/65cd9e1d703efe3612f7cee79d8aaab2 to your computer and use it in GitHub Desktop.
Deploy Oracle Linux in GCE
  • Install Oracle Linux in VirtualBox

  • Before shutdown, be aware to do these things

    • Edit /etc/default/grub
      • Remove splash & quiet & rhgb
      • Add console=ttyS0,38400n8d
    • Update grub
      sudo grub2-mkconfig -o /boot/grub2/grub.cfg
      
    • Add network script for eth0, in /etc/sysconfig/network-scripts/
      • You can copy from /etc/sysconfig/network-scripts/ifcfg-eXX
      • Be aware that DHCP and ONBOOT should be set to YES
  • Export disk

    • Be aware that file name SHOULD BE disk.raw
    • Clone boot disk to RAW format
    VBoxManage clonemedium guest-image ~/disk.raw --format RAW
    
    • Compress the RAW disk into tar.gz
    sudo tar --format=oldgnu -Sczf /tmp/compressed-image.tar.gz disk.raw
    
    • Noted that in macOS, you should use gnu-tar
    brew install gnu-tar
    
    sudo gtar --format=oldgnu -Sczf /tmp/compressed-image.tar.gz disk.raw
    
  • Upload compressed-image.tar.gz to GCS bucket

  • Create a GCE image from compressed-image.tar.gz in GCS bucket

gcloud compute images create image-name --source-uri gs://bucket-name/compressed-image.tar.gz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment