本文將基于 Redroid 開源項目搭建自己的云手機,如果有服務器的話可以做到基于 Web 隨時訪問。
部署教程
準備工作:
擁有云服務器,推薦配置:- 資源:建議 2H4G - 系統(tǒng):Ubuntu20.04 - 依賴軟件:Docker[1]
個人電腦:基于虛擬機 安裝
Ubuntu20.04
,推薦使用 ARM 架構服務器或者 RK3588 開發(fā)板
首先,我們直接進入 Ubuntu20.04
,如果有云服務器就直接進入,沒有的話基于本機虛擬化一個,命令如下:
#?如果是國內服務器,不需要執(zhí)行此操作,為了方便后續(xù)操作更快速,我們更換國內源
#?https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/
#?以下內容切記要根據自己系統(tǒng)版本替換,這里是?ubuntu:20.04
echo?"deb?https://mirrors.tuna.tsinghua.edu.cn/ubuntu/?focal?main?restricted?universe?multiverse
deb?https://mirrors.tuna.tsinghua.edu.cn/ubuntu/?focal-updates?main?restricted?universe?multiverse
deb?https://mirrors.tuna.tsinghua.edu.cn/ubuntu/?focal-backports?main?restricted?universe?multiverse
deb?http://security.ubuntu.com/ubuntu/?focal-security?main?restricted?universe?multiverse"?|?tee?/etc/apt/sources.list
apt?update
#?如果有證書錯誤就執(zhí)行
apt?install?ca-certificates?-y
好了,現(xiàn)在我們都已經進去服務器了,然后需要安裝好 Docker:
#卸載舊版本docker
apt?remove?docker?docker-engine?docker-ce?docker.io
apt?remove?--auto-remove?docker
apt?update
#?安裝
apt?update
apt?install?apt-transport-https?curl?software-properties-common?gnupg-agent?-y
curl?-fsSL?http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg?|?apt-key?add?-
add-apt-repository?"deb?[arch=amd64]?http://mirrors.aliyun.com/docker-ce/linux/ubuntu?$(lsb_release?-cs)?stable"
apt-cache?policy?docker-ce
apt?install?docker-ce?-y
#?查看?Docker版本
docker?version
#?啟動?Docker
systemctl?restart?docker
接下來按照 redroid[2] 官方文檔進行操作即可:
apt?install?linux-modules-extra-`uname?-r`
modprobe?binder_linux?devices="binder,hwbinder,vndbinder"
modprobe?ashmem_linux
docker?run?-itd?--rm?--privileged?\
????--name=redroid?\
????--pull?always?\
????-v?~/data:/data?\
????-p?5555:5555?\
????redroid/redroid:11.0.0-latest
docker?run?-itd?\
????--name=redroid?\
????--memory-swappiness=0?\
????--privileged?--pull?always?\
????-v?~/data:/data?\
????-p?5453:5555?\
????redroid/redroid:13.0.0-latest?\
????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?\
????redroid.width=720?redroid.height=1280
為了可以遠程操作我們的云安卓手機,我們需要借助 Scrcpy[3] 工具,Scrcpy
是一個開源的工具,功能點如下:
通過 USB 進行屏幕鏡像
可以使用 Scrcpy 來遠程控制你的 Android 設備
使用鼠標和鍵盤來控制 Android 設備
可以將文件在 Android 設備和電腦之間傳輸
支持 Windows、macOS 和 Linux 系統(tǒng)
我們要使用的就是遠程控制功能:
apt?install?scrcpy
scrcpy?-s?localhost:5555
效果如下:
至此,我們算是把云手機給搭建起來了,但這還只是開始,接下來我們還要做一些事情:
如何讓云手機隨時隨地都能訪問
如何安裝應用程序
如何做一些自動化的事情
等等
這個可玩性可太多了,讓我們一起探索吧。
Web 云手機
要想讓云手機隨時隨地都能訪問,不難想到就是直接將 redroid
進行 web
化,開源社區(qū)也有相關項目:ws-scrcpy[4],我們直接拿過來用就好了:
#?由于官方不支持?Docker?部署
#?這里老胡選了一個其他人上傳的
#?https://hub.docker.com/r/emptysuns/scrcpy-web
docker?run?--rm?-itd?--privileged?-v?/root/scrcpy-web/data:/data?--name?scrcpy-web?-p?8090:8000/tcp??--link?redroid:howie_phone?emptysuns/scrcpy-web:v0.1
#?連接前面部署的云手機
docker?exec?-it?scrcpy-web?adb?connect?howie_phone:5555
訪問:ip:8090,可以看到頁面如下:
點擊
H264 Converter
就能在瀏覽器里面操作云手機了。
軟件安裝
通過 adb
即可安裝軟件:
#?下載?*.apk放到?/root/scrcpy-web/data?目錄下
docker?exec?-it?scrcpy-web?adb?install?/data/*.apk
#?遠程安裝
adb?-s?ip:5555?install?"*.apk"

說明
本文參考資料如下:
remote-android[5]
scrcpy[6]
使用 Docker 運行 ws-scrcpy:實現(xiàn) Android web 遠程桌面[7]
ARM 主機部署 Docker 云手機[8]
在 RK3588 開發(fā)板上使用 AIC(Android IN Container)![9]
參考資料
[1]
Docker: https://docs.docker.com/engine/install/
[2]redroid: https://github.com/remote-android/redroid-doc
[3]Scrcpy: https://github.com/Genymobile/scrcpy
[4]ws-scrcpy: https://github.com/NetrisTV/ws-scrcpy
[5]remote-android: https://github.com/remote-android
[6]scrcpy: https://github.com/Genymobile/scrcpy
[7]使用Docker運行ws-scrcpy:實現(xiàn)Android web遠程桌面: https://blog.imoeq.com/scrcpy-run-a-android-web-page/
[8]ARM主機部署Docker云手機: https://www.liaomz.top/2023/08/28/arm-zhu-ji-bu-shu-docker-yun-shou-ji/文章來源:http://www.zghlxwxcb.cn/news/detail-844064.html
[9]在RK3588開發(fā)板上使用AIC(Android IN Container)!: https://www.dnlab.net/archives/94/文章來源地址http://www.zghlxwxcb.cn/news/detail-844064.html
到了這里,關于[小白教程]給自己安裝一臺云手機吧的文章就介紹完了。如果您還想了解更多內容,請在右上角搜索TOY模板網以前的文章或繼續(xù)瀏覽下面的相關文章,希望大家以后多多支持TOY模板網!