for Debian based (mint/ubuntu)
run these commands one at a time:
1)Update package lists
sudo apt update
2)Install Ruby build deps (compiler + libffi + dev headers)
sudo apt install -y build-essential libffi-dev ruby-dev ruby-bundler
3)Download the Metasploit installer script
curl -o msfinstall https://raw.githubusercontent.com/rapid7/metasploit-omnibus/master/config/templates/metasploit-framework-wrappers/msfupdate.erb
4) Make the installer executable
chmod +x msfinstall
5) Run the installer (use sudo if it asks for root)
./msfinstall
6) Start Metasploit
msfconsole
If any command fails, paste the first ~20 lines of the error and I’ll help diagnose it.