# Run on Google Cloud Platform (GCP) using QEMU

## Intro

This guide provides an alternative for running CoinGet/CoinSend on Google Cloud Platform (GCP) using QEMU. It needs a two-level nested virtual machine (VM) environment and install the Android operating system in the L2 VM to run CoinGet/CoinSend. Ultimately, you will still be able to connect directly to the Android operating system via any VNC viewer.\
\
Source: <https://cloud.google.com/compute/docs/instances/nested-virtualization/creating-nested-vms>

{% hint style="danger" %}
As this approach involves the use of open-source software, certain risks may still exist. **Therefore, please use it with caution and always download software from reliable sources**.
{% endhint %}

## A. Setting up VM instance

1. Run the following command in Google Cloud CLI to create an instance with the following minimum specification. You may adjust higher. We are using n1-standard-4 instance in this tutorial with the following specifications.

   * Ubuntu 20.04 or above
   * 2 GHz dual-core processor or above
   * Min 4GB memory or above (8GB recommended)
   * Min 256GB storage space

```
gcloud compute instances create <your-server-name-here> --enable-nested-virtualization --min-cpu-platform="Intel Haswell" --image-family=ubuntu-2204-lts --image-project=ubuntu-os-cloud --machine-type=n1-standard-4 --boot-disk-size=256
```

2. Log into your newly created instance and install QEMU by running the following command.

```
sudo apt update && sudo apt upgrade -y
```

```
sudo apt install -y qemu qemu-kvm
```

```
sudo adduser `id -un` kvm
```

```
sudo reboot
```

3. Download Android x86 iso file.

{% hint style="warning" %}
You can always find the latest version of the Android x86 ISO image in the official website: <https://www.android-x86.org/download>. However, please be aware that there may be risks, such as the ISO or download link being compromised. Always verify the authenticity of both the download link and the ISO image, and avoid downloading from unknown or untrusted sources. Alternatively, you may compile your own ISO image for added security.
{% endhint %}

```
wget https://sourceforge.net/projects/android-x86/files/Release%209.0/android-x86_64-9.0-r2.iso/download -O android-x86_64-9.0-r2.iso
```

4. Create an virtual drive. You may replace androidx86 with a custom name and remember to amend your shell script accordingly in step 5 ( **-drive file=\<your-custom-name>.img,if=virtio \\** ). You may also set the disk space higher as long as it is lower than your instance's disk space (as defined in step 1).

```
qemu-img create -f qcow2 androidx86.img 80G
```

5. Execute the following script to provision QEMU virtual machine. Alternatively, you may also run this script by saving it to a shell script file and execute it, or use the command virt-install in virt-manager to do so.\
   \
   Virtual Machine Manager: <https://virt-manager.org/>

```
qemu-system-x86_64 \
-enable-kvm \
-M q35 \
-m 10240 \
-smp 4 \
-cpu host \
-device usb-tablet \
-device usb-kbd \
-monitor stdio \
-boot menu\=on \
-net nic \
-net user \
-display vnc=:0,password=on \
-drive file=androidx86.img,if=virtio \
-cdrom android-x86_64-9.0-r2.iso
```

6. You will see the following prompt, insert **change vnc password** to set a VNC password, which will be used when **connecting to Android system via VNC viewer later (Step B.3)**. \
   \
   ![](https://3529283920-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fbq6zziU9PCtrTYtaegKj%2Fuploads%2FeHlnyhxK4NNHVCvx6BlV%2Fimage.png?alt=media\&token=f1412f52-e7bc-4c01-8a9d-493b4ea4b5b6)\
   \ <mark style="color:red;">We strongly recommend enabling TLS encryption in your QEMU VNC for enhanced security. Please refer to the guide below for instructions on how to enable it.</mark>\
   \
   Source: <https://qemu-project.gitlab.io/qemu/system/vnc-security.html>

## B. Setting up QEMU and Android operating system

1. Connect to QEMU via any VNC Viewer on D**esktop or Mobile Phone,** such as **TigerVNC**, **TightVNC** and etc. We are using RealVNC in our example below and you may download from here\
   \
   RealVNC: <https://www.realvnc.com/en/connect/download/>

{% hint style="info" %}
For MacOS users, you may use the built-in VNC feature by right click on Finder > Conenct to Server.
{% endhint %}

2. Open RealVNC, on the top bar, insert your VM instance IP in the following format < instance ip>:5900 and connect.\
   \
   ![](https://3529283920-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fbq6zziU9PCtrTYtaegKj%2Fuploads%2FccEOyMxOx8PjpcMY4MYH%2Fimage.png?alt=media\&token=46ec24df-1cf2-4b44-bdb0-1837d88f8aad)
3. Insert the password you set in step A.6.\
   \
   ![](https://3529283920-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fbq6zziU9PCtrTYtaegKj%2Fuploads%2Fhgvdi2WXPB6hXJlPRutw%2Fimage.png?alt=media\&token=72dbaf9d-cbab-4d36-b1bb-ae09e7ea1528)

{% hint style="info" %}
From this step onward, please ensure you see the correct screen as per shown and follow the instructions.&#x20;
{% endhint %}

5. Select **Installation - Install Android-x86 to hard disk** and press Enter.<br>

   <figure><img src="https://3529283920-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fbq6zziU9PCtrTYtaegKj%2Fuploads%2FScsGbLpS1OklzHxPrWWc%2FScreenshot%202024-09-26%20at%2012.09.45%E2%80%AFPM.png?alt=media&#x26;token=c92cc5b8-7698-45a5-a7a2-f8e3c6f9ad08" alt="" width="563"><figcaption></figcaption></figure>

{% hint style="info" %}
In case you see the screen below instead of the screen above, please terminate QEMU emulator in your VM instance and restart from step A.5.

![](https://3529283920-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fbq6zziU9PCtrTYtaegKj%2Fuploads%2FxJlmmZxWqWwY8jycwXpF%2FScreenshot%202024-09-26%20at%2012.15.08%E2%80%AFPM.png?alt=media\&token=6df5be4c-ca5d-44cc-bbcf-f1fcd768a834)
{% endhint %}

5. Select **OK**<br>

   <figure><img src="https://3529283920-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fbq6zziU9PCtrTYtaegKj%2Fuploads%2FENo7gZBmviZKyhqlyIFS%2FScreenshot%202024-09-26%20at%2012.10.20%E2%80%AFPM.png?alt=media&#x26;token=cc23e4dd-bd9b-44a8-b716-214c93e9e482" alt="" width="563"><figcaption></figcaption></figure>
6. Select **Yes**<br>

   <figure><img src="https://3529283920-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fbq6zziU9PCtrTYtaegKj%2Fuploads%2FXPfOEMNqAkKNOQkhN6Ts%2FScreenshot%202024-09-26%20at%2012.10.29%E2%80%AFPM.png?alt=media&#x26;token=bc65fef5-d7a8-4f96-b143-dab1b9abd9e3" alt="" width="563"><figcaption></figcaption></figure>
7. Press any key to continue<br>

   <figure><img src="https://3529283920-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fbq6zziU9PCtrTYtaegKj%2Fuploads%2FSIV45w19LGAEBnzuXKU4%2FScreenshot%202024-09-26%20at%2012.10.35%E2%80%AFPM.png?alt=media&#x26;token=a9243b66-87c9-4062-a6dd-145e8b97eb47" alt="" width="563"><figcaption></figcaption></figure>
8. Select **New**.<br>

   <figure><img src="https://3529283920-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fbq6zziU9PCtrTYtaegKj%2Fuploads%2Fz7qexEdwomC1YFVv5Y7x%2FScreenshot%202024-09-26%20at%2012.10.47%E2%80%AFPM.png?alt=media&#x26;token=4aa284af-3f27-43a6-b4ba-0b0e16ee6450" alt="" width="563"><figcaption></figcaption></figure>
9. Leave blank and press **Enter.**<br>

   <figure><img src="https://3529283920-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fbq6zziU9PCtrTYtaegKj%2Fuploads%2FOJFGHPGhoFDNQMynvayY%2FScreenshot%202024-09-26%20at%2012.10.59%E2%80%AFPM.png?alt=media&#x26;token=d5ca3170-17ca-4097-874e-042835ffa4d2" alt="" width="563"><figcaption></figcaption></figure>
10. Leave blank and press **Enter.**<br>

    <figure><img src="https://3529283920-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fbq6zziU9PCtrTYtaegKj%2Fuploads%2FGvfO1V6xWnIkGwBX1kJ0%2FScreenshot%202024-09-26%20at%2012.11.15%E2%80%AFPM.png?alt=media&#x26;token=5917774e-946f-4edf-afd7-99683e27829a" alt="" width="563"><figcaption></figcaption></figure>
11. Insert **Yes** and press **Enter.**<br>

    <figure><img src="https://3529283920-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fbq6zziU9PCtrTYtaegKj%2Fuploads%2FkhA37gZYy8IKyUhGSwoB%2FScreenshot%202024-09-26%20at%2012.11.39%E2%80%AFPM.png?alt=media&#x26;token=9f4e7458-03d0-4468-85b7-9d1845ee4c30" alt="" width="563"><figcaption></figcaption></figure>
12. Select OK.<br>

    <figure><img src="https://3529283920-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fbq6zziU9PCtrTYtaegKj%2Fuploads%2F4nfgH9UxmSdof8IbYqkb%2FScreenshot%202024-09-26%20at%2012.12.07%E2%80%AFPM.png?alt=media&#x26;token=45d676ce-368c-47cb-8206-71e0ef47f27c" alt="" width="563"><figcaption></figcaption></figure>
13. Select **ext4** then **OK**<br>

    <figure><img src="https://3529283920-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fbq6zziU9PCtrTYtaegKj%2Fuploads%2F1tCeH5uPQ682wQ5VZJ3p%2FScreenshot%202024-09-26%20at%2012.12.17%E2%80%AFPM.png?alt=media&#x26;token=aeba1a6d-d35e-4ce3-b012-779c7db1f4c9" alt="" width="563"><figcaption></figcaption></figure>
14. Select **Yes**<br>

    <figure><img src="https://3529283920-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fbq6zziU9PCtrTYtaegKj%2Fuploads%2FRAcll2WJLf7Gcn19gqAT%2FScreenshot%202024-09-26%20at%2012.12.25%E2%80%AFPM.png?alt=media&#x26;token=ee038f95-a42f-405e-b24d-5fee97ba6c07" alt="" width="563"><figcaption></figcaption></figure>
15. Select **Yes**<br>

    <figure><img src="https://3529283920-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fbq6zziU9PCtrTYtaegKj%2Fuploads%2FSRLLNYjA7s08Vw1uYpfR%2FScreenshot%202024-09-26%20at%2012.13.02%E2%80%AFPM.png?alt=media&#x26;token=8b5cf27e-5bb7-45a3-81b8-7d5ea56059d9" alt="" width="563"><figcaption></figcaption></figure>
16. Select **Yes**<br>

    <figure><img src="https://3529283920-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fbq6zziU9PCtrTYtaegKj%2Fuploads%2FkOq3q0C67gikRVj5KA9P%2FScreenshot%202024-09-26%20at%2012.13.12%E2%80%AFPM.png?alt=media&#x26;token=987e2b6d-39e1-4474-aa1e-e2ba2c317f6c" alt="" width="563"><figcaption></figcaption></figure>
17. Select **No**<br>

    <figure><img src="https://3529283920-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fbq6zziU9PCtrTYtaegKj%2Fuploads%2FCCi7IcpGA7kNeigkiEdX%2FScreenshot%202024-09-26%20at%2012.13.23%E2%80%AFPM.png?alt=media&#x26;token=5927e4ac-9898-463e-aa75-9e459fc1b8bb" alt="" width="563"><figcaption></figcaption></figure>
18. Select **Run Android-x86** then **OK**<br>

    <figure><img src="https://3529283920-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fbq6zziU9PCtrTYtaegKj%2Fuploads%2FosmYWU50Sg8bkeOfvskj%2FScreenshot%202024-09-26%20at%2012.13.44%E2%80%AFPM.png?alt=media&#x26;token=850e6dcb-abef-4d2a-9289-dd923329a156" alt="" width="563"><figcaption></figcaption></figure>
19. Android system should be able to boot up and run in QEMU emulator now, and click **START**<br>

    <figure><img src="https://3529283920-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fbq6zziU9PCtrTYtaegKj%2Fuploads%2FwIWrkCrVRqwnZ6KMUNdy%2FScreenshot%202024-09-26%20at%2012.15.08%E2%80%AFPM.png?alt=media&#x26;token=c5dc174c-f865-4a45-a462-26f882945717" alt="" width="563"><figcaption></figcaption></figure>
20. Click See all WiFi networks and select VirtWifi<br>

    <figure><img src="https://3529283920-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fbq6zziU9PCtrTYtaegKj%2Fuploads%2FA013rYMbGcu1tS3DnlVC%2FScreenshot%202024-09-26%20at%2012.16.16%E2%80%AFPM.png?alt=media&#x26;token=0c6ac908-1dfc-4616-a105-2f64c75c82a2" alt="" width="563"><figcaption></figcaption></figure>
21. Follow the steps as per instructed in Android system to complete the setup, until you see the following screen, select **Quickstep** for better experience, or you may choose **Taskbar** if you prefer.<br>

    <figure><img src="https://3529283920-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fbq6zziU9PCtrTYtaegKj%2Fuploads%2FpGfJPZDyfK4xrtMZHhZ9%2FScreenshot%202024-09-26%20at%2012.18.15%E2%80%AFPM.png?alt=media&#x26;token=23c1aff3-a235-43a3-928a-405849bf66a8" alt="" width="563"><figcaption></figcaption></figure>
22. The Android operating system is now ready to use. Please note that the UI color might look different, however it will not affect the overall operation.<br>

    <figure><img src="https://3529283920-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fbq6zziU9PCtrTYtaegKj%2Fuploads%2FCGmuLNxqc7CpQzo9LdWV%2Fimage.png?alt=media&#x26;token=5c6a1938-9b2f-466a-9337-5e914f3d0f07" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
You may turn on Screen Lock for added security.&#x20;
{% endhint %}

## C. Optimising the App

We recommend you to lower down the system resolution so it will consume less computing resources and run faster, also for better UIUX experience.

1. Pull up the app menu and open Terminal Emulator as circled.<br>

   <figure><img src="https://3529283920-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fbq6zziU9PCtrTYtaegKj%2Fuploads%2FCo0V95IhO04syFv0wk41%2Fimage.png?alt=media&#x26;token=27a97ad5-aeb2-4427-b81d-b4376c41db90" alt="" width="563"><figcaption></figcaption></figure>
2. Insert the following command. Please note that **copy paste is not available** in Terminal Emulator.

```
su
```

You will see the following prompt after inserting **su.** Select **Remember choice for 10 minutes** here.\ <br>

<figure><img src="https://3529283920-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fbq6zziU9PCtrTYtaegKj%2Fuploads%2FhaCyTsilWfya7vch1uMC%2Fimage.png?alt=media&#x26;token=6356c409-a0b1-40f9-a6f6-176338c47169" alt="" width="323"><figcaption></figcaption></figure>

```
mkdir /mnt/tmp
```

```
mount -t ext4 /dev/block/vda1 /mnt/tmp
```

```
vi /mnt/tmp/grub/menu.lst
```

3. Press **i** to enter **Insert Mode**, and look for the **underlined line** and add **video=360x640** within line as circled below.\ <br>

   <figure><img src="https://3529283920-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fbq6zziU9PCtrTYtaegKj%2Fuploads%2Fi8okExTr9oIXXNHvwjid%2Fimage.png?alt=media&#x26;token=71b434d6-e348-462d-930c-ef75bd57a3f0" alt="" width="563"><figcaption></figcaption></figure>
4. Press **Esc** to quit **Insert Mode,** then insert **:wq** and press **Enter** to save.
5. Use command **reboot** to restart Android system.

```
reboot
```

6. You should now see your Android in 360x640 portrait mode, and you may proceed to **download CoinGet/CoinSend from Play Store** and complete the setup as usual.\ <br>

   <figure><img src="https://3529283920-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fbq6zziU9PCtrTYtaegKj%2Fuploads%2F69YbG9QnWomaiI62zSda%2Fimage.png?alt=media&#x26;token=c7124fcb-bda8-4181-ba21-b7f6d9919c1b" alt="" width="375"><figcaption></figcaption></figure>
7. Upon installing CoinSend/ CoinGet, please ensure the app's Storage permission is turned on.

<figure><img src="https://3529283920-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fbq6zziU9PCtrTYtaegKj%2Fuploads%2F9TLem14sQbI4cg4cQmAh%2Fimage.png?alt=media&#x26;token=6b29c0e2-e81e-48c9-acce-88b08cebaf06" alt="" width="375"><figcaption></figcaption></figure>
