Skip to content

Instantly share code, notes, and snippets.

@BrainBacon
Last active December 13, 2017 00:05
Show Gist options
  • Save BrainBacon/ed3f28244d25fcc240278fbde9234698 to your computer and use it in GitHub Desktop.
Save BrainBacon/ed3f28244d25fcc240278fbde9234698 to your computer and use it in GitHub Desktop.
Termux-Ubuntu-i386
#!/data/data/com.termux/files/usr/bin/bash
# input validator and help
# DOCKERIMAGE=https://dl.project.org/pub/fedora/linux/releases/26/Docker/x86_64/images/Fedora-Docker-Base-26-1.5.x86_64.tar.xz
DOCKERIMAGE=https://partner-images.canonical.com/core/xenial/current/ubuntu-xenial-core-cloudimg-i386-root.tar.gz
# install necessary packages
apt update && apt install proot tar -y
# get the docker image
mkdir ~/ubuntu
cd ~/ubuntu
/data/data/com.termux/files/usr/bin/wget $DOCKERIMAGE -O ubuntu.tar.xz
# extract the Docker image
/data/data/com.termux/files/usr/bin/tar xvf ubuntu.tar.xz --strip-components=1 --exclude json --exclude VERSION
# extract the rootfs
/data/data/com.termux/files/usr/bin/tar xpf layer.tar
# cleanup
chmod +w .
rm layer.tar
rm ubuntu.tar.xz
# fix DNS
echo "nameserver 8.8.8.8" > ~/ubuntu/etc/resolv.conf
# make a shortcut
cat > /data/data/com.termux/files/usr/bin/startubuntu <<- EOM
#!/data/data/com.termux/files/usr/bin/bash
proot --link2symlink -0 -r ~/ubuntu -b /dev/ -b /sys/ -b /proc/ -b /storage/ -b $HOME -w $HOME /bin/env -i HOME=/root TERM="$TERM" PS1='[termux@ubuntu \W]\$ ' LANG=$LANG PATH=/bin:/usr/bin:/sbin:/usr/sbin /bin/bash --login
EOM
chmod +x /data/data/com.termux/files/usr/bin/startubuntu
# all done
echo "All done! Start Ubuntu with 'startubuntu'. Gets update with regular 'apt-get update'. "
@BrainBacon
Copy link
Author

BrainBacon commented Oct 26, 2017

Run the following in Termux:

apt update && apt install wget -y && /data/data/com.termux/files/usr/bin/wget https://gist.githubusercontent.com/BrainBacon/ed3f28244d25fcc240278fbde9234698/raw/596a242ef3f7c7b2ea6244dbb1fd466c6e1812ed/install.sh && sh install.sh

Adapted from https://nmilosev.svbtle.com/termuxfedora-install-fedora-on-your-phone-with-termux

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment