If you’re interested in running Linux on your Android device, you’re in luck! It’s possible to install Fedora Linux on Android using Termux. Termux is a terminal emulator for Android that allows you to run Linux commands and utilities on your phone or tablet. It does not replace Android. In this article, we’ll walk you through the process of installing Fedora Linux on Android using Termux and show you how to keep it up to date with the latest versions.
Step by step process
Step 1: Install Termux
To get started, you need to install Termux from the Google Play Store. Once you have Termux installed, open it up and type the following command to update the package list:
pkg update
Note: Termux requires Android >= 7 to run. Support for Android 5 and 6 was dropped at v0.83 on 2020-01-01, but you can find old builds on archive.org ( https://archive.org/details/termux-repositories-legacy/ ) if needed.
Step 2: Install Proot-Distro
Next, you’ll need to install Proot-Distro. Proot-Distro is a tool that allows you to install and run Linux distributions in a chroot environment. To install Proot-Distro, run the following command:
pkg install proot-distro
Step 3: Install Fedora
With Proot-Distro installed, you can now use it to install Fedora. To install Fedora, run the following command:
proot-distro install fedora
This will download and install the latest version of Fedora.
Step 4: Configure dnf
Now that you have Fedora installed, you’ll need to configure dnf, Fedora’s package manager. By default, dnf may try to install SELinux packages, which won’t work properly in a chroot environment. To prevent this, exclude SELinux packages installation by editing the dnf configuration file. Run the following command to open the dnf configuration file for editing :
cd ../usr/var/lib/proot-distro/installed-rootfs/fedora/etc/dnf vi dnf.conf
You may substitute the nano editor for vi, if it is more to your liking. Once you’re in the file, find the line that says excludepkgs= and add *selinux* to the end of the line, like so:
excludepkgs=*selinux*
It may be necessary to add the excludepkgs line. Save these changes and exit the editor.
Step 5: Install a Desktop Environment (Optional)
Fedora comes with a number of desktop environments to choose from. If you’d like to install a desktop environment, you can do so with the following commands:
proot-distro login fedora dnf groupinstall "Fedora Workstation" --skip-broken
This will switch from termux into the chroot Fedora installation and install the GNOME desktop environment, along with a number of other packages. If you prefer a different desktop environment, you can replace Fedora Workstation with the name of the group for your preferred environment.
Step 6: Install VNC Server (Optional)
If you plan on using your Fedora installation with a graphical interface, you’ll need to install a VNC server. This will allow you to connect to the Fedora desktop from another computer or device. To install the TigerVNC server, run the following command:
dnf install tigervnc-server.aarch64 -y
This will install the VNC server, along with any necessary dependencies.
Step 7: Upgrading Fedora
Now that you have Fedora installed, you’ll want to keep it up to date with the latest versions. To upgrade Fedora, run the following commands:
sudo dnf upgrade --refresh sudo dnf install dnf-plugin-system-upgrade sudo dnf system-upgrade download –releasever=37 export DNF_SYSTEM_UPGRADE_NO_REBOOT=1 sudo -E dnf system-upgrade reboot sudo -E dnf system-upgrade upgrade sudo dnf upgrade --refresh
First command sudo dnf upgrade –refresh refreshes the package cache and updates any installed packages.
The second command sudo dnf install dnf-plugin-system-upgrade installs the dnf-plugin-system-upgrade package, needed for the upgrade process.
The third command sudo dnf system-upgrade download –releasever=37 downloads the necessary packages for the upgrade to version 37 of Fedora. Replace 37 with the desired release version.
The fourth command export DNF_SYSTEM_UPGRADE_NO_REBOOT=1 sets an environment variable to prevent the system from rebooting after the upgrade.
The fifth command sudo -E dnf system-upgrade reboot reboots the system to start the upgrade process. Make sure to save any important work before running this command.
The sixth command sudo -E dnf system-upgrade upgrade performs the upgrade process.
Finally, the seventh command sudo dnf upgrade –refresh updates any remaining packages and ensures that your system is fully up to date.
Errors Encountered
During the installation and upgrade process, you may encounter errors. Two common errors are described below, along with their solutions.
Error 1: sudo: /etc/sudo.conf is owned by uid 1001, should be 0
Solution: This error occurs when the ownership of the sudo.conf file is incorrect. To fix this, run the following command:
chmod +s /usr/bin/sudo
This sets the setuid bit on the sudo command, which allows it to run with root privileges.
Error 2: filesystem package didn’t get upgraded post OS upgrade
Solution: This error occurs when the filesystem package is not upgraded during the upgrade process. To fix this, run the following commands:
sudo rpm -e --nodeps filesystem dnf download filesystem
The first command removes the filesystem package, and the second command downloads the latest version of the package. If you encounter any errors during the upgrade process, you can use rpmrebuild to rebuild the package with any necessary modifications.
Conclusion
In this article, we’ve shown you how to install Fedora Linux on Android using Termux and how to keep it up to date with the latest versions. While there may be some errors to overcome during the installation and upgrade process, following the steps outlined in this article should help you get Fedora up and running on your Android device in no time.
Konstantin
Installing Termux from the Google Play Store is deprecated and has been for a long time. Please refer to F-Droid or Github instead.
Eduard Lcuena
Agreed, I will try to contact the author to change it
Phani Adabala
👍
Phani Adabala
Thank you, I agree with your statement Konstantin. The revised version will recommend using F-Droid or Github for installing Termux instead.
Konstantin
nothing happened so far 🤔
David Jefferson
The best would still be to get RID OF ANDROID and install FEDORA on smartphones / tablets etc… as NATIVE like a PC. But I really don’t know why in 2023 it’s so hard to install linux on mobile although we are installing on many hardware on PC since 35 years…. makes no sense at all unless it’s done on purpose.
Valentino Rebagliati
It would be as easy as on desktop if phone manufacturers weren’t as protective as they are.
Right now, the custom Android ROM community (in most phones) relies on reverse engineered device trees, which are unstable at best, missing hardware functions (Cameras, 5g, fingerprint readers) most of the time.
Eduard Lcuena
Nobody is forcing you.
There are a lot of limitations, mostly all are related with the architecture of chipset on mobile phones, nevertheless there are several projects trying it, e.g.: Postmarket OS
buğra
Nobody is forcing me and nothing works as they should, so i dont care.
Trap
Can I do this on an old tablet with Android 4.4?
Eduard Lcuena
You will need to check if termux is available for that tablet, but I think it should be.
Phani Adabala
Hey Trap, “Termux requires Android >= 7 to run. Support for Android 5 and 6 was dropped at v0.83 on 2020-01-01, but you can find old builds on archive.org (https://archive.org/details/termux-repositories-legacy/) if needed.
Rhinomick
I believe this does not wipe out Android…..am i correct?
Eduard Lcuena
No, it doesn”t. It just installed a Fedora distro inside your android.
Phani Adabala
👍
Rhinomick
amazing!!!
Brian
Hi
you missed
proot-distro login fedora
trying it now! 🙂
Phani Adabala
Hey Brian!
Great catch! You’re absolutely right in the next update, I’ll make sure to include it in the sequence. Your keen eye for detail is much appreciated!
Marc Teale
A few notes:
– Vi/Vim does not come in the default v0.118.0 termux image on GitHub. Install it with
to edit dnf.conf.
– The “excludepkgs=” line is not in dnf.conf. It should be added.
– There’s a missing command between steps 4 and 5. You must run “proot-distro login fedora” to switch from termux into the chroot Fedora installation.
Phani Adabala
Thank you, Marc!
But, at this stage we’ve successfully installed Fedora Linux and logged into the system.
By default, Fedora Linux includes the vim-minimal package that provides the vi command. There is already a note to add the line “excludepkgs=*” to dnf.conf.
And yes, the command “proot-distro login fedora” will be added in the revised version to ensure a seamless switch from Termux to the chroot Fedora installation.
Jason
Thanks, now I have a weekend project for the old motorolla lying around.
Given its running in a chroot environment it would be interesting to see what devices it has access to on the phone.
Rhinomick
dnf groupinstall “Fedora Workstation” –skip-broken
I would like to install KDE, what should i write?
Mark A. Stevens
It would seem you can install KDE with the following:
dnf groupinstall “KDE Plasma Workspaces” –-skip-broken
The final result may or may not work since SELinux enabled programs are not installed.
You can find all groups with the command:
dnf grouplist –all
Mehdi Haghgoo
I really like this article and this topic of installing Linux on Android phones.
Thanks for the article.
Now, I guess it would be possible to gradually use our Android phones connected to external large displays as workstations, given the growing power of Android devices, am I right?
Any advice or planned article on external Android displays used with underlying Linux?
Norbert J.
That’s indeed amazing! I have installed Termux for years but never imagined that something like this would be possible. However owners of old or low-end smart phones (like me) may be out of luck because Fedora no longer supports 32 bit ARM.
Tae
‘cd’ comment written in the description couldn’t find the directory to remove selinux. So I skipped the process and jump to install fedora work station… Will it cause problem?
Peter
Good article – have installed Fedora with Mate desktop but having trouble with tigervnc – can anyone point me to any article explaining how to get this to work from Fedora on a laptop?
Mahdi
Great Article !
Could you please elaborate on :
– Step 5: Install a Desktop Environment : Does this mean we can access from the Android device’s screen the installed Desktop Environment ?
With a full fledged Fedora now installed, could it access the Android device’s Wifi with either CLI or with Gnome’s NetworkManager ?
What about Camera access from Fedora for let’s say videoconferencing through Firefox ?
deep hazra
Thank You For Sharing Knowledge
https://advanceslinux.com/linux-types-of-files/