Getting Started with Oracle Linux
Oracle Cloud Infrastructure has a set of Oracle Linux platform images that you can select when creating an instance. For more information about specific releases of platform images, see Release Information.
Key features for Oracle Linux on Oracle Cloud Infrastructure
Oracle Linux images available on Oracle Cloud Infrastructure include:
The advantages of Oracle Cloud Infrastructure Oracle Linux images over traditional Oracle Linux deployments are:
-
Instances automatically have access to Unbreakable Linux Network (ULN) content.
-
If the instance is connected to a service gateway, it has access to ULN content through the regional yum servers. Unlike the publicly available Oracle Linux yum server, the Oracle Cloud Infrastructure regional yum servers mirror all ULN channels. Thus, you can access ULN content without registering the system with ULN or using alternate tools to manage channel access, which simplifies software management on the instance.
-
-
All images have Oracle Ksplice installed by default.
-
You can run Ksplice to install patches manually or enable automatic updates to get the latest security patches without any need to reboot.
-
-
The default kernel is the latest version Unbreakable Enterprise Kernel (UEK) available for the image.
-
Setting the default kernel to UEK ensures the broadest functionality support immediately after deploying an instance.
-
-
Instances can use the OCI Utilities.
-
The OCI utilities are a set of custom tools that allow the instance to access information about infrastructure resources. These tools can help automatically discover or provision resources as you need them.
-
Creating an Instance
Create a Linux instance using the Embedded Marketplace, Oracle Images tab, or Oracle Cloud Marketplace.
Using the Embedded Marketplace
-
Log in to the Oracle Cloud Infrastructure Console.
-
Open the navigation menu and click Marketplace, then, under Marketplace, click All Applications.
-
In the search box, type the name of the image. Options include:
- Oracle Linux STIG Image
- Oracle Cloud Developer Image
- Oracle Linux KVM Image
- Oracle Linux Storage Appliance
- Oracle Autonomous Linux versions are available for some of the images
-
Press Enter and then select the image.
-
Launch the instance:
-
Select the Version of the image and the Compartment.
-
Review and then accept the Oracle standard Terms and Restrictions.
-
Click Launch Instance.
-
-
Enter the Name, select the Compartment, and select the Availability Domain.
You can add or change the name later. The name does not need to be unique, because an Oracle Cloud Identifier (OCID) uniquely identifies the instance.
-
Change the instance type or the instance shape:
-
Click Change Shape.
-
Choose an Instance type of Virtual Machine or Bare Metal Machine.
-
Select a compute Shape Series on which to deploy the image.
-
Click Select Shape.
-
-
Under Networking, make any necessary changes to the default settings.
-
Under Add SSH keys, either generate a key pair or upload your own public key.
If you provide an existing public key, then when you connect to the instance, you are prompted to also provide the associated private key. For more information about SSH keys, see Managing Key Pairs on Linux Instances.
-
Under Boot volume, change the default boot volume size or encrypt the volume.
-
Click Create to deploy your instance.
Using the Oracle Images Tab
-
Log in to the Oracle Cloud Infrastructure Console.
-
Open the navigation menu and click Compute, then, under Compute, click Instances.
- Click Create Instance.
-
Enter the Name, select the Compartment, and select the Availability Domain.
You can add or change the name later. The name does not need to be unique, because an Oracle Cloud Identifier (OCID) uniquely identifies the instance.
-
Within the Image and Shape section, click Change Image.
-
From the Browse All Images panel, under Image Source, select Oracle Images, and then choose name of the image. Options include:
- Oracle Linux STIG Image
- Oracle Cloud Developer Image
- Oracle Linux KVM Image
- Oracle Linux Storage Appliance
- Oracle Autonomous Linux versions are available for some of the images
-
Review and then accept the Oracle standard Terms and Restrictions.
-
Click Select Image.
-
Change the instance type or the instance shape:
-
Click Change Shape.
-
Choose an Instance type of Virtual Machine or Bare Metal Machine.
-
Select a compute Shape Series on which to deploy the image.
-
Click Select Shape.
-
-
Under Networking, make any necessary changes to the default settings.
-
Under Add SSH keys, either generate a key pair or upload your own public key.
If you provide an existing public key, then when you connect to the instance, you are prompted to also provide the associated private key. For more information about SSH keys, see Managing Key Pairs on Linux Instances.
-
Under Boot volume, change the default boot volume size or encrypt the volume.
-
Click Create to deploy your instance.
Using the Oracle Cloud Marketplace
The Oracle Cloud Marketplace is outside of Oracle Cloud Infrastructure. For more information, see Overview of Marketplace.
-
Go to the Oracle Cloud Marketplace.
-
In the search box, type the name of the image. Options include:
- Oracle Linux STIG Image
- Oracle Cloud Developer Image
- Oracle Linux KVM Image
- Oracle Linux Storage Appliance
- Oracle Autonomous Linux versions are available for some of the images
-
Select the image version. Click Get App.
- Log into your Oracle Cloud Infrastructure Account.
-
Launch the instance:
-
Select the Version of the image and the Compartment.
-
Review and then accept the Oracle standard Terms and Restrictions.
-
Click Launch Instance.
-
-
Enter the Name, select the Compartment, and select the Availability Domain.
You can add or change the name later. The name does not need to be unique, because an Oracle Cloud Identifier (OCID) uniquely identifies the instance.
-
Change the instance type or the instance shape:
-
Click Change Shape.
-
Choose an Instance type of Virtual Machine or Bare Metal Machine.
-
Select a compute Shape Series on which to deploy the image.
-
Click Select Shape.
-
-
Under Networking, make any necessary changes to the default settings.
-
Under Add SSH keys, either generate a key pair or upload your own public key.
If you provide an existing public key, then when you connect to the instance, you are prompted to also provide the associated private key. For more information about SSH keys, see Managing Key Pairs on Linux Instances.
-
Under Boot volume, change the default boot volume size or encrypt the volume.
-
Click Create to deploy your instance.
For more information, see Creating a Compute Instance.
Accessing an Instance
Connect to your Oracle Cloud Infrastructure instance using SSH.
For Oracle Linux Storage Appliance instances, connecting directly with SSH is not supported. Instead, access the instance through the web interface. See Accessing the Web Interface.
Prerequisites
Before connecting, obtain the following:
- SSH client
- Public IP address of the instance
- Path to the SSH-2 RSA private key file
Connecting Using SSH
- Complete the Prerequisites.
- From an SSH client, use the default
opc
user to connect to the instance.For example:
ssh -i PRIVATE_KEY_PATH opc@PUBLIC_IP_ADDRESS
- After you’re logged in as
opc
, you can use thesudo
command to run administrative tasks.For example, run the following command to show details for all storage devices attached to your instance:
sudo oci-iscsi-config --show
For more information, see:
Installing Software
Install software by enabling repositories from the Oracle Cloud Infrastructure regional yum servers.
Unlike the publicly available Oracle Linux yum server, the Oracle Cloud Infrastructure regional yum servers mirror all ULN channels. Therefore, compute instances can access ULN content without having to register the system with ULN. For more information, see Oracle Linux 7: Managing Software and Oracle Linux 8: Managing Software.
Connecting to the Regional Yum Server
Instances connected to the service gateway automatically have access to the regional
yum servers. The $ociregion
and $ocidomain
yum variables
determine which regional server the instance connects to.
For example, the baseurl
to the _latest
repository for
Oracle Linux 8 is:
baseurl=https://yum$ociregion.$ocidomain/repo/OracleLinux/OL8/baseos/latest/$basearch/
-
Set the
$ociregion
variable by populating content in/etc/yum/vars/ociregion
.If the
ociregion
file does not exist or is empty, thebaseurl
points to the publicly accessible Oracle Linux yum server. Typically, when you create the instance the$ociregion
variable is set to point to the closest regional yum server on the Oracle Cloud Infrastructure service network. For example, if$ociregion
is set to-phx
, thebaseurl
expands to point to the regional yum server in Phoenix. - Set the
$ocidomain
variable by populating content in/etc/yum/vars/ocidomain
.
Accessing ULN Content
To access ULN content on the regional yum servers, install the appropriate release-el
packages and enable the repositories that you require access to.x
For example, on Oracle Linux 8, you can run the following commands to access the ol8_oci_included
repository, where tools like Oracle InstantClient, the Oracle Java Development Kit and Oracle Java Runtime Environment are located:
sudo dnf install oci-included-release-el8 sudo dnf config-manager --enable ol8_oci_included
Other ULN channels are also available directly through the Oracle Cloud Infrastructure regional yum servers. For example, to access the Ksplice channels on an Oracle Linux 7 compute instance, you can do:
sudo yum install ksplice-release-el7 sudo yum-config-manager --enablerepo ol7_ksplice ol7_x86_64_userspace_ksplice
Most of these channels are installed and available by default in the latest platform images.
Using OS Management
You can use OS Management to manage packages on Oracle Linux instances, including installing, removing, and updating packages. See Managing Linux Packages for more information.
OS Management uses software sources to provide packages to instances, and to track the available updates to those packages. A software source is a collection of packages. Software sources enable you to control which packages can be installed on instances without having to manually log in and configure the repositories on each instance. See Managing Software Sources for more information.
Updating an Instance
Use Oracle Ksplice, OS Management, or Oracle Autonomous Linux to help automate system updates, but also follow recommended guidance to keep your system up to date.
Using Oracle Ksplice
You can use Oracle Ksplice to patch a system without requiring a reboot. However, these updates only occur in-memory. You must also update packages on-disk to their latest versions, so that when the system reboots, it starts from the most current release. Follow the recommendations in Maintaining the System.
Using OS Management
You can use OS Management to manage and monitor updates for the OS environments Oracle Linux instances. OS Management allows you to group instances for updates, providing automated patch and fleet management capabilities. See Managing Linux Packages for more information.
Using Autonomous Linux
Oracle Autonomous Linux can automatically handle system package updates on a regular schedule. Autonomous Linux provides automatic daily updates in addition to the zero-downtime Ksplice updates for kernel, OpenSSL, and glibc libraries. These updates are referred to as autonomous updates. When you create an Autonomous Linux instance, the service automatically creates a controlled scheduled job for autonomous updates. You can update the start time for the daily autonomous updates using the Console, CLI, or API.
Maintaining the System
Regularly update the operating system and user space packages to obtain the latest bug fixes and security patches.
Oracle recommends that you:
-
Subscribe the instance to the
_latest
yum repository for your Oracle Linux release. -
Update any software that was installed outside of the Oracle Linux yum package manager.
For example, tools such as
flatpak
andsnap
, for installing desktop applications; andpip
,gem
andnpm
, for installing Python, Ruby and Node libraries and modules, all have their own software update mechanisms. -
Always update instances to the most recent release of the operating system.
Oracle Linux uses a rolling update level approach for keeping software up to date. For example, Oracle Linux 8.4 or Oracle Linux 8 Update 4, are rolling snapshots of the latest supported packages for the Oracle Linux release and are not considered independent versions of Oracle Linux.
-
Manually update packages or install and configure the appropriate tool for automatic updates.
- For Oracle Linux 7 instances you can use the
yum-cron
utility described in Oracle Linux 7: Managing Software. - For Oracle Linux 8 instances you can use the
dnf-automatic
utility described in Oracle Linux 8: Managing Software on Oracle Linux
- For Oracle Linux 7 instances you can use the
Adding Users and Groups
Use the default opc
user to add users and groups to a newly created instance.
Oracle recommends that you create and configure users and groups according to your access requirements. Access the instance as the opc
user (see Accessing an Instance), and then add users and groups as necessary. See Create users and groups on Oracle Linux for a general introduction to users and groups on Oracle Linux.
What is the opc user?
Oracle Linux instances have a default opc
user. Use this account to create and configure additional users and groups.
The opc
account has:
- Full
sudo
privileges. -
No password configured.
Instead you access the account over SSH with a key pair configured when you create the instance (see Accessing an Instance).
Adding a User
To add a user named alice
to the system:
sudo useradd alice
To set a password for the user:
sudo passwd alice
Adding a Group
To add a group called staff
to the system:
sudo groupadd staff
To add the user alice
to the group staff
:
sudo usermod -G staff alice
Manage the users in a group using the groupmems
command. For example, to remove alice
from the group staff
:
sudo groupmems -d alice -g staff
Configuring Permissions
Define permissions by configuring users and groups within /etc/sudoers
.
By default, members of the wheel
group can use sudo to obtain all root privileges. You can add entries for users or groups by adding files to /etc/sudoers.d
. For example, the privileges assigned to the opc
user are defined in /etc/sudoers.d/90-cloud-init-users
.
Migrating to Oracle Cloud Infrastructure
You can migrate on-premises Oracle Linux images to Oracle Cloud Infrastructure with the oci-image-migrate
utilities.
The
oci-image-migrate
utilities are not part of the preinstalled OCI Utilities, but are available from the addons
repository. You must manually install the oci-image-migrate
utilities on your on-premises image.Compatibility
You can use the utility to migrate both virtual machines and physical hosts to Oracle Cloud Infrastructure. To migrate, you must create a compatible disk image and save it in a shared location where an Oracle Linux host can access it. The migration utilities work with the default Oracle VM VirtualBox disk image format (VMDK), or the QEMU copy-on-write disk image format (QCOW2) that is commonly used with Oracle Linux KVM.
How the Utilities Alter the Image
The utilities verify the virtual machine's operating system is supported, and perform necessary changes to ensure it runs correctly as a compute instance on Oracle Cloud Infrastructure. To learn more about the changes that these utilities automate, refer to Bring Your Own Device (BYOI).
Migrating an Image with oci-image-migrate
Install the oci-image-migrate
utitilies, convert any physical installations to a virtual disk image, and migrate the virtual disk image to Oracle Cloud Infrastructure.
Installing the Migration Utilities
Install the utilities on the host system before migrating.
Oracle Linux 8
-
Enable the
ol8_addons
yum repository for Oracle Linux 8:sudo dnf config-manager --enable ol8_addons
-
Update your system by using the
dnf update
command, then install the required packages:sudo dnf update -y sudo dnf install -y python36-oci-sdk python36-oci-cli oci-utils-migrate
-
If you intend to migrate a physical installation, install the qemu-img package:
sudo dnf install -y qemu-img
Oracle Linux 7
-
Enable the
ol7_addons
and theol7_kvm_utils
repositories for Oracle Linux 7:sudo yum-config-manager --enable ol7_addons ol7_kvm_utils
-
Update your system by using the
yum update
command, then install the required packages:sudo yum update -y sudo yum install -y python36-oci-sdk python36-oci-cli oci-utils-migrate
-
If you intend to migrate a physical installation, install the qemu-img package:
sudo yum install -y qemu-img
Converting a Physical Installation to a Virtual Disk Image
To migrate a physical installation, create a raw disk image and then convert it into a virtual hard disk format (either VMDK or QCOW2). You can then follow the instructions in Migrating a Virtual Disk Image.
Create the Raw Disk Image
-
Before shutting down the physical machine to create the image, temporarily include all device drivers in the initial ramdisk (initramfs):
sudo dracut --force --no-hostonly
-
After powering down the physical machine, use a recovery system to create a disk image to an external location:
sudo dd if=device_or_volume of=path_to_image bs=4M status=progress conv=sync,noerror
- Select a disk format VMDK (compatible with Oracle VM Virtualbox) or QCOW2 (compatible with Oracle Linux KVM), and then convert the disk image.
Option 1: Convert to Virtual Machine Disk Format (VMDK)
-
Convert your raw disk image to Virtual Machine Disk (VMDK) format. This file format is used for virtual hard disks that are compatible with Oracle VM Virtualbox.
qemu-img convert -f raw -p -O vmdk raw_disk_image exported_file.vmdk
-
Optionally test your virtual hard disk before packaging and importing it into Oracle Cloud Infrastructure.
For more information, refer to the Disk Image Files section in the Oracle VM VirtualBox documentation. For more information about the qemu-img command, refer to the qemu-img(1) manual page.
- Proceed to Migrating a Virtual Disk Image to Oracle Cloud Infrastructure.
Option 2: Convert to QEMU Copy-on-Write Format (QCOW2)
-
Convert your raw disk image to QEMU copy-on-write (QCOW2). This storage format is used for virtual hard disks that are compatible with Oracle Linux KVM.
qemu-img convert -f raw -p -c -O qcow2 raw_disk_image exported_file.qcow2
-
Optionally test your virtual hard disk before packaging and importing it into Oracle Cloud Infrastructure.
For more information, refer to the Working with Storage for KVM Guests chapter in the Oracle Linux KVM User's Guide.
- Proceed to Migrating a Virtual Disk Image to Oracle Cloud Infrastructure.
Migrating a Virtual Disk Image to Oracle Cloud Infrastructure
Use the oci-image-migrate
utilities to migrate a virtual disk image to an Oracle Cloud Infrastructure instance.
Prerequisites
Before migrating, ensure you have already:
- Configured Identity and Access Management.
- Created a bucket for Object Storage in your Oracle Cloud Infrastructure tenancy.
- Configured the Oracle Cloud Infrastructure SDK with your credentials for API access. See Setup and Prerequisites.
- Completed Converting a Physical Installation to a Virtual Disk Image (if migrating a physical host).
If you are new to Oracle Cloud Infrastructure, refer to the Getting Started section in the Oracle Cloud Infrastructure documentation.
Use the Utilities to Migrate the Image
- Complete the prerequisites.
- Verify and preprocess your virtual hard disk in either VMDK or QCOW2 format:
sudo oci-image-migrate -y -i unprocessed_virtual_hard_disk
- Upload your preprocessed virtual hard disk to an Oracle Cloud Infrastructure bucket as a custom image:
oci-image-migrate-upload -y -i processed_virtual_hard_disk -b bucket_name -o image_name
- Import the image file from object storage on your Oracle Cloud Infrastructure bucket to your custom images repository:
oci-image-migrate-import -y -i image_name -b bucket_name -c compartment_name
- If you migrated from a physical host, regenerate initramfs on each new instance by using your imported custom image:
sudo dracut --force
Migration Utilities Reference
Learn more details about each utility including a description, options, and usage examples.
oci-image-migrate
Description
Prepares an on-premise image for importing into Oracle Cloud Infrastructure. You must run this command as root.
The oci-image-migrate
utility supports the migration of image files in qcow2
and vmdk
format.
The utility does the following to prepare the image for migration:
- Verifies the prerequisites for importing the image.
- Disables the network interfaces except the primary network interface, which is set up as a DHCP client.
- Installs recommended packages, such as the
cloud-init
package. The list of packages that are installed are displayed in/etc/oci-utils/oci-migrate-conf.yaml
file. - Attempts to access remote servers hosting software repositories for the image being processed. The Domain Name Server (DNS) names servers and proxy settings must be able to reach the software repositories.
- Sets the default cloud user to
opc
.
Usage
oci-image-migrate [-i unprocessed_virtual_hard_disk | --input-image unprocessed_virtual_hard_disk] [-y | --yes] [-v | --verbose] [-h | --help}
Options
-i unprocessed_virtual_hard_disk | --input-image unprocessed_virtual_hard_disk
- Specify the full path for the unprocessed virtual hard disk. This option is mandatory.
-y | --yes
- Answer "yes" to prompts.
-v | --verbose
- Display detailed information during image processing on the terminal. This information can for troubleshooting errors or monitoring the status. This debugging information is also written to /var/tmp.
-h | --help
- Display a summary of the command line options.
Example
$ sudo oci-image-migrate /omv/data/images/ol79.vmdk -v
2021-03-30 20:38:38,177 - oci-utils.migrate-tools - DEBUG(migrate_tools:223) - __ Get config data: helpers_list
2021-03-30 20:38:38,205 - oci-utils.migrate-tools - DEBUG(migrate_tools:223) - __ Get config data: lc_all
...
oci-image-migrate-upload
Description
Uploads an on-premise image file to an object storage bucket in Oracle Cloud Infrastructure. This command does not require root privileges, provided you can access the object storage bucket in Oracle Cloud Infrastructure and have write privileges to the directories where the log and results files are written (/var/tmp/
).
Usage
oci-image-migrate-upload [-i processed_virtual_hard_disk | --input-image processed_virtual_hard_disk] [-b bucket_name | --bucket-name bucket_name] [-o output_name | --output-name output_name] [-y | --yes] [-v | --verbose] [-h | --help}
Options
-i processed_virtual_hard_disk | --input-image processed_virtual_hard_disk
- Specify the full path for processed virtual hard disk. This option is mandatory.
-b bucket_name | --bucket-name bucket_name
- Specify the name of the object storage bucket in Oracle Cloud Infrastructure to store the image file. This option is mandatory.
-o output_name | --output-name output_name
- Specify the name of the image file to be used in object storage. If not specified, the name of the processed virtual hard disk is used as the image name.
-y | --yes
- Answer "yes" to prompts.
-v | --verbose
- Display detailed information during image upload processing on the terminal. Use this information for troubleshooting errors or monitoring the status. This debugging information is also written to
/var/tmp
.
-h | --help
- Display a summary of the command line options.
Example
$ oci-image-migrate-upload -v -i /omv/data/images/ol79.vmdk -b test_bucket_001 -o ol79_demo.qcow2
Uploading ol79.vmdk -b test_bucket_001 -o ol79_demo.qcow2 at Thu Mar 25 20:44:16 2021
Uploading /omv/data/images/ol79.vmdk to object storage test_bucket_001 in the Oracle Cloud Infrastructure as ol79_demo.qcow2
Object storage test_bucket_001 present.
Agree to proceed uploading /omv/data/images/ol79.vmdk to test_bucket_001 as ol79_demo.qcow2? (y/N) y
Uploading /omv/data/images/ol79.vmdk, this may take a while....
00:03:12 [ uploading ol79_demo.qcow2
oci-image-migrate-import
Description
Imports an image from object storage to custom images repository in Oracle Cloud Infrastructure. This command does not require root privileges, provided you can access the object storage bucket in Oracle Cloud Infrastructure and have write privileges to the directories where the log and results files are written (/var/tmp/
).
Usage
oci-image-migrate-import[-i image_name | --input-image image_name] [-b bucket_name | --bucket-name bucket_name] [-c compartment_name | --compartment_name compartment_name] [-d display_name | display-name display_name] [-l launch_mode | launch-mode launch_mode] [-y | --yes] [-v | --verbose] [-h | --help}
Options
-i image_name | --input-image image_name
- Specify the name of the image to import as a custom image. This option is mandatory.
-b bucket_name| --bucket-name bucket_name
- Specify the name of the object storage bucket in Oracle Cloud Infrastructure where the image file is stored. This option is mandatory.
-c compartment_name | --compartment-name compartment_name
- Specify the name of the destination compartment. This option is mandatory.
-d display_name | --display-name display_name
- Specify the name to be displayed for the custom image in the custom images repository in Oracle Cloud Infrastructure. If this parameter is not specified, the image name is used as the display name.
-l launch_mode | --launch-mode launch_mode
- Specify the launch mode that the custom image uses when launched. Possible values are
PARAVIRTUALIZED
,EMULATED
, andNATIVE
. If a mode is not specified, the default isPARAVIRTUALIZED
.
-v | --verbose
- Display detailed information during image import processing on the terminal. Use this information for troubleshooting errors or monitoring the progress. This debugging information is also written to
/var/tmp
.
-y | --yes
- Answer "yes" to prompts.
-h | --help
- Display a summary of the command line options.
Example
$ oci-image-migrate-import -v -y -i ol79_demo.qcow2 -b test_bucket_001 -c OLimages -d ol79_demo
Importing ol79_demo.qcow2 from test_bucket_001 into test_bucket_001 as ol79_demo and setting launch mode as PARAVIRTUALIZED
Object storage namespace: IMAGETEST
Compartment: OLimages
Object storage test_bucket_001 present.
Import ol79_demo.qcow2 to OLimages as ol79_demo y
00:00:05 [ importing ol79_demo
Additional Migration Information
- To discover how to create and configure new instances with your custom image, see Post-Import Tasks for Linux Images.
- To migrate your on-premise servers to dedicated bare metal instances, see Bring Your Own Image (BYOI).
- To migrate your Oracle VM VirtualBox virtual machines, see Exporting an Appliance to Oracle Cloud Infrastructure.
Oracle Linux Learning Resources
Use these resources to learn more about Oracle Linux.
- General Oracle Linux Documentation
- The general Oracle Linux documentation is not specific to Oracle Cloud Infrastructure but most of the content still applies.
- Training Resources
-
Use the following Oracle Linux training resources to grow your skillset using free videos and hands-on tutorials and labs.
- Blogs and Community Forums
- Use these resources to track features highlighted by Oracle or to reach other community users for more help and information.