Difference between revisions of "Automated Android OS deployment with openQRM IaaS Cloud"

From openQRM
 
Line 245: Line 245:
 
You have successfully completed this How-To!
 
You have successfully completed this How-To!
  
====== NOTE AGAIN ======
+
'''NOTE AGAIN'''
 +
 
 
The Android OS support in openQRM is only available in the openQRM Enterprise Edition >= 5.1.4!
 
The Android OS support in openQRM is only available in the openQRM Enterprise Edition >= 5.1.4!

Latest revision as of 11:47, 3 November 2020

This How-to is about how to provide Android system "on demand" with a private openQRM Cloud.

Requirements

  1. One physical Server - at least 1 GB of Memory
  2. At least 100 GB of Diskspace
  3. 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

NOTE

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

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.

mkdir /iso
cd /iso
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.

Add new server

In the second server wizard step please select "New resource"

Select 'New Resource'

Select the type of Virtual Machine you would like to create. Here we choose "KVM VM (localboot).

Type of Virtual Machine

Now select your KVM Host. In the VM overview please click on "Add local VM".

VM Overview

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).

Create VM form

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".

Boot from ISO Image

The next step will continue with the server wizard. Simply select the newly created VM resource.

Server Wizard

When configuring the image for the server please click on "new image".

Click 'New Image'

In the image type selection choose "LVM deployment for KVM".

Image type selection

Now please select the KVM storage from the type "KVM LVM Storage".

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.

Device-manager plugin

In the LVM volume overview please click on "add new logical volume".

LVM volume overview

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.

Create Volume form

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.

Click Submit

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".

Set custom password

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.

Server overview

Please confirm starting the server.

Start 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.

Click 'NoVNC'

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.

Grub Menu

When the installer starts please select "create/modify partitions"

Create/Modify Partitions

Select "new" to create a new partition.

Create New partition

Select "primary".

Select Primary

Make sure to set the "bootable" flag.

Bootable flag

Now select "write" and confirm to setup the partition.

Confirm partition setup

Back in the Android installer select the just created new partition sda1.

Select new partition

Please select "ext3" as the filesystem type for this partition.

Select 'ext3'

Confirm with "Yes" to create the filesystem.

Create filesystem

Also select "Yes" when the installer asks if to install the grub boot-manager.

Install 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.

Select Yes

4. After Android Installation

When the Android installation is finished please select "reboot".

Csm 031 android 0244316552.png

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.

Update VM configuration

In the server list please stop the server.

Stop the Server

Confirm stopping the server.

Confirm stopping the server

Now please go to

Plugins -> Virtualization -> KVM -> VMs

select the KVM Host and click on "edit"

Select KVM host

In the VM overview please click on "update" of the server's VM.

Update Server 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.

Set boot sequence to boot from Local

Here is the first boot screen of the Android OS running in the KVM VM.

First Boot screen

In the Wi-Fi selection please click on "skip".

Click 'Skip'

In the "Got Google" dialog please click on "No" and "remind me later".

Select 'No'

In the next "Google location" dialog use the right arrow to go on.

Click the right arrow

Set date and time.

Set date and time

And create a user.

Create a user

The Android OS will now further boot up.

Android OS booting

Here is the Android start-up screen. Go to the application by the middle button in the Android UI.

Android Start-up screen

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.

Click on the "terminal emulator" app

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:

umount /mnt
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.

Passwordless login

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

Private image manager

And set the Android "master image" to be used by "Everybody".

Android master image

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.

openQRM administration UI

In the Cloud user dashboard please click on "new instance".

New Instance

In the "instance create" form please select the "android44" image and adjust cpu, disk, memory and network according to your needs.

Adjust resources

The instance is now going to start. While starting it goes through the following phases:

  • approve
  • create
  • start
  • active
Instance starting

Here is the permission and limits overview while the instance is still starting.

Permission and limits overview

Here is the permissions and limits overview when the instance is fully up and running.

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.

Click on "NoVNC"

Here again the Android UI after fully started up in the openQRM Cloud, requested and cloned from the "master image" on demand.

Android UI after fully started up

Please open up the "terminal emulator" app again.

Open Terminal Emulator

In the terminal run

su

to get root access

Click 'Allow'

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".

Network configuration of the Android OS

Congratulations!!

You have successfully completed this How-To!

NOTE AGAIN

The Android OS support in openQRM is only available in the openQRM Enterprise Edition >= 5.1.4!