Oracle Enterprise Linux 7.9 on Azure User Guide
Videos
Overview
This guide covers the deployment and configuration of Oracle Enterprise Linux 7.9 on Microsoft Azure using cloudimg's virtual machine image from the Azure Marketplace (offer prod-cp5axd4hiqqq2).
Oracle Linux is a free, enterprise grade Linux distribution built by Oracle to be binary compatible with Red Hat Enterprise Linux 7. Oracle provides the binaries at no cost and permits redistribution, so there is no subscription and no licence key needed to use or patch it.
This image is an established Oracle Linux 7.9 system that has taken updates from the Oracle Linux 7 channels. A first boot script applies the security errata at every boot; Step 6 shows how to bring the whole machine, kernel included, up to date.
⚠️ End of life status — read before deploying
Oracle Linux 7 reached the end of Oracle Premier Support in December 2024. 7.9 (October 2020) is the final Oracle Linux 7 release: there is no 7.10. Oracle's paid Extended Support for Oracle Linux 7 runs to July 2029; the free public channel no longer receives new Oracle Linux 7 errata. This image is a fixed baseline for legacy applications and compatibility testing that still need an Oracle Linux 7 or RHEL 7 base. It is not a system that keeps itself patched.
You own ongoing patching. For continued security updates, take an Oracle Linux Extended Support subscription, or plan a migration to a supported release such as Oracle Linux 8, 9 or 10.
What's included:
- Oracle Linux 7.9, binary compatible with RHEL 7
- The Unbreakable Enterprise Kernel Release 6 (5.4, booted by default) and the Red Hat Compatible Kernel (3.10)
- A first boot script that applies the security errata available on the enabled channels, without kernel changes
ol7_latest,ol7_UEKR6,ol7_addons, EPEL and Azure CLI repositories enabled- Azure Linux Agent (waagent) and cloud-init 19.4 for Azure provisioning
- Azure CLI 2.38 and Python 3.6
- Chronyd for NTP time synchronisation
- Generation 1 (BIOS) Hyper V virtual machine, with accelerated networking supported
- cloudimg's support team on hand 24 hours a day by email (support@cloudimg.co.uk), with a guaranteed response within 24 hours
Platform: Microsoft Azure (Generation 1 Hyper V)
Default user: azureuser
Prerequisites
Before deploying this image, ensure you have:
- An active Microsoft Azure subscription
- The Azure CLI, installed locally or in Azure Cloud Shell
- An SSH key pair for Linux VM access
- Familiarity with Azure VM management
Step 1: Deploy the Virtual Machine
Deploy the image by its Marketplace URN. The image carries a purchase plan, so accept its terms once per subscription first:
az vm image terms accept --urn cloudimg1647283583153:prod-cp5axd4hiqqq2:prod-cp5axd4hiqqq2:latest
az vm create \
--resource-group myResourceGroup \
--name my-oel-7-9-vm \
--image cloudimg1647283583153:prod-cp5axd4hiqqq2:prod-cp5axd4hiqqq2:latest \
--admin-username azureuser \
--generate-ssh-keys \
--public-ip-sku Standard
Add --size with the size your workload needs. This is a Generation 1 image. The Azure CLI may print a warning that new virtual machines default to Trusted Launch; with this image the machine is still created as a standard Generation 1 virtual machine, and the warning needs no action. The image supports accelerated networking, which az vm create turns on for sizes that offer it.
Step 2: Connect via SSH
Run these on your own workstation, not on the VM. Find the public IP, then connect:
az vm show --resource-group myResourceGroup --name my-oel-7-9-vm --show-details --query publicIps -o tsv
ssh azureuser@<vm-ip>
There is no password to enter. If SSH asks you for one, the key you supplied at create time is not the key your client is offering.
Your first login prints a Last login line dated December 2023 from azure-bastion.internal.cloudapp.net. That line comes from the login history the image was built with, not from anyone using your machine.
Step 3: Give the machine its own SSH host keys and machine ID
Do this first, before you rely on the machine. The SSH host keys and the systemd machine ID in this image were created when the image was built, and they are not regenerated at first boot, so every virtual machine deployed from this image starts with the same host keys and the same machine ID. Replace them with ones unique to your machine:
sudo rm -f /etc/ssh/ssh_host_*
sudo /usr/sbin/sshd-keygen
sudo systemctl restart sshd
sudo rm -f /etc/machine-id
sudo systemd-machine-id-setup
Expected output:
Generating SSH2 RSA host key: [ OK ]
Generating SSH2 ECDSA host key: [ OK ]
Generating SSH2 ED25519 host key: [ OK ]
Initializing machine ID from random generator.
Your current session stays open. The next time you connect, your SSH client warns that the remote host identification has changed, because the machine now presents its new keys. That warning is expected exactly once, after this step. Remove the old entry on your workstation, then connect again and accept the new key:
ssh-keygen -R <vm-ip>
ssh azureuser@<vm-ip>
Step 4: Remove the migration leftovers
The image still carries the Azure Site Recovery mobility agent (InMageVx) from the way it was migrated into Azure, together with its kernel driver, boot hooks and configuration backups, and a few files left from an earlier life on AWS. None of it does anything useful on your machine: the agent's vxagent service fails at every boot, and its involflt driver is built into every kernel's initramfs. Remove it before the full update in Step 6, so that the new kernel is set up without it.
The first boot script (Step 6) holds the yum lock for a few minutes after each boot. If the yum remove below prints Another app is currently holding the yum lock, it waits and then continues on its own.
Check the failed units first:
systemctl --failed --no-legend
Expected output on a fresh machine:
vxagent.service loaded failed failed SYSV: This script is the daemon script for volume replication agent
Remove the Azure Site Recovery agent
Remove the package, its init scripts, units, udev rules, dracut module, kernel driver, directories, and the backups of system files it made:
sudo yum -q -y remove InMageVx
for s in vxagent uarespawnd boottimemirroring_phase1 boottimemirroring_phase2 vConService_linux; do sudo chkconfig --del $s 2>/dev/null; sudo rm -f /etc/init.d/$s; done
sudo systemctl disable asr-installga.service involflt_start.service involflt_stop.service
sudo rm -f /etc/systemd/system/involflt_start.service /etc/systemd/system/involflt_stop.service /etc/udev/rules.d/09-inm_udev.rules /etc/udev/rules.d/75-persistent-net-generator.rules-INMAGE-ORG
sudo rm -f /boot/*-INMAGE_ORG /boot/Configuration.info /etc/fstab-INMAGE_ORG /etc/default/grub-INMAGE-ORG /etc/sysconfig/kernel-INMAGE_ORG /etc/sysconfig/network-INMAGE-ORG /InMageAgent* /usr/local/drscout.conf /var/log/InMage_drivers.log /var/log/involflt_telemetry_completed_*.log
sudo rm -rf /usr/local/InMage /usr/local/asr-installga /etc/vxagent /usr/lib/dracut/modules.d/95involflt /boot/ce-grub /boot/lvm_backup /boot/lvm_backup_tmp /var/log/ApplicationData
sudo find /lib/modules -name involflt.ko -delete
While removing the package, yum prints warning: file /tmp/MobSvcInstaller/...: remove failed lines; they refer to installer files that are already gone and are harmless. systemctl disable prints a Removed symlink line for each of the three units.
Remove the AWS leftovers
The image also holds an unused copy of the AWS CLI version 2 (not on the PATH), old AWS Systems Manager agent logs and a sudo rule for an ssm-user account that does not exist. Remove them:
sudo rm -rf /usr/local/aws-cli /opt/aws /var/log/amazon /etc/sudoers.d/ssm-agent-users
Rebuild the boot files
Rebuild the kernel module lists and every initramfs without the removed driver, then reload systemd. The dracut run takes a few minutes and prints nothing:
for k in $(ls /lib/modules); do sudo depmod -a "$k"; done
sudo dracut -f --regenerate-all
sudo systemctl daemon-reload
sudo systemctl reset-failed
systemctl --failed --no-legend
rpm -q InMageVx
The last two commands print nothing for the failed units, meaning none is left, and package InMageVx is not installed. Carry on to Steps 5 and 6 without rebooting: the full update in Step 6 installs the kernel the machine boots next and makes it the default.
Remove the unused cloud-user account
The image also creates the cloud-init default account cloud-user, which has no password, no SSH key and passwordless sudo. If you do not use it, remove the account and its sudo rules:
sudo userdel -r cloud-user
sudo sed -i '/^cloud-user /d' /etc/sudoers.d/90-cloud-init-users
getent passwd cloud-user
sudo visudo -c
userdel reports /var/spool/mail/cloud-user not owned by cloud-user, not removing and exits with code 12; the account and its home directory are removed all the same, as getent passwd cloud-user (which then prints nothing) confirms. visudo -c ends with /etc/sudoers.d/90-cloud-init-users: parsed OK.
Step 5: Confirm the release
cat /etc/oracle-release
grep -E '^(NAME|VERSION|ID|VERSION_ID)=' /etc/os-release
uname -rm
rpm -q oraclelinux-release redhat-release-server
Expected output:
Oracle Linux Server release 7.9
NAME="Oracle Linux Server"
VERSION="7.9"
ID="ol"
VERSION_ID="7.9"
5.4.17-2136.316.7.el7uek.x86_64 x86_64
oraclelinux-release-7.9-1.0.9.el7.x86_64
redhat-release-server-7.9-6.0.1.el7_9.x86_64
The el7uek tag on the kernel shows the machine is running the Unbreakable Enterprise Kernel. The Red Hat Compatible Kernel (3.10 el7) is installed alongside it:
rpm -q kernel kernel-uek
Expected output:
kernel-3.10.0-1160.el7.x86_64
kernel-3.10.0-1160.66.1.el7.x86_64
kernel-3.10.0-1160.83.1.0.1.el7.x86_64
kernel-uek-5.4.17-2136.307.3.6.el7uek.x86_64
kernel-uek-5.4.17-2136.308.9.el7uek.x86_64
kernel-uek-5.4.17-2136.316.7.el7uek.x86_64
Step 6: Updates and the first boot script
At every boot, root's crontab runs /stage/scripts/initial_boot_update.sh, which applies the security errata available on the enabled channels, leaving out kernels and the release package:
sudo crontab -l
cat /stage/scripts/initial_boot_update.sh
Expected output:
@reboot /stage/scripts/initial_boot_update.sh
#!/bin/bash
yum -y update --security --exclude=kernel* --exclude=oraclelinux-release >> /stage/scripts/initial_boot_update.log
On a fresh machine this run takes a few minutes after boot, and other yum commands wait for its lock until it finishes. It does not bring the machine fully up to date. Afterwards, yum check-update still lists pending updates (exit code 100), including the newer kernels, the Azure Linux Agent, cloud-init and a newer build of the release package:
sudo yum -q check-update; echo "exit code: $?"
List the enabled repositories:
yum -q repolist enabled
Expected output:
repo id repo name status
azure-cli Azure CLI 123
epel/x86_64 Extra Packages for Enterprise Linux 7 - x86_64 13,791
ol7_UEKR6/x86_64 Latest Unbreakable Enterprise Kernel Release 6 for Orac 1,401
ol7_addons/x86_64 Oracle Linux 7Server Add ons (x86_64) 981
ol7_latest/x86_64 Oracle Linux 7Server Latest (x86_64) 27,429
To apply everything the channels carry, including the kernels, run a full update and reboot:
sudo yum -y update
sudo systemctl reboot
The image's kernel settings (DEFAULTKERNEL=kernel-uek in /etc/sysconfig/kernel) make the newest Unbreakable Enterprise Kernel the default when it is installed. After the reboot, the machine runs that kernel, yum check-update returns exit code 0, meaning nothing further is available from the enabled channels, and no unit has failed:
cat /etc/oracle-release
uname -r
sudo yum -q check-update; echo "exit code: $?"
systemctl --failed --no-legend
Expected output:
Oracle Linux Server release 7.9
5.4.17-2136.338.4.2.el7uek.x86_64
exit code: 0
Right after the reboot, the first boot script runs again, so yum check-update may first print Another app is currently holding the yum lock; waiting for it to exit... and the details of that run. It waits for the lock and then reports as above.
Because Oracle Linux 7 is end of life, a machine with nothing left to apply is caught up only with the frozen free channel. It is not free of vulnerabilities found after that channel stopped receiving errata.
Step 7: Security posture
getenforce
sudo sshd -T | grep -E '^(pubkeyauthentication|passwordauthentication|challengeresponseauthentication) '
systemctl is-active firewalld
timedatectl | grep 'Time zone'
Expected output:
Disabled
pubkeyauthentication yes
passwordauthentication no
challengeresponseauthentication no
unknown
Time zone: America/New_York (EST, -0500)
- SSH is key only. Password and challenge response logins are disabled. The root and
azureuserpasswords are locked. A key login asrootis refused with a message asking you to log in asazureuser. - SELinux is disabled on this image (
SELINUX=disabledin/etc/selinux/config). If your policy needs SELinux, plan to enable it yourself, which needs a full filesystem relabel and a reboot. - The host firewall is off.
firewalldis installed but disabled and has never been started, which is whysystemctl is-activereportsunknown. The Azure Network Security Group is the only network control until you turn it on. - The time zone is
America/New_York. Set your own withsudo timedatectl set-timezone <zone>, for exampleUTC.
Root's entry in /etc/shadow still holds the locked password hash it was built with, the same on every machine from this image. It cannot be used to log in while locked. To remove it as well, so that no account stores a password hash:
sudo usermod -p '!!' root
sudo passwd -S root
passwd -S still reports Password locked.
To turn on the host firewall:
sudo systemctl enable --now firewalld
sudo firewall-cmd --list-all
The default public zone lists dhcpv6-client ssh under services, so your SSH session keeps working. To expose another service, open it in both the Azure NSG and firewalld, for example HTTPS:
sudo firewall-cmd --permanent --add-port=443/tcp
sudo firewall-cmd --reload
Step 8: Verify Azure integration
systemctl is-active waagent
systemctl is-enabled waagent
cloud-init --version
sudo cloud-init status
systemctl is-active chronyd
df -h / /boot
Expected output, after Steps 4 and 6:
active
enabled
/usr/bin/cloud-init 19.4
status: done
active
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 38G 6.1G 30G 18% /
/dev/sda1 2.0G 294M 1.5G 17% /boot
The used and available figures change as you install and update packages, and the disk can appear as sdb instead of sda (see Disk layout below).
waagent lets Azure run extensions and report VM health. cloud-init handles provisioning: it creates azureuser, installs your SSH key and runs any custom data you supply.
Run cloud-init status with sudo, as above. Without sudo, the cloud-init 19.4 build on Oracle Linux 7 (Python 2.7) stops with NameError: global name 'PermissionError' is not defined when it cannot read its root only status file. Provisioning itself completes, and sudo cloud-init status reports status: done.
Disk layout
| Device | Size | Use |
|---|---|---|
/dev/sda1 |
2 GB | /boot (ext4) |
/dev/sda2 |
38 GB | / root filesystem (ext4) |
/dev/sda3 |
10 GB | swap partition, not enabled (free -h shows 0B swap) |
/dev/sdb1 |
varies | /mnt, the Azure temporary resource disk |
The OS disk is 50 GB. The root partition is followed by the swap partition, so making the OS disk larger in Azure does not grow / on its own. The disk letters can change between boots: the OS disk is the one holding /, and the resource disk is the one mounted at /mnt. The resource disk's contents can be lost when the machine is stopped, resized or moved to another host.
Turn on swap
The swap partition is formatted but not in use. To use it, add it to /etc/fstab by its UUID, so it is found whatever letter the disk has, and turn it on. It stays on after a reboot:
echo "UUID=$(lsblk -no UUID,FSTYPE | awk '$2=="swap"{print $1}') swap swap defaults 0 0" | sudo tee -a /etc/fstab
sudo swapon -a
free -h | grep -i swap
Expected output:
UUID=aa5d882a-9eee-4bc4-8bf8-6ab63c341a75 swap swap defaults 0 0
Swap: 9G 0B 9G
Step 9: Networking
sudo ss -tlnp
On a fresh machine the only external listener is sshd on port 22. Postfix listens for local mail on the loopback address only ([::1]:25), and chronyd uses local port 323.
Step 10: Install software and add a user
Install packages from the enabled repositories in the usual way, for example:
sudo yum -y install git
To add another administrator, create the account with sudo adduser <name>, add it to the wheel group with sudo usermod -aG wheel <name>, then copy your public key into /home/<name>/.ssh/authorized_keys with mode 600 and the .ssh directory mode 700, owned by that user.
Scripts and log files
| Path | What it is |
|---|---|
/stage/scripts/initial_boot_update.sh |
The first boot script: a security errata update at every boot, without kernels or the release package |
/stage/scripts/initial_boot_update.log |
Its output; each boot appends to it |
/var/log/waagent.log |
The Azure Linux Agent log |
/var/log/cloud-init.log |
The cloud-init provisioning log |
On startup
At every boot, root's crontab entry @reboot /stage/scripts/initial_boot_update.sh runs the first boot script, which holds the yum lock for a few minutes. To stop it, remove that line from root's crontab:
sudo crontab -l | grep -v initial_boot_update.sh | sudo crontab -
sudo crontab -l
crontab -l then prints nothing, and the next boot runs no update on its own; you then apply updates yourself with sudo yum -y update.
Common Use Cases
- Hosting legacy applications that require an Oracle Linux 7 or RHEL 7 base
- Compatibility and regression testing against Oracle Linux 7
- Lift and shift of existing Oracle Linux 7 workloads to Azure
Troubleshooting
Cannot connect via SSH
- Verify the VM is in Running state in the Azure Portal
- Check that port 22 is allowed in the Network Security Group
- Ensure you are using the correct username:
azureuser - Verify your SSH key matches the one you supplied at create time. Password login is disabled, so a wrong key cannot fall back to a password prompt.
- If SSH reports that the remote host identification has changed right after Step 3, run
ssh-keygen -R <vm-ip>on your workstation and connect again. At any other time, treat that warning seriously and find out why the key changed.
A yum command waits for a lock after boot
The first boot script holds the yum lock for a few minutes after each boot. Wait for it to finish:
sudo tail -3 /stage/scripts/initial_boot_update.log
Azure agent not running
sudo systemctl status waagent
If it is not running, start it with sudo systemctl enable --now waagent.
Package manager issues
Refresh the metadata cache first:
sudo yum clean all
sudo yum makecache
If repositories are unreachable, check DNS resolution with getent hosts yum.oracle.com.
Important Notes
End of life. Oracle's Lifetime Support Policy lists Oracle Linux 7 with Premier Support ending in December 2024 and Extended Support ending in July 2029 (Oracle Lifetime Support Policy: Oracle Open Source Service Offerings). Oracle Linux 7.9, released in October 2020, is the last Oracle Linux 7 update (endoflife.date: Oracle Linux). This image is not kept patched by the free channel; you own ongoing patching. For continued security updates, take an Oracle Linux Extended Support subscription, or migrate to a supported release such as Oracle Linux 8, 9 or 10.
Oracle Linux is free and open source, and Oracle permits its redistribution. It is a distribution assembled from thousands of independently packaged components, each carrying its own terms, including the GPL, LGPL, MIT, BSD, Apache 2.0 and MPL; every package's terms are readable with rpm -qi <package>. No subscription, licence key or Red Hat entitlement is required.
Oracle and Oracle Linux are trademarks of Oracle Corporation. The names are used here only to identify the distribution this image contains. cloudimg is not affiliated with, endorsed by or sponsored by Oracle Corporation.
Support
For assistance with this image, email cloudimg support at support@cloudimg.co.uk. Our support team is on hand 24 hours a day, with a guaranteed response within 24 hours.
- Website: www.cloudimg.co.uk
- Product Catalogue: www.cloudimg.co.uk/products
- User Guides: www.cloudimg.co.uk/guides
- SLA: 24 hour response guaranteed