Home / Articles

Alpine Linux on Oracle Cloud


Oracle Cloud Free Tier allows user to run several types of virtual machines for free. At the time of writing, Oracle provides limited number of Linux-based images (CentOS, Oracle Linux, and Ubuntu). This article describes the installation of Alpine Linux on Oracle Cloud.

Create a Linux-based instance

First create a Linux-based instance, for example, using the CentOS 7 image. Enable the option which assigns a public address to the instance so that you can access it through SSH.

Once the instance is ready, login the instance using SSH.

Download and boot from Alpine Linux ISO image

On the instance, download the Alpine Linux ISO image. For example:

curl -O 'http://dl-cdn.alpinelinux.org/alpine/v3.10/releases/x86_64/alpine-virt-3.10.2-x86_64.iso'

The URLs of ISO images can be found on the official Alpine Linux download page.


Once the ISO image has been downloaded, write the ISO image to the disk. First identify the disk name. Run:


The output should be similar to the following:

sda      8:0    0 46.6G  0 disk
├─sda1   8:1    0  512M  0 part /boot/efi
├─sda2   8:2    0    8G  0 part [SWAP]
└─sda3   8:3    0 38.1G  0 part /

Write the ISO image to the disk /dev/sda:

dd if=alpine-virt-3.10.2-x86_64.iso of=/dev/sda

After the ISO image has been written, disconnect from the instance.

Connect to instance through console connection

Create a console connection to the instance. For example, create a serial console connection. This allow you to manage the instance during the Alpine Linux installation process.

Note that when creating a serial console connection to connect to the instance, you will be asked to provide the public key of a keypair. You may need to specify the corresponding private key when connecting to the serial console connection. For example:

ssh -i ~/.ssh/opc.rsa \
  -o ProxyCommand='ssh -i ~/.ssh/opc.rsa \
    -W %h:%p \
    -p 443 \
    ocid1.instanceconsoleconnection.oc1.ap-tokyo-1.aaaaa@instance-console.ap-tokyo-1.oraclecloud.com' \

Replace ~/.ssh/opc.rsa with the path of the private key.

Once connected to the instance through the console connection, you should be able to see the login prompt. For example:

CentOS Linux 7 (Core)
Kernel 3.10.0-1062.1.1.el7.x86_64 on an x86_64

opc001 login:

Install Alpine Linux

Now in the instance details page, click the Reboot button. Through the console connection, you should be able to see the system being rebooted.

Grub2 menu.

Alpine Linux will be running from RAM. Login as root. Copy required files from the ISO image, which are on the disk, into RAM.

mkdir /media/setup
cp -a /media/sda/* /media/setup
mkdir /lib/setup
cp -a /.modloop/* /lib/setup

When the files have been copied. Unmount the disk.

/etc/init.d/modloop stop
umount /dev/sda

Move the copied files to the appropriate location.

mv /media/setup/* /media/sda/
mv /lib/setup/* /.modloop/

Run the following command to start installing Alpine Linux:


During the installation, select the disk attached to the instance.

Available disks are:
  sda   (50.0 GB ORACLE   BlockVolume     )
Which disk(s) would you like to use? (or '?' for help or 'none') [none] sda

Use sys mode to install the system to the disk.

The following disk is selected:
  sda   (50.0 GB ORACLE   BlockVolume     )
How would you like to use it? ('sys', 'data', 'lvm' or '?' for help) [?] sys

After the system has been installed, you can connect to the instance again through SSH, and the console connection can be deleted.