
How to Install Metasploit in Termux: The Complete 2025 Guide
Table of Contents
Introduction
Are you looking to turn your Android device into a powerful penetration testing lab? You are not alone. As we move through 2025, the demand for mobile cybersecurity tools has skyrocketed.
The Metasploit Framework is the world’s most advanced tool for testing system vulnerabilities. While it was originally designed for desktop Linux distributions like Kali, learning how to install Metasploit in Termux allows you to run it directly on your smartphone.
However, the process to install Metasploit in Termux on modern Android versions (Android 13, 14, and 15) can be tricky due to security updates and repository changes. This comprehensive guide will walk you through the correct, error-free method to set up Metasploit using the most stable scripts available today.
Why Install Metasploit in Termux?
Before we dive into the commands, it’s important to understand why this setup is so powerful for ethical hackers. When you install Metasploit in Termux, you unlock:
- Portability: Perform security assessments without carrying a laptop.
- Real-World Learning: It is the best way to learn Linux command line basics and network architecture.
- Low Resource Usage: Termux is lightweight, unlike running a full virtual machine.
- No Root Required: You can run most scanners and exploits on a standard, non-rooted phone.
Prerequisites (Read Before Starting)
To ensure the attempt to install Metasploit in Termux doesn’t fail halfway through, please verify your device meets these requirements:
- OS Version: Android 7.0 or higher (Android 12+ users, see the “Phantom Process” section below).
- Free Storage: At least 1.5 GB (The framework and database are large).
- Internet: A stable Wi-Fi connection is highly recommended.
- Battery: Charge your phone to at least 50%.
- App Source: You MUST use the F-Droid version of Termux.
⚠️ Warning: Do not use the Termux app from the Google Play Store. It has been deprecated and will cause “Repository Under Maintenance” errors when you try to install Metasploit in Termux.
Step-by-Step Installation Guide
Step 1: Install Termux from F-Droid
If you have the Play Store version installed, uninstall it now. To properly install Metasploit in Termux, you need the signed version from F-Droid.
- Go to F-Droid.org.
- Search for Termux and download the APK.
- Install it and launch the application.
- Grant Storage Permissions: This is critical for saving your work.Bash
termux-setup-storage
Step 2: Update and Upgrade Packages
In 2025, keeping your repositories synced is vital before you install Metasploit in Termux. This command updates the list of available packages and upgrades your current tools to the latest versions.
Bash
pkg update && pkg upgrade -y
(If the terminal asks you to keep or replace a file version, press Y and Enter).
Step 3: Install Core Dependencies
Metasploit is a complex framework built on Ruby and Python. We need to install these languages, along with git (to clone files) and wget (to download files).
Bash
pkg install git wget python python2 ruby -y
Optional but Recommended: Install lolcat to make your terminal output colorful and easier to read.
Bash
gem install lolcat
Step 4: Download & Install Metasploit (The Stable Script)
Attempting to install Metasploit in Termux manually often leads to “Gem Dependency” errors. To fix this, we will use a community-verified script that automates the compilation process.
1. Clone the Repository:
Bash
git clone https://github.com/h4ck3r0/Metasploit-termux
2. Navigate to the Folder:
Bash
cd Metasploit-termux
3. Run the Installer:
Bash
bash metasploit.sh
☕ Take a Break: This process involves downloading around 500MB of data and compiling Ruby Gems. It can take 10 to 20 minutes. Do not let your phone screen turn off.
Step 5: Launch and Initialize the Database
Once the installation script finishes, you are almost ready. However, for Metasploit to search for exploits quickly, it needs a database connection.
Launch the Console:
Bash
msfconsole
Fixing Database Issues:
If you see a warning like “No database connected”, exit the console (type exit) and run this command:
Bash
msfdb init
Then start msfconsole again. You should now see the famous Metasploit banner!
How to Use Metasploit: Your First Scan
Now that you have managed to install Metasploit in Termux, let’s test it. We will run a simple TCP Port Scan to identify active devices on your local network.
- Search for the module:Bash
search portscan - Select the TCP scanner:Bash
use auxiliary/scanner/portscan/tcp - Set the Target IP:(Replace 192.168.1.1 with your router or target IP)Bash
set RHOSTS 192.168.1.1 - Execute:Bash
run
If you see a list of “Open” ports (like Port 80 or 443), congratulations! Your mobile hacking lab is fully functional.
Troubleshooting Common Errors (2025 Edition)
Even with the best scripts, errors happen when you install Metasploit in Termux. Here is how to fix the most common ones.
| Error Message | Cause | Solution |
| “Process Killed” (Signal 9) | Android 12/13/14 killing high-CPU apps. | Disable “Phantom Process Killer” via ADB commands. |
| “Gem install failed” | Ruby version mismatch. | Run pkg install ruby again to update. |
| “Could not connect to database” | PostgreSQL service is stopped. | Run pg_ctl -D $PREFIX/var/lib/postgresql start. |
| “Repository under maintenance” | Using Play Store version. | Switch to F-Droid version immediately. |
Frequently Asked Questions (FAQ)
Q1: Is hacking with Termux legal?
Answer: Yes, it is 100% legal to install Metasploit in Termux. However, using it to attack networks or devices you do not own or have permission to test is a crime. Always use your powers for Ethical Hacking.
Q2: Does this work on iPhone (iOS)?
Answer: No. Termux is exclusive to Android. iOS users would need to use a specialized shell like iSH, but Metasploit support is very limited there.
Q3: Why is the installation taking so long?
Answer: Metasploit is huge. The script is compiling “native extensions” for Ruby, which requires significant CPU power. On older phones, this can take up to 30 minutes.
Conclusion
You have successfully learned how to install Metasploit in Termux! By following this 2025 guide, you’ve bypassed the common pitfalls of outdated repositories and broken dependencies.
Your Android device is now a capable tool for network reconnaissance and security testing. Remember to keep your packages updated with pkg update regularly.
Found this guide helpful?
Share it with your cybersecurity study group or link back to it on your blog!
- Next Read: Top 10 Basic Termux Commands for Beginners
- Next Read: How to Create Payloads with Msfvenom
