How To Install Metasploit on Ubuntu Machine Without Any Error | Install Metasploit on Ubuntu


Hello, welcome back to EFX Tv Uk2blogger. I hope you doing good and having fun in your life. Today we are going to fix one of the most unwanted errors we come across while using the Metasploit on Ubuntu. Today we are going to fix all the errors and will show you how to install Metasploit on Ubuntu Machine Without Any Error.

Let us see what are the things we are going to do to Install Metasploit On our Ubuntu Machine. You can say this blog is a 100% solution to all the errors you might have been facing until now. First we will install Metasploit on our Ubuntu Machine using a repository which is the easiest work. After that we will create the Metasploit database also known as 'createdb'. Without database we may not be able to get 200% useful features of Metasploit on our ubuntu machine. After that we will connect the database with the Metasploit. Another thing I want to share is, the ways to Uninstall the Metasploit properly from our Ubuntu machine. Now let's get started.

There is no need to read all the entire blog, you can use these commands and most of the thing is skippable. If you are concern about errors, you should check the entire blog.



These are the things we will Install and fix so that we can Install Metasploit on Ubuntu Machine Without Any Error:
1. How to Install Metasploit without any error?
2. How to create Metasploit username and password to connect Metasploit database.
3. How to create the Metasploit database?
4. How to connect with Database?
5. How to remove Metasploit?

1. How to Install Metasploit without any error?

Before doing anything must run Update and Upgrade command. As below.
>sudo apt-get update
>sudo apt-get upgrade
Now we will add a 'ppa:backbox/four' repository to our repository list using commands. So that out ubuntu machine can recognize the Metasploit installation commands. Without adding this repository Metasploit installation command will not work on Ubuntu. To add the ppa:backbox/four' repository run a simple command written below.
>sudo apt-add-repository ppa:backbox/four

Again use update and upgrade the command, which will allow the Ubuntu to validate the further commands.
>sudo apt-get update
>sudo apt-get upgrade

Now run a command (NOTE: Without adding repository this command will not work) so that we can install all the required files associated with Metasploit. Use the command as written below.
>sudo apt-get install metasploit-framewor


2. How to create a Metasploit username and password?

Once we finish with the installation we need to create the username and password which allows us to connect the Metasploit database easily. Metasploit database connectivity is required to use the full potential of Metasploit. To create the username and password simply run the command shown below.
>sudo -u postgres createuser metaefx -P -S -R -D
BEFORE HITTING ENTER READ IT CAREFULLY:  the word 'metauser' is the specified username you can change it according to you need. Make sure to remember that username is metauser we require this later. Once you hit enter terminal will request you to enter a password for the created user. Make sure you should not use special characters for the password. Use a combination of 'Capital Letters + Small Letters + Numbers.

3. How to create the Metasploit database?

To create the Metasploit database simply use the command written below.
>sudo -u postgres createdb -O metaefx databasedy

BEFORE HITTING ENTER READ IT CAREFULLY: sudo -u postgres createdb -O "UserNameYouWAnt" "Password". You remember the user we created that is perfect, if you don't go ahead and create another user. After the username we have assigned the Password which is very simple to read. You can create more complex like ABce54tTY80cEtyp548AYG45 something like that (No Special Characters like !@#$%^&*(){}[].,/`\| etc). I hope everything is great so far.

Now run the msfconsole command (this command is used to run the Metasploit Framework). Great. Now check if the database is connected by typing a simple command written below.
>db_status

Till now the Metasploit database is not connected. Now we will connect the database we just have created.

4. How to connect with Database?

Now we will connect the database. Simply run commands as written below.
>cd /
>cd ~
>cd .msf4/
>ls
Check if database.yml file is there or not. If the database.yml file is there we need to edit some of the things. (if not just copy-paste the text in the database.yml file.
production:    adapter: postgresql
   database: msf
   username: metauser
   password: 123456789
   host: 127.0.0.1
   port: 5432
   pool: 75
   timeout: 5
change the user name and password with the credentials you entered for you. For more clarity you can watch the video I've attached at the end of this blog.) To edit/create the database.yml run command as shown below.
>sudo gedit database.yml

Now check for user name and password section, if username and password is the same as you entered in the terminal just close the gedit text editor. Now you are ready to go.
>msfconsole

After running this command it will take some time to load the Metasploit. Once it gets loaded run a few more commands.
>db_disconnect
>db_connect metaefx:123456789@127.0.0.1:5439/databasedy

BEFORE HITTING ENTER READ IT CAREFULLY: after the db_connect    " metauser:123456789 is the user name and password. Change it with yours. Make sure there should be no space. Now run another command to check the database is connected to msf_database or not.
>db_status
Cheers!! you have perfectly Install Metasploit on Ubuntu Machine Without Any Error. Now let us check How to Uninstall Metasploit from our Ubuntu Machine.

5. How to remove Metasploit?

To remove the Metasploit run few commands.

>sudo apt remove metasploit-framework

To remove the ppa:backbox/four we added in the repository list.
>sudo add-apt-repository -r ppa:backbox/four

Now go to the opt directory list the files
>cd /
>cd /opt
>ls

you can see a folder name metasploit-framework just remove it by using the command written below.
>sudo rm -rf metasploit-framework


This was it for the day. I hope you loved this blog. If you want a more clear view you can watch the video attached below. Take care of your stay home and stay blessed. Thank you so much. Please subscribe to my youtube channel friends I need your support and valuable feedback.

Disqus Comments