Home > Operation and Maintenance > Linux Operation and Maintenance > What is the use of linux deploy

What is the use of linux deploy

青灯夜游
Release: 2023-04-12 16:45:28
Original
2204 people have browsed it

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.

What is the use of linux deploy

#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
What is the use of linux deploy

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: mirror.tuna.tsinghua.edu.cn(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).

What is the use of linux deploy

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:

What is the use of linux deploy
## When you see the terminal output "
What is the use of linux deploy
Click the "Start" button below the main interface to start the newly installed system, click "Stop" to stop it system.

What is the use of linux deploy
At this point, the system deployment part is described.

After deployment, we need to use SSH tools such as l

JuiceSSH/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

What is the use of linux deploy
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.

What is the use of linux deploy
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:

What is the use of linux deploy

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.

What is the use of linux deploy

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):

What is the use of linux deploy
## 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:

1What is the use of linux deploy
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

1What is the use of linux deploy
1What is the use of linux deploy
1What is the use of linux deploy
## After the configuration is completed, return to the main interface, press the "Menu key", select "Configuration" and let us just The settings take effect:

1What is the use of linux deploy
1What is the use of linux deploy## After the configuration is completed , click the "Stop" button at the bottom to stop the Linux system, and then click the "Start" button to start the Linux system. Then we log in to SSH and execute in the terminal:

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)

Enter the graphical interface:

Then we use VncViewer to connect to the graphical interface we just deployed:

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:1The 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:

What is the use of linux deploy
1What is the use of linux deploy
## 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):

1What is the use of linux deploy
What is the use of linux deploy##Okay...the deployment process of the graphical interface ends here, you can do the rest by yourself (/doge face)~

Possible problems:

 1. When you open a VNC session, stop the Linux system and restart the Linux system, and then execute the vncserver command again, the system may report the following error:

2What is the use of linux deploy At this time, you can execute the following two commands:

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 before
exit 0
in this file:

sudo vim /etc/rc.local #Edit/etc/rc.local

## After editing is completed, save it. After performing this step, Linux Deploy will execute these two commands for us after starting the Linux system and before stopping the Linux system, so that no errors will be reported again~

 2. The default resolution of vncserver is 1024×768, but the resolution of most mobile phone screens on the market is 720P (1280×720), 1080P (1920×1080), or even 2K (2560×1440). The default 1024×768 resolution of vncserver may cause the VNC image to fail to fill the screen. At this time, we need to modify the VNC resolution to adapt to the screen. After testing, taking the 1080P screen as an example, set the resolution to 720P The VNC image can fill the screen without affecting the display effect. The adjustment method is to add the -geometry parameter after each execution of the vncserver command. For example, if I need to adjust the VNC resolution to 720P (1280×720), then start vncserver , execute:

vncserver -geometry 1280x720

to set the screen resolution of the newly opened VNC virtual session to 1280×720. It is worth noting that the x in 1280x720 in the command is the lowercase letter x, not the multiplication sign × in mathematics.

The following is a comparison between 1280×720 resolution and 1024×768 resolution (reducing the VNC Viewer screen to the minimum):

2What is the use of linux deploy
2What is the use of linux deploy

Obviously, on a 1080P screen, setting the VNC resolution to 1280×720 can make the image fill the screen and provide better visual effects. .

If you find it a bit troublesome to enter such a long list of commands every time you start vncserver, you can edit the ~/.bashrc file and add a line of alias definition at the location shown in the figure below:

vim ~/.bashrc #Edit~/.bashrc

alias vncserver='vncserver -geometry 1280x720'
Copy

2What is the use of linux deploy

After that, every time the vncserver command is executed, the resolution of the newly opened VNC session will be set to 1280×720.

Upgrading ubuntu

You will find that ubuntu can only be installed to 18.04

The upgrade method is to install Ubuntu and then upgrade directly.

After logging into the desktop using VNC, use the terminal to install the updater

sudo apt install update-manager-core
Copy after login

Update all packages to the latest version

sudo apt update && sudo apt upgrade
sudo do-release-upgrade
Copy after login

If the error authenticate 'focal.tar.gz' against 'focal.tar.gz.gpg' Authentication failed occurs, first install gnupg and execute the following instructions:

sudo apt install gnupg gnupg1 gnupg2
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 871920D1991BC93C
Copy after login

Execute sudo do- again release-upgrade, enter y to start updating the system, and follow the instructions on the terminal to update.

If prompted Please Install All Available Updates Before Upgrading

apt clean 
apt autoclean
sudo apt update 
sudo apt upgrade -y 
sudo apt dist-upgrade
Copy after login

Execute sudo do-release-upgrade again, enter y to start updating the system, and follow the terminal instructions to update.

If nothing else goes wrong, the system has been upgraded normally.

After the upgrade, you need to go back to the linux deploy configuration item and change the username to root. The password can remain unchanged. The reason is that after the upgrade, the original android username does not have root permissions

After modifying the user name, be sure to click the configuration option of linux deploy to reconfigure

# Updated on 2023.3.8 If you encounter "The required dependency 'apt (>= 2.0.4)' is not installed." Need to modify the /etc/apt/source.list file

## /etc/apt/source.list
deb http://ports.ubuntu.com/ focal multiverse main universe
deb-src http://ports.ubuntu.com/ focal multiverse main universe
deb http://ports.ubuntu.com/ focal-updates main universe multiverse
deb-src http://ports.ubuntu.com/ focal-updates main universe multiverse
deb http://ports.ubuntu.com/ focal-security main universe multiverse
deb-src http://ports.ubuntu.com/ focal-security main universe multiverse
Copy after login

Related recommendations: "Linux Video Tutorial"

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template