搭建 ReDroid
时隔半年多,甲骨文昨天终于加了 arm 免费服务器的资源,博主也终于申请到了心心念念的 3C18G 的 arm 服务器。搞这么“奇怪”的配置,就是想用来跑 ReDroid 的。因为 arm 架构的服务器,你把它当普通架构的服务器使用,很多时候都会遇到各种莫名其妙的问题,但是用来跑本身就是 arm 架构的“安卓”,那当然是最好不过的选择了,绝配!😄
ReDroid (Remote anDroid) is a GPU accelerated AIC (Android In Cloud) solution. You can boot many instances in Linux host (, , etc.). redroid supports both and architectures. ReDroid is suitable for Cloud Gaming, Virtualise Phones, Automation Test and more. ——摘自 GitHub remote-android/redroid-doc
Install Docker
拿到服务器首先改系统时间、升内核、开启 bbr、更新系统……这些老生常谈的开荒操作就不再赘述了。ReDroid 是以 Docker 的方式运行的,当然我们也要先装 Docker。好在 Docker 完美适配了 arm 架构的 Ubuntu 系统,我们只需要跟着官方文档操作就行了:Docker Engine installation overview | Docker Documentation
Install Required Kernel Modules
首先安装 ReDroid 所需的模块。
apt install linux-modules-extra-`uname -r`
modprobe binder_linux devices="binder,hwbinder,vndbinder" # 进程通信模块,运行此命令应无回显,不能有报错
modprobe ashmem_linux # 内存共享模块,运行此命令应无回显,不能有报错
Running ReDroid
然后一行命令运行 ReDroid😎Cool~
docker run -itd --rm --privileged \ # -itd 后台运行 --rm 停止容器时自动删除 --privileged 启动容器内的 root 特权模式
--pull always \ # use latest image
-v ~/data:/data \ # mount data partition
-p 5555:5555 \ # expose adb port
redroid/redroid:13.0.0-latest \ # 使用最新的安卓 13
--memory-swappiness=0 \ # 内存够用则禁用 swap(防止 I/O 成为性能瓶颈)
androidboot.hardware=mt6891 ro.secure=0 ro.boot.hwc=GLOBAL ro.ril.oem.imei=861503068361145 ro.ril.oem.imei1=861503068361145 ro.ril.oem.imei2=861503068361148 ro.ril.miui.imei0=861503068361148 ro.product.manufacturer=Xiaomi ro.build.product=chopin \ # 模拟手机型号为红米 Note 10
redroid.gpu.mode=guest \ # 强制容器使用软解(不加此参数则为硬解,硬解性能高且资源占用小,但博主实测甲骨文云服务器无法使用硬解)
redroid.width=720 redroid.height=1280 # 设置分辨率为 720×1280
Install Scrcpy
接着在本地客户端上安装远程连接 ReDroid 所需的 Scrcpy
On Linux
apt install scrcpy # On Debian and Ubuntu
pacman -S scrcpy # On Arch Linux
On Windows
在 GitHub 下载最新版的 Scrcpy:scrcpy-win64-v1.24.zip
View ReDroid Screen
将上述 Scrcpy 的压缩包解压后,在目录下运行如下命令,成功远程连接 ReDroid。
adb connect $$ip$$:5555 # adb 连接设备
scrcpy # 运行
adb disconnect # 运行完记得断开 adb 连接
FAQ
有些小伙伴会问,为什么感觉很卡或者突然断开了,那是因为过墙了呀。可以使用 Xray+Netch 进行代理,具体操作方法为:(🤫博主只能说这么多了)
