Linux Deploy Guide
Typesetting conventions for this document:
Text representation of the interface:
Use vertical screen Method identification:
软件主界面 = 刚打开linuxdeploy显示的界面 左滑动菜单栏 = 左上角的滑动菜单 linux设置区 = 右下角的设置(或下载)标志按钮内 操作菜单 = 主界面右上角的3个点点开 app设置 = 滑动菜单里面的设置
Requires environment
Have root permissions
Have 300MB of free space
Busybox installed
Install linuxdeploy
Download address:
https://github.com/meefik/linuxdeploy/releases
This tutorial uses Linux Deploy 2.2.0
Initialize the running environment
Open Linuxdeploy
Software main interface-> Left-swipe the menu bar-> app settings-> Check: Enable cli -> Click Update Environment- > Authorize root -> Wait for the update to be completed
Set up linux
Software main interface-> linux setting area
Boot setting
Container type
It is recommended to use chroot
- proot is currently incomplete in linuxdeploy and may not be able to install the
distribution version GNU/linux
choose you Required distribution
Architecture
Select the architecture supported by your mobile phone
Distribution version GNU/Linux version
Select the version of the distribution you need
Source address
It is recommended to use the domestic source address
Installation type
Image file
Install GNU/linux into an image file (virtual disk)
If you install GNU/linux to a fat32 sd card, please use this option
The installation path is the absolute path of the image file and the default is /sdcard/linux.img
The image size is the size of the image file and the default is automatic
If the image path is set in the directory of the fat32 memory card, the image size should not be larger than 4096mb (fat32 file system file size limit)
The file system is the file system of the partition to be used in the image file. The file system defaults to ext4
Directory
Install GNU/linux in a directory of an ext4 or f2fs partition
The installation path is the directory to be installed. The default is the application data directory of linuxdeploy (in the data partition)
Installation directory Do not use the directory of the fat32 partition, and /sdcard/ Internal shared storage directories, they do not support basic permissions of linux file systems
Partition
Format a partition and install GNU/Linux into it
Installation path The absolute path for a block device partition file defaults to /dev/block/mmcblkXpY
If you want to install to the first partition of the memory card, please write: /dev/block/mmcblk1p1
If you want to install to the first partition of the otg USB disk, please write: /dev/block/sda1
The file system specified by the file system format partition is by default ext4
RAM
Create a ramdisk and install linux into it
The installation path is ramdisk and the mounting path defaults to /data/local/ram
The image size is the size of the ramdisk
The ramdisk will be cleared after shutdown
Username
The username of the ordinary account to be created
User password
Password for the ordinary account to be created
It is recommended not to set a password that is too simple or short, otherwise the setting may fail
Privileged user
The default is root
It is recommended not to modify
DNS
Specify the DNS address to be used by GNU/Linux
The default is Automatic
Localization
Set the localization settings (language settings) to be used by GNU/Linux
The default is POSIX Standard English and Chinese please set it to
zh_CN.UTF-8
Initialization
Initialize the script settings that are automatically executed when linuxdeploy starts linux
Initialize the system
run-parts
Execute the specified script when starting linux
Initialization path The path of the script to be executed. Initial user The user to execute the script
sysv
Please select this option if the Linux you installed supports and installs sysv
The initialization level is init and the run type defaults to 3 (default)
The initial user is the user running init and the default is root
Mount
External GNU/linux A directory is mounted to GNU/linux for Linux access
Do not fill in the block device file name in the mount point list
SSH
Enable SSH connection method
Port The default port for ssh service startup is 22
PulseAudio
Enable the PulseAudio service and forward the audio output in linux to the target pulseaudio server
Android can use Pulsedroid as the output server
It can also be forwarded to other devices with pulseaudio
host target host ip
port port of the target host running the pulseaudio service
图形界面
图形子系统
桌面环境为要使用启动的桌面启动环境
使用安装的Linux里面的用户Home目录下的文件控制
x11: ~/.xinitrc vnc: ~/.vnc/xstartup framebuffer: ~/.xinitrc
如果图形连接不显示或者启动错误请修改x服务启动控制文件
vnc
启用vnc作为图形连接方式
vnc设置:
显示为要使用的显示DISPLAY变量 影响端口 默认为0
建议不要修改
与vnc监听端口的关系:
显示 0 端口 5900 显示 1 端口 5901
颜色深度为显示的颜色深度 默认为16bit 影响vnc画质
8bit 低画质 低网络占用
dpi为显示密度 默认为 75 dpi越高显示密度更大
建议保持默认不要修改
宽 高 为vnc的显示分辨率 默认为手机横屏取值
vnc选项 为vnc扩展选项默认空
x11
启用x11服务来访问图形
Linuxdeploy并不提供x11的服务器
x11服务的连接方式为:
x11客户端 (linuxdeploy里面的linux) |^ || v| x11服务器
如果要在安卓自身使用x11服务请安装安卓的XsdlServer app
并按照xsdlserver显示的设置x11服务
framebuffer
停止/暂停/冻结 安卓界面并让linux使用fb设备显示图形
在大多数设备上需要设置停止安卓界面来显示linux图形界面
在许多设备上无法此显示方式工作
显示为要使用的DISPLAY变量 默认为0 建议不要修改
视频设备为要使用的fb设备文件 建议不要修改
输入设备为触摸屏设备event设备文件 用于启用图形触摸屏支持 建议不要修改
x参数为x指定附加参数 建议不要修改
强制刷新缓存区 建议勾选
冻结安卓界面 建议选择停止
开始安装
主界面 -> 操作菜单 -> 安装
开始安装并等待安装
安装结束后会在最后几行输出
<<<deploy
验证安装
主界面 -> 启动
打开手机上的终端软件
执行:
android $ su root # linuxdeploy shell -u root
如果顺利进入linux的shell说明安装成功
如果无法顺利进入请停止并检查安装,或者停止重新安装
连接ssh服务
如果手机自身连接请下载安卓ssh客户端:
- connectbot
- juicessh
并连接localhost和你设置的ssh端口 (端口默认为22) 使用你设置的用户名密码登录
可选操作:
登录后请更改默认密码为强密码
如果外部连接本linux请输入手机的局域网ip地址并连接指定ssh端口
连接vnc服务
手机自身连接
下载安卓vnc客户端:
- vncviewer
连接localhost并输入密码为用户设置密码(用户名下面的那个)
vnc密码和账户密码没有关联,只是linuxdeploy设置的密码在安装时候会共享
连接x11
手机自身连接
下载xsdlserver并启动
启动xsdlserver后启动linuxdeploy里面的linux
使用framebuffer
启动linux的同时手机会黑屏
如果framebuffer启动成功则显示linux的图形界面
如果失败则黑屏 请手动重启
在linuxframebuffer启动的时候可以使用外部ssh到手机来操作
FAQ
问: linuxdeploy安装的linux可以运行什么? 答: linuxdeploy安装的linux是一个完备的linux系统,你可以使用包管理器或者编译方式扩展它的功能. 唯一限制为使用安卓的内核运行(你可能无法使用一些只提供安卓接口的硬件)
问: linuxdeploy安装的linux里面安装了xrdp,但为什么不能运行? 答: 安卓拥有一套特别的权限管理方式 ,由于xrdp在单独一个叫xrdp的账户运行守护进程, 所以需要把xrdp用户加入aid_inet用户组 :
root@linux # usermod -aG aid_inet xrdp # 将xrdp加入套接字权限组 ,其他需要套接字权限的应用也可以这样设定
推荐学习:《linux视频教程》