Automated Android OS deployment with openQRM IaaS Cloud
This How-to is about how to provide Android system "on demand" with a private openQRM Cloud.
- One physical Server - at least 1 GB of Memory
- At least 100 GB of Diskspace
- VT (Virtualization Technology) enabled in the Systems BIOS so that the openQRM Server can run Virtual Machines later
NOTE The Android OS support in openQRM is only available in the openQRM Enterprise Edition >= 5.1.4!
1. Install openQRM
For this How-To, we assume you have successfully installed openQRM and have at least referenced our Cloud Computing with openQRM on Debian How-To before. If not, it is highly suggested to complete both before continuing
For this How-To we have used an additional physical System as a KVM Virtualization host, simply integrated in openQRM via the "local-server" plugin. The setup is also possible If you have just one system and use the openQRM server itself as the KVM Host.
2. Downloading Android
Here is the fully installed openQRM server
As install preparation, please login to your KVM Host as "root" and execute the following commands to download the android-x86-4.4-RC2.iso installation iso file for the Android installation in a VM.
wget -O android-x86-4.4-RC2.iso sourceforge.net/projects/android-x86/files/Release%204.4/android-x86-4.4-RC2.iso/download
3. Installing Android
We now start by creating a new server for the Android OS installation. The image of this server is later used as a "master-image" for the openQRM Cloud. Please go to:
Datacenter -> Server -> Add new server.
Provide a name (here "android44") and a description.
In the second server wizard step please select "New resource"
Select the type of Virtual Machine you would like to create. Here we choose "KVM VM (localboot).
Now select your KVM Host. In the VM overview please click on "Add local VM".
In the create VM form please select at least 2 GB memory. Also make sure you set the "Disk interface" for the virtual disk image to "IDE" (virtio support in Android is still experimental).
You can leave the "Network card type" to "virtio". This will work fine even without the virtio support in the Android OS.
Further down in the VM create form select to boot from an ISO image and use the file-picker to pick the ISO file to boot from on the KVM Host. Also provide a VNC password and adjust the vnc-keymapping to your needs. Then click on "submit".
The next step will continue with the server wizard. Simply select the newly created VM resource.
When configuring the image for the server please click on "new image".
In the image type selection choose "LVM deployment for KVM".
Now please select the KVM storage from the type "KVM LVM Storage".
This presents an overview about all the existing LVM volume groups on this storage. Please select one volume group to create the new image on. Here we choose the "lvols" LVM volume group.
If you haven't setup LVM on your KVM storage Host yet click on "add volume group" which will open up the device-manger plugin to setup and manage the attached storage devices with LVM.
In the LVM volume overview please click on "add new logical volume".
In the "create volume" form please provide the volume size (in MB). Here we go with 2000 MB which is sufficient to install the Android OS.
The volume size is fully adjustable and provides an automated LVM-resize and filesystem resize for the first partition of the volume. This functionality is also available for "snap" and "clone" actions. Please notice that due to the technical implementation of LVM, snapshots can only be resized smaller or equal to the "master volume" while the LVM clone action allows resizing to a bigger size than the "master".
For Cloud deployment the preferred deployment action (snap or clone) can be configured in the KVM plugins configuration options in the plugin manager.
Creating the new volume and its image object in openQRM continues with the server wizard. Please click on submit on the pre-selected just created image.
In the "image edit" section you can set a custom password for the image console- and ssh login. Please notice that for Windows OS installation on an image the image type should be set to "windows" instead of "linux".
The previous action finalizes the server wizard and forwards to the server list. Click on the "start" button of the new created server.
Just for info:
Starting a server will "combine" the "resource" with the "image" configured in the "server". Stopping a "server" will automatically "separate" the "image" from the "resource". That way each of the objects in openQRM become completely independent from each other and e.g. can be re-combined with different or updated sub-objects. Also this makes it very straight forward to e.g. restart an "image" with a different "resource" (even with a different resource type in case of P2V/V2P) in case of a automatic high-availability fail-over event.
Please confirm starting the server.
When the server is started please click on the "NoVNC" in the server action tab. This will open up a VNC console in the web-browser and allows to install the Android OS.
Here's the VNC console of the VM. In the Grub menu of the starting VM booting from the Android installation iso please select the last option "Installation - install Androidx86 to hard disk" and press return.
When the installer starts please select "create/modify partitions"
Select "new" to create a new partition.
Make sure to set the "bootable" flag.
Now select "write" and confirm to setup the partition.
Back in the Android installer select the just created new partition sda1.
Please select "ext3" as the filesystem type for this partition.
Confirm with "Yes" to create the filesystem.
Also select "Yes" when the installer asks if to install the grub boot-manager.
In the following dialog also select "Yes" for making the system partition of the Android OS read+writeable. This is useful (and needed) to adjust the Android image later.
4. After Android Installation
When the Android installation is finished please select "reboot".
Please remember that the VM configuration is still set to boot from the installation iso!
Therefore it is now recommended to stop the automated boot of the Android installation iso since this will boot into a live-system from the iso but not from the disk.
We are going to update the VM configuration to boot from local disk in the next step.
In the server list please stop the server.
Confirm stopping the server.
Now please go to
Plugins -> Virtualization -> KVM -> VMs
select the KVM Host and click on "edit"
In the VM overview please click on "update" of the server's VM.
Now set the boot sequence to boot from "local" and click on submit. After that please go back to the server list and start the server. When the server is started click again on the "NoVNC" action button of the server.
Here is the first boot screen of the Android OS running in the KVM VM.
In the Wi-Fi selection please click on "skip".
In the "Got Google" dialog please click on "No" and "remind me later".
In the next "Google location" dialog use the right arrow to go on.
Set date and time.
And create a user.
The Android OS will now further boot up.
Here is the Android start-up screen. Go to the application by the middle button in the Android UI.
Click on the "terminal emulator" app icon to start a terminal session.
In the terminal you can use "su" to get root access.
Please follow the next steps to configure SSH access and install the "openQRM client for Android" in the image.
5. Enable sshd
To get access the the Android OS filesystem use "kpartx" to mount the first partition of the logical volume. This should be only done when the image is not in use by an active VM, so the first thing is to stop the server.
Please go to the server list and stop the "android44" server.
Then please run on your KVM host in a root terminal:
kpartx -av /dev/lvols/android44
mount /dev/mapper/lvols-android44p1 /mnt/
ssh-keygen -b 2048 -C android44 -t rsa -f ssh_host_rsa_key
(when it asks for a passphrase just press return)
ssh-keygen -b 1024 -C android44 -t dsa -f ssh_host_dsa_key
(when it asks for a passphrase just press return)
Now copy all generated file to /mnt/android-4.4-RC2/data/ssh/
cp ssh_host* /mnt/android-4.4-RC2/data/ssh/
Also download the "sshd_config" file for the Android OS from the Android plugin's usage page and copy it to /mnt/android-4.4-RC2/data/ssh/
cp sshd_config /mnt/android-4.4-RC2/data/ssh/
Finally add your personal public key to /mnt/android-4.4-RC2/data/.authorized_keys
cat /root/.ssh/id_rsa.pub > /mnt/android-4.4-RC2/data/.authorized_keys
The sshd service on the Android OS will be automatically started by the openQRM Client for Android which is explained as the next step.
6. Install the openQRM Client for Android OS
Download the openQRM Client for Android OS from the Android plugin's usage page.
Copy it to /mnt/android-4.4-RC2/data/openqrm-client-android.sh
cp openqrm-client-android.sh /mnt/android-4.4-RC2/data/
To automatically start the openQRM Client for Android follow the steps below:
1) Create a directory /mnt/android-4.4-RC2/system/vendor/etc
mkdir -p /mnt/android-4.4-RC2/system/vendor/etc
2) Create a file "init.sh" in this directory with the following command:
echo "sh -x /data/openqrm-client-android.sh" > /mnt/android-4.4-RC2/system/vendor/etc/init.sh
Now please umount the Android filesystem and release kpartx with the following commands:
kpartx -dv /dev/lvols/android44
Now please start the server again.
After the above configuration we can now passwordless login to the Android system by ssh.
The Android "master image" for Cloud deployment is now configured and ready to use. Please go the the server list again and stop the server.
Then go to
Plugins -> Cloud -> Configuration -> Private Images
And set the Android "master image" to be used by "Everybody".
Go to the openQRM Cloud login page
Plugins -> Cloud -> Portal
and login to the Cloud.
Please notice that enabling the Cloud automatically creates an "admin" project with the "openqrm" user and the same password as set for the openQRM administration UI.
In the Cloud user dashboard please click on "new instance".
In the "instance create" form please select the "android44" image and adjust cpu, disk, memory and network according to your needs.
The instance is now going to start. While starting it goes through the following phases:
Here is the permission and limits overview while the instance is still starting.
Here is the permissions and limits overview when the instance is fully up and running.
In the Instance overview in the Cloud portal please click on "NoVNC" to gain console access to the Android OS.
Here again the Android UI after fully started up in the openQRM Cloud, requested and cloned from the "master image" on demand.
Please open up the "terminal emulator" app again.
In the terminal run
to get root access
Here is the network configuration of the Android OS started in the openQRM Cloud. Please notice the correctly configured external IP address to be accessible by the Cloud users "remotely".
You have successfully completed this How-To!
The Android OS support in openQRM is only available in the openQRM Enterprise Edition >= 5.1.4!