# Install Metasploit
## Ubuntu
```Bash
# Update the list of available packages and upgrade all installed packages to their latest versions.
sudo apt -y update && sudo apt -y upgrade
# Install essential packages and libraries needed for building and running software
sudo apt-get install -y curl gnupg2 build-essential libssl-dev libreadline-dev zlib1g-dev
# - curl: tool for transferring data with URLs
# - gnupg2: GNU Privacy Guard for secure communication
# - build-essential: a package that includes compiler and linker tools
# - libssl-dev: development libraries for SSL and TLS protocols
# - libreadline-dev: library that allows users to edit command lines
# - zlib1g-dev: compression library needed by many software packages
# Download the Metasploit installer script from Rapid7's GitHub repository.
curl https://raw.githubusercontent.com/rapid7/metasploit-omnibus/master/config/templates/metasploit-framework-wrappers/msfupdate.erb > msfinstall
# Make the downloaded installer script executable.
chmod +x msfinstall
# Run the installer script to install Metasploit Framework.
sudo ./msfinstall
```
## RedHat
```Bash
# Update all available packages on the system
sudo yum -y update
# Install development tools and necessary libraries:
sudo yum groupinstall -y "Development Tools"
sudo yum install -y curl gnupg2 openssl-devel readline-devel zlib-devel
# - curl: tool for transferring data with URLs
# - gnupg2: GNU Privacy Guard for secure communication
# - Development tools (compilers, etc.): 'Development Tools' group installs gcc, make, etc.
# - openssl-devel: development libraries for SSL/TLS
# - readline-devel: development libraries for command line editing
# - zlib-devel: compression library used by many software packages
# Download the Metasploit installer script from Rapid7's GitHub repository
curl https://raw.githubusercontent.com/rapid7/metasploit-omnibus/master/config/templates/metasploit-framework-wrappers/msfupdate.erb > msfinstall
# Make the downloaded installer script executable
chmod +x msfinstall
# Run the installer script to install Metasploit Framework
sudo ./msfinstall
```
## SLES
```Bash
# Refresh the list of available packages and apply all recommended patches and upgrades.
sudo zypper refresh
sudo zypper update -y
# Install essential packages and development tools:
sudo zypper install -y curl gpg2 gcc make automake autoconf \
libopenssl-devel readline-devel zlib-devel
# - curl: tool for transferring data with URLs
# - gpg2: GNU Privacy Guard for secure communication
# - gcc, make, automake, etc.: for compiling software (build-essential equivalent in SUSE)
# - libopenssl-devel: development headers for SSL/TLS (libssl-dev equivalent)
# - readline-devel: library for command line editing (libreadline-dev equivalent)
# - zlib-devel: compression library
# Download the Metasploit installer script from Rapid7's GitHub repository.
curl https://raw.githubusercontent.com/rapid7/metasploit-omnibus/master/config/templates/metasploit-framework-wrappers/msfupdate.erb > msfinstall
# Make the downloaded installer script executable.
chmod +x msfinstall
# Run the installer script to install Metasploit Framework.
sudo ./msfinstall
```