Guidelines for Building Private Images
Oracle provides support for instances created using Oracle-provided images.
When you build images, consider the following guidelines:
Supported operating systems
Oracle has certified the use of private images that are built using x86, 64-bit versions of the following operating systems:
- Oracle Linux
- 5.11 UEK R2
- 6.4 UEK R3 and UEK R4
- 6.6 UEK R3 and UEK R4
- 6.7 UEK R3 and UEK R4
- 6.8 UEK R3 and UEK R4
- 7.1 UEK R3 and UEK R4
- 7.2 UEK R3 and UEK R4
Oracle Linux images must be set up to boot using kernel version 2.6.36 or later. Kernels starting from v2.6.36 contain PVHVM drivers, which are required for instances to work in Compute Classic.
- Oracle Solaris 11.3
You can launch instances from images built using other operating systems as well. Do follow the guidelines provided in this document when building such images.
- Oracle Linux
Network configurationIf you expect the instances that’re created from your image to be attached to multiple networks, then configure your image to support multiple virtual NICs:
For Oracle Linux and other Linux distributions that’re based on Red Hat Enterprise Linux (RHEL), create a separate interface file under
/etc/sysconfig/network-scriptsfor each network.The interface files should be named
interfaceis the interface name:
For Oracle Linux 6.x and RHEL-based images, the interface name should be in the
eth1, and so on.
For Oracle Linux 7+ images, the interface name should be in the
em2, and so on.
You can attach your instance to up to eight networks.Each interface file should be contain the following attributes:
DEVICE=interface ONBOOT=yes TYPE=Ethernet BOOTPROTO=dhcp PERSISTENT_DHCLIENT=1
interfacewith the appropriate interface name as described earlier.
For Debian-based images, edit the
/etc/network/interfacesfile to include the following commands:
auto eth0 iface eth0 inet dhcp auto eth1 iface eth1 inet dhcp auto eth2 iface eth2 inet dhcp auto eth3 iface eth3 inet dhcp auto eth4 iface eth4 inet dhcp auto eth5 iface eth5 inet dhcp auto eth6 iface eth6 inet dhcp auto eth7 iface eth7 inet dhcp
Image disk count and size
The image must contain only one disk.
Keep your image disk size just as small as is essential. A large image requires more time to be uploaded to Oracle Cloud Infrastructure Object Storage Classic, and costs more to store. In addition, creating instances and bootable storage volumes from a large image requires more time. Before uploading image files to Oracle Cloud Infrastructure Object Storage Classic, make them sparse files. On Linux, you can convert a file to the sparse format by running the command,
cp --sparse=always original_file sparse_file. And when creating the
tararchive, to ensure that the
tarutility stores the sparse file appropriately, specify the
Before creating the image file, plan ahead and provision any users that you'd like to be available when instances are created using the image.
While creating instances, you can specify one or more SSH public keys.The keys that you specify are stored as metadata on the instance. This metadata can be accessed from within the instance at
Oracle-provided images include a script that runs automatically when the instance starts, retrieves the keys, and adds them to the
authorized_keysfile of the
In images that you build, you can write and include a script that runs automatically when the instance starts, retrieves the SSH public keys, and adds the keys to the
authorized_keysfile of the appropriate users.
Alternatively, if you’re building an Oracle Linux 6.7 image, you can install and use opc-init to perform instance initialization and configuration tasks, including copying the SSH public key to the
authorized_keysfile of the
opcuser. See Using opc-init in a Private Machine Image.
The image must be a full disk image, including a partition table and boot loader. The virtual disk image must be converted to the
rawformat, packaged in a
tararchive that contains only the image, and compressed using
gzip. The final image must be a
tar.gzfile name that you can use later to easily identify the key characteristics of the image, such as the OS name, OS version, and the disk size. For example, for a root-disabled, Oracle Linux 6.6 image with a 20-GB disk, consider using a file name such as
Apply the necessary security patches and review the security configuration before creating the image file.
To ensure that Compute Classic instances provide a resilient platform for your workloads, make sure that the latest security patches are applied to the operating system running on the instances. In addition, before deploying applications on an instance, review the security configuration of the operating system and verify that it complies with your security policies and standards.
Building an Oracle Linux Machine Image
You can build Oracle Linux machine images in one of the following ways:
By using one of the several ready-to-use Oracle Linux machine images provided by Oracle.
By building your own machine images (without using the Oracle-provided images). For detailed instructions about installing Oracle Linux on Oracle VM VirtualBox; customizing the operating system for enabling key-based SSH access; changing the default kernel; installing Apache HTTP Server, MySQL, and PHP; and then creating a raw image that you can use to launch instances in Compute Classic, see the Building a Custom Oracle Linux Machine Image with the LAMP Stack tutorial.
After building a machine image, to use it to launch instances, you must upload the
tar.gz image file to Oracle Cloud Infrastructure Object Storage Classic. See Uploading Image Files to Oracle Cloud Infrastructure Object Storage Classic.