Termux-Fedora - install Fedora on your phone with Termux

Termux is an awesome new open source app for Android which provides you with a basic Linux shell. It also has a tiny repository with some packages and one of those packages is proot which you may remember from my GNURoot tutorial.

GNURoot way of getting Fedora on your unrooted Android phone still works, but this way is much cleaner and we have more control over what’s going on. I’ve been using this for a couple of days and it has been really stable and fast.

Anyway to install Fedora on your unrooted (or rooted) Android phone you have to:

apt update && apt install wget -y && /data/data/com.termux/files/usr/bin/wget https://raw.githubusercontent.com/nmilosev/termux-fedora/master/termux-fedora.sh && sh termux-fedora.sh

and wait. If everything goes well, you can enter Fedora chroot with a simple fedora.

This is a script I wrote last night and it is available on GitHub. I really learned a lot from previous crouton-fedora and GNURoot attempts, and I hope the script will work for you. Here it is with some comments so you can see what it does:

# install necessary packages

apt install proot tar -y

# get the docker image

mkdir ~/fedora
cd ~/fedora
/data/data/com.termux/files/usr/bin/wget http://download.fedoraproject.org/pub/fedora/linux/releases/24/Docker/armhfp/images/Fedora-Docker-Base-24-1.2.armhfp.tar.xz

# extract the Docker image

/data/data/com.termux/files/usr/bin/tar xvf Fedora-Docker-Base-24-1.2.armhfp.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 Fedora-Docker-Base-24-1.2.armhfp.tar.xz

# fix DNS

echo "nameserver 8.8.8.8" > ~/fedora/etc/resolv.conf

# make a shortcut

cat > /data/data/com.termux/files/usr/bin/fedora <<- EOM
#!/data/data/com.termux/files/usr/bin/sh
proot -0 -r ~/fedora -b /dev/ -b /sys/ -b /proc/ -b $HOME /bin/env -i HOME=/root TERM="$TERM" PS1='[root@f24 \W]\$ ' PATH=/bin:/usr/bin:/sbin:/usr/sbin:/bin /bin/bash --login
EOM

chmod +x /data/data/com.termux/files/usr/bin/fedora

# all done

echo "All done!, start Fedora with 'fedora'"

Please try to support the author of Termux, he is really doing an awesome job with it!

Have fun! (and send patches) :)

 
411
Kudos
 
411
Kudos

Now read this

Fedora on non-rooted Android phones - 2016 update

Hi everyone, just wanted to give you a quick update on the Fedora in a Android chroot project. Anyway, I’m pleased to report that my tutorial here: http://nmilosev.svbtle.com/gnuroot-fedora-arch is still working fine! I am currently... Continue →