linux deploy is used to deploy a Linux environment on Android devices. The principle is to run a chroot or proot container on the Linux layer of Android, and then run another Linux system we have prepared in the container. Before using Linux Deploy, you must obtain the Root permission of your phone.
#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.
Linux Deploy is an application that can deploy a Linux environment on Android devices. Its principle is to run a chroot or proot container on the Linux layer of Android, and then run another one we prepared in the container. Linux system. It is worth noting that this is different from the virtual machine technology we are familiar with. The new Linux system will run in parallel with the Android system (don’t delve into the explanation for non-professionals).
Before using Linux Deploy, we need to obtain the Root permission of the mobile phone (required) . After obtaining the Root permission, because the Linux command set that comes with the original machine is incomplete, we need Install Busybox to expand the Linux command set (you can not install it) .
Linux Deploy needs to be installed in the Google Store, which is not available in other Android app stores. The software mentioned below can only be installed in the Google Store. The download address is also provided at the bottom of the article
After the installation is completed, we will use Linux Deploy to deploy the Ubuntu system on the Android device:
Click the "Download" icon at the bottom right of the interface to enter the configuration file Make the following settings in the setting interface (I don’t know why the developer uses such a "download" icon as the icon of the configuration file setting interface):
Containerization method: "chroot"
Release version :"Ubuntu"
Architecture: Keep the default value
Release version: "yakkety" (Ubuntu 16.10)
Source address: http: //mirror.tuna.tsinghua.edu.cn/ubuntu-ports/(Here we deploy in the default way, that is, in Deploy by downloading Linux components and necessary software packages from the software source. Because the default source speed is not good, in order to avoid downloading all day and night, we use the open source mirror source of Tsinghua University here. If you deploy using the Repository method (later article (will be mentioned), the "source address" here should be filled in with the local or remote path of the Repository file (suffix tgz/tar.gz) file)
Installation type: There are two suggestions for this option," Directory" and "File". If you are not familiar with Linux and the remaining space of the /data partition is ≥ 2g, it is recommended to use the "directory" installation method. If you are familiar with Linux or the remaining space of the /data partition is
Installation path: When "Installation Path" selects "Directory", this option will define the path in which the system is installed. The default path is ${ENV_DIR}/rootfs/linux
, that is, installation In the /data/user/0/ru.meefik.linuxdeploy/env/rootfs/linux
directory. When "Installation Type" selects "File", this option will define which image file the Linux system is installed in. The default value is External Storage/linux.img
.
Image size (MB) (available when the installation type "selects "File"): This option will define the size of the image file where the system is located. Before system installation, a file with the set image size will be created in the installation directory. Empty files are used to store system files and data (equivalent to the total disk space of the new Linux system). It is recommended not to use the default value, filling in 2048m is enough.
File system (available when the installation type "Select "File" ): Select "Auto".
Username: This option is the username when logging into the system. The default is "android" and can be changed at will.
User password: This option is the password of the user in the Ubuntu system, which can be filled in according to your own habits.
Privileged Users: Keep the default value
DNS server: You can keep the default value, or you can customize the DNS server address (such as 114.114.114.114, etc.)
Localization: It is recommended to keep the default value POSIX, if there are other needs, such as ssh When the return result is Chinese or the display language of the graphical interface is Chinese, select "zh_CN.UTF8"
INIT/MOUNTS item: It can be set if required, and can be ignored if not required.
Allow SSH server to start: turn on this option
SSH settings: keep the default
Allow graphical interface to start: If necessary, you can set this option. This option will not be turned on here for the time being (later The article will introduce how to deploy the graphical interface).
After the setting is completed, press the return key to return to the main application interface, press the menu key, and select "Install" to start the Linux system. Installation, you need to maintain a network connection during the installation process (it is recommended to install under WIFI, which requires about a few hundred megabytes of traffic).
When you see the terminal output ">>>deploy", it means the installation has started:
## When you see the terminal output " Click the "Start" button below the main interface to start the newly installed system, click "Stop" to stop it system. At this point, the system deployment part is described. After deployment, we need to use SSH tools such as lJuiceSSH/ConnectBot to log in to the system (here we take JuiceSSH as an example).
After successfully starting the system, we open JuiceSSH, click the "Connect" - " button in the lower right corner to enter the new connection interface: Nickname: You can fill it in at will, we use "Localhost - Android" as Example type: SSH Address: 127.0.0.1 Authentication: Select "New" to jump to the "New Authentication" interface: Nickname: You can also fill it in at will, we also use " Localhost - Android" as an example. User name: fill in the "user name" in the "Profile Settings" interface. The default is android. Password: fill in the "User Password" in the "Profile Settings" interface. Click the "√" icon in the upper right corner to save and return to the "New Connection" interface, click the "√" icon again to save, and click the newly created one in the "Connection List" This project is connected to the system we just deployed. After the connection is successful, the interface is as follows:Because we log in to the system through the ordinary user android, next we need to set the super user (root) password and act as the super user Log in to the system:
Type in the terminal:
sudo passwd root
The terminal will prompt the user to enter the password of the root user and enter it again to confirm (the password when entering the password will not be visible (even * will not be displayed). After the setting is completed, type the command su in the terminal and enter the root user password you just set to switch to the root user.
File management: If you deploy the Linux system through the "directory" method, then you can directly use the R.E. manager to access /data/user/0/ru.meefik.linuxdeploy/env/ Rootfs/linux
can manage files in the new system. If you deploy the Linux system through "file", you have to rely on SFTP to manage files and other operations (of course there is no problem using SSH, but I still feel that SFTP more convenient). When we log in to SFTP as a normal user, we do not have permission to operate most files due to permission reasons. So we need to log in to SFTP as superuser. However, the default configuration does not allow the root user to log in to SSH and SFTP, so we need to make the following settings:
Start the deployed system in Linux Deploy, log in to SSH as the android user, and execute in the terminal:
sudo apt-get install -y vim #Install vim editor
Of course, you can also use the vi editor that comes with the system. If you are familiar with the vi editor, you can also use it. vi editor to edit files. After the vim editor is installed, we continue to execute in the terminal:
vim /etc/ssh/sshd_config #Use the vim editor to open the /etc/ssh/sshd_config file
After opening the file, type i Enter the editing mode, click on any blank position of the terminal to pop up the special key keyboard, use the up and down cursors to scroll through the file, find the PermitRootLogin item in the #Authentication section of the file, change it to yes, after the change is completed, click on the special key keyboard "ESC" key to exit the editing mode, type: wq! on the keyboard to save and force exit the file to complete the editing operation of the file.
Open Linux Deploy, stop and then start the Linux system. Open "Turbo Client" - Sidebar - Create a new account - SFTP to create a new SFTP connection (some file managers, such as ES File Explorer (ESFile Explorer) and SE File Manager (Solid Explorer) also have SFTP functions, If you don’t want to install TurboFTP, you can use them instead):
## Where: Username: root The password is the password of the root user just set. The host name is: 127.0.0.1. Keep other items as default. Click the "Save" icon in the upper right corner to save the configuration. In the connection list in the sidebar, we will use The root user connects to SFTP and manages files: Of course, after modifying the sshd_config file and stopping and starting the Linux system, you can also Connect to SSH directly as root user. After introducing the installation, let’s introduce the uninstallation~ You can completely uninstall Linux Deploy through the following methods: 1. If you use the "directory" method to deploy the Linux system, then "stop" the Linux system in Linux Deploy, then directly uninstall Linux Deploy and restart the phone to completely uninstall; 2. If you use "file ( For Linux systems deployed in the "mirror" method, you need to "stop" the Linux system first, and then delete the image file placed in the built-in storage. The image file path is the "installation path" mentioned above before deploying the Linux system. , if this item has not been modified, the mirror path is External Storage/linux.img
, then uninstall Linux Deploy and restart the phone to completely uninstall.
Install the graphical environment
Modify the following configuration items:
INIT: Check: Enable custom script execution (other configurations of INIT remain unchanged )
Graphical interface:
Tick: Allow graphical interface to start
Graphics subsystem: VNC
Graphical interface settings: Keep the default configuration
Desktop environment: Choose as needed, the one chosen here is LXDE
## After the configuration is completed, return to the main interface, press the "Menu key", select "Configuration" and let us just The settings take effect:sudo apt-get install ttf-wqy-zenhei #Install Chinese font library
After the Chinese font library is installed, execute the following command to start VNC:
vncserver
The terminal will return the following results:
New 'X' desktop is localhost:1 Starting applications specified in /home/android/.vnc/xstartup Log file is /home/android/.vnc/localhost:1.log
Copy
Proves that vncserver has been started successfully.
(Note that at some point, the first time you execute the
vncserver command, the system will ask you to set a VNC password less than 8 digits. You need to enter the password twice and submit it. , there will be a prompt after the VNC password setting is completed, ignore it, type n
to submit)
Open VncViewer, click the " " button in the lower right corner to add a VNC session:
Address: 127.0.0.1:5901 Name :Localhost - Ubuntu@Xfce
Among them, the "Address" item is the address of VNCserver. Since we need to connect to the local VNC server, just fill in 127.0.0.1. In addition, we also need to specify the VNC port after the address, because the information just returned by the terminal: New 'X' desktop is localhost:1
The desktop session number is specified as 1, so the port is 5900 1=5901. If we open multiple virtual desktops, and their session numbers are 2,3,4..., then their respective ports are 5902,5903,5904...and so on. Moreover, the server address and port need to be separated by an English colon. The "Name" item is the address specified by the user for this VNC session. In order to distinguish it from other sessions, we fill in Localhost - Ubuntu@Xfce. In fact, you can fill in anything you want.
After filling in this information, click the "CREATE" button to submit:
## After confirming that the information is correct, click the green "CONNECT" button below to start connecting to the VNC session (if you have not set a VNC password before, you still need to enter it during the VNC connection process password, then you can try entering the password of the android user): Possible problems:rm -rf /tmp/.X[1-9]-lock
rm -rf /tmp/. In order to prevent this problem caused by stopping and restarting the Linux system every time, we can edit the /etc/rc.local file and insert these two commands beforeexit 0
in this file:
sudo vim /etc/rc.local #Edit/etc/rc.local
The above is the detailed content of What is the use of linux deploy. For more information, please follow other related articles on the PHP Chinese website!