meefik / linuxdeploy

Install and run GNU/Linux on Android
https://meefik.github.io/linuxdeploy
GNU General Public License v3.0
5.18k stars 678 forks source link

Linux Deploy from scratch #1262

Open falkor2k15 opened 3 years ago

falkor2k15 commented 3 years ago

Is anyone able to replicate a basic Linux Deploy chroot environment entirely using a script instead of the app/GUI? --Create chroot environment inside an IMG file --Install a minimal Ubuntu from ports.ubuntu.com inside the chroot --Install a core desktop environment etc

abs0023 commented 3 years ago

You should seek help from the termux community on reddit for instance. I use linux deploy for the gui, i installed ubuntu-chroot in termux following this tuto; https://m.youtube.com/watch?v=njAEeMSrRvk. and i get the sound working from termux with pulseaudio. i start pulseaudio with this command; pulseaudio --start --exit-idle-time=-1 pacmd load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1 auth-anonymous=1 maybe not the answer you were looking for, hope it helped a little.

falkor2k15 commented 3 years ago

I figured out how to do it all using Termux and proot! Obviously, it's not exactly "from scratch" per se because the proot commands are more like a collection of advanced scripts built into a package. The GUI and pulse audio can be added that way - but without root we cannot map external storage disks - only can use the internal storage (still quite limited on most tablets) as a gateway.

falkor2k15 commented 3 years ago

Here's my new PROOT guide:

INSTALLING PROOT IN TERMUX - ONLINE Install Termux via Play Store Note: CTRL+ALT+V to paste into Termux Settings > Privacy > Permissions Manager > Files and media > give Termux full access before launching pkg update && pkg upgrade -y && pkg install proot-distro pulseaudio -y && pulseaudio --start --exit-idle-time=-1 && pacmd load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1 auth-anonymous=1

INSTALLING PROOT IN TERMUX - OFFLINE Install Termux via downloaded APK file (find in Play Store > click 3 dots > Share to get APK link > paste into: https://apkcombo.com/apk-downloader) Note: package location = /data/data/com.termux/cache/apt/archives (backup to a new internal storage folder called packages after online install) dpkg -R --install packages (termux-tools.deb ncurses-utils.deb libtalloc.deb proot.deb proot-distro.deb libsoxr.deb libogg.deb speedxdsp.deb libvorbis.deb libltdl.deb libwebrtc-audio-processing.deb libflac.deb libsndfile.deb pulseaudio.deb)

INSTALLING UBUNTU (MINIMAL W/ BASIC GUI) IN PROOT - ONLINE Note: install location = /data/data/com.termux/files/usr/var/lib/proot-distro/installed-rootfs/ubuntu-20.04/root proot-distro install ubuntu-20.04 && proot-distro login ubuntu-20.04 --bind /storage/emulated/0:/root/Storage export DEBIAN_FRONTEND=noninteractive apt update && apt upgrade -y && apt install pulseaudio tightvncserver -y && apt install sudo lxterminal lxde-core -y --no-install-recommends && apt-get clean adduser android && echo "android ALL=(ALL:ALL) NOPASSWD: ALL" > /etc/sudoers && exit proot-distro login ubuntu-20.04 --user android --bind /storage/emulated/0:/home/android/Storage vncserver && vncserver -kill :1 echo 'exec startlxde' > $HOME/.vnc/xstartup && export PULSE_SERVER=127.0.0.1 vncserver -geometry 1280x720 -dpi 150 Open RealVNC Viewer and connect to 127.0.0.1:1 vncserver -kill :1

BACK UP & RESTORE UBUNTU IN TERMUX - OFFLINE proot-distro backup ubuntu-20.04 --output /storage/emulated/0/ubuntu-20.04.tar.gz proot-distro restore /storage/emulated/0/ubuntu-20.04.tar.gz

abs0023 commented 3 years ago

Woaa it didn't take you long to get the job done.

falkor2k15 commented 3 years ago

It took me longer than expected, as it's quite a learning experience and constantly having to revise my knowledge of Linux at the same time. It's not easy coming from a Windows background and trying to find comparable Linux apps that can work on proot and Linux Deploy, as there are limitations and restrictions - particularly with proot, such as slower performance through partial emulation as well as lack of startup mechanisms and saving of settings in a lot of scenarios. What really tested my patience, however, was getting Windows XP running through proot - everything takes so long zzzzz - but it was worth it in the end. Right now I'm just running Android on a Raspberry Pi, so things should improve once I get a proper phone.

Note: I stand corrected in that Termux should be downloaded from F-Droid and NOT the Play Store.

Practicalbutterfly5 commented 2 years ago

Have a look at linux deploy source code, and the cli.sh file.