How to Install Metasploit on Ubuntu
Reading Time: 4 minutesMetasploit is a valuable pentesting tool that doesn’t come as part of the Ubuntu desktop, but it’s very easy to install on your own.
Metasploit is a widely used penetration testing tool that helps security professionals find vulnerabilities in networks and systems. You can use Metasploit to simulate an attack and expose vulnerabilities.
On Kali Linux, Metasploit comes pre-installed, but you can also install it on other Linux distributions. The tool is easy to install, configure, and learn on Ubuntu as well.
What Is Metasploit
Metasploit is a security project that helps you gather information about different vulnerabilities. One approach is to simulate an attack in order to test a system’s security. You can also use Metasploit to develop IDS signatures.
The Metasploit Framework is a component of the larger Metasploit Project, which is open source and designed to create and execute exploit code against a remote host.
Metasploit is mostly used as a penetration testing tool to find loopholes in a system so that they can be fixed later. Additionally, the project includes tools for evasion and anti-forensics
Installation Using the Shell Script Installer
If you want to install Metasploit on Ubuntu using the quickest way possible, then make use of the shell script installer. This method works on any system that is Debian-based, including Ubuntu.
Here are the steps to install Metasploit with the help of the shell script installer:
Step 1: Open Ubuntu Terminal
You will install Metasploit via Ubuntu’s command-line interface (CLI). To open it, press Ctrl + Alt + T on the keyboard.
Step 2: Install Metasploit Shell Script Installer
To download the Metasploit shell script installer, run:
wget http://downloads.metasploit.com/data/releases/metasploit-latest-linux-x64-installer.run
Once you have downloaded the shell script installer, verify it by listing down its contents:
ls -la metasploit-latest-linux-x64-installer.run
Step 3: Grant the Shell Script Installer Execute Permissions
You won’t be able to run the installer unless you give it the permission to become an executable file. To do that, you will need to use a chmod command:
chmod +x ./metasploit-latest-linux-x64-installer.run
Step 4: Run the Shell Script Installer to Install Metasploit
To install Metasploit, run the installer with ./ and sudo.
sudo ./metasploit-latest-linux-x64-installer.run
After running the installer the first thing you will see on your screen is a license agreement. Read the license, select I accept the agreement, and then click Forward.
Next, choose the folder where you want to install Metasploit. Best to go with the default folder.
If you want to install Metasploit as a service, select Yes.
In the next window, the installer will ask you to disable the anti-virus and firewall on your system. Metasploit uses some techniques that could be blocked by the system antivirus or firewall, so it is wise to disable both while running the Metasploit framework.
After that, you need to select the port that the Metasploit service will run on. If you want to go with the default port, keep 3790.
Metasploit, by default, uses localhost as the server’s name. It also generates a self-signed certificate with a validity time of 10 years. Keep the settings as default and proceed.
Now that all the necessary Metasploit configurations have been provided, the installer shell script will begin to install the framework. This will take a few minutes to install.
Step 5: Create a New User for Metasploit
Once Metasploit is successfully installed on your system, you will see a welcome page on your screen.
To access Metasploit setup page, locate the URL at the bottom of the welcome page.
https://localhost:3790
Using this URL on any browser you can open the setup page and create a new user. Provide a username, a strong password, full name, email, organization, and time zone to create a user account.
Step 6: Access Metasploit Command Line
Once the user is created, you can access Metasploit console with:
msfconsole
How to Compile and Install From Source
Another way you can install Metasploit is by using the source code. When you install Metasploit, you want to use all its latest features. Sometimes the latest features have not yet been added to the script. In that case, you will compile and install Metasploit using the source code.
Step 1: Update and Upgrade Ubuntu
Before proceeding to install Metasploit framework on Ubuntu, it is recommended to update and upgrade your system to get rid of any broken or outdated packages. Update and upgrade your system with:
sudo apt-get update && apt-get upgrade
Step 2: Install Necessary Dependencies for Metasploit
Once the system is all updated and upgraded, you can now install essential dependencies that are required to install and build Metasploit framework.
apt install gpgv2 autoconf bison build-essential postgresql libaprutil1 libgmp3-dev libpcap-dev openssl libpq-dev libreadline6-dev libsqlite3-dev libssl-dev locate libsvn1 libtool libxml2 libxml2-dev libxslt-dev wget libyaml-dev ncurses-dev postgresql-contrib xsel zlib1g zlib1g-dev -y
Step 3: Download Metasploit Source Code
Once the essential dependencies have been installed, the next step is to download the Metasploit source code:
curl https://raw.githubusercontent.com/rapid7/metasploit-omnibus/master/config/templates/metasploit-framework-wrappers/msfupdate.erb > msfinstall
The Metasploit source code will be stored in the msfinstall file in your present working directory. To ensure that you have downloaded the correct file, list the contents with:
ls -la msfinstall
Grant the file permissions to become an executable:
chmod 755 msfinstall
Step 4: Run the Code to Install Metasploit on Ubuntu
To begin installing Metasploit, run the code:
./msfinstall
Step 5: Access Metasploit Command Line
You can now access the Metaploit command line with:
msfconsole
How to Uninstall Metasploit From Ubuntu
Removing Metasploit from Ubuntu is very simple, all you need is a basic Linux command and the framework will be instantly removed from your system.
If you installed Metasploit using the shell script installer, remove the framework using:
sudo /opt/metasploit/uninstall
However, if you installed Metasploit using the source code, remove it with:
sudo apt-get remove metasploit-framework
Ready to Start Pentesting on Ubuntu?
Now that you have the entire framework deployed on your machine, you can start your journey in pentesting.
Metasploit alone will not help you launch a full-fledged penetration test. It is a good practice to use a combination of tools to expand the scope of the tests to gather as much information as possible. Once you are able to figure out the weaknesses, the next step is to remove these loopholes by hardening the security of the system so that real hackers fail to exploit any weaknesses.
Reference: https://www.makeuseof.com/how-to-install-metasploit-on-ubuntu/
Ref: makeuseof
MediaDownloader.net -> Free Online Video Downloader, Download Any Video From YouTube, VK, Vimeo, Twitter, Twitch, Tumblr, Tiktok, Telegram, TED, Streamable, Soundcloud, Snapchat, Share, Rumble, Reddit, PuhuTV, Pinterest, Periscope, Ok.ru, MxTakatak, Mixcloud, Mashable, LinkedIn, Likee, Kwai, Izlesene, Instagram, Imgur, IMDB, Ifunny, Gaana, Flickr, Febspot, Facebook, ESPN, Douyin, Dailymotion, Buzzfeed, BluTV, Blogger, Bitchute, Bilibili, Bandcamp, Akıllı, 9GAG