Skip to content

Instantly share code, notes, and snippets.

@DevSecOpsGuy
Created November 3, 2019 14:31
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DevSecOpsGuy/d23931c03d7f1cba392aabbe053f774b to your computer and use it in GitHub Desktop.
Save DevSecOpsGuy/d23931c03d7f1cba392aabbe053f774b to your computer and use it in GitHub Desktop.
Metasploit Framework on Ubuntu 18.04 LTS
Metasploit Framework on Ubuntu 18.04 LTS
##Install Oracle Java 8
sudo add-apt-repository -y ppa:webupd8team/java
sudo apt-get update
sudo apt-get -y install oracle-java8-installer
##Installing Dependencies
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential libreadline-dev libssl-dev libpq5 libpq-dev libreadline5 libsqlite3-dev libpcap-dev git-core autoconf postgresql pgadmin3 curl zlib1g-dev libxml2-dev libxslt1-dev libyaml-dev curl zlib1g-dev gawk bison libffi-dev libgdbm-dev libncurses5-dev libtool sqlite3 libgmp-dev gnupg2 dirmngr
##Installing a Proper Version of Ruby## 2.6.3
##Installing Ruby using RVM:
gpg2 --keyserver hkp://pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
curl -L https://get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
echo "source ~/.rvm/scripts/rvm" >> ~/.bashrc
source ~/.bashrc
RUBYVERSION=$(wget https://raw.githubusercontent.com/rapid7/metasploit-framework/master/.ruby-version -q -O - )
rvm install $RUBYVERSION
rvm use $RUBYVERSION --default
ruby -v
##Installing Ruby using rbenv:
cd ~
git clone git://github.com/sstephenson/rbenv.git .rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
exec $SHELL
git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc
# sudo plugin so we can run Metasploit as root with "rbenv sudo msfconsole"
git clone git://github.com/dcarley/rbenv-sudo.git ~/.rbenv/plugins/rbenv-sudo
exec $SHELL
RUBYVERSION=$(wget https://raw.githubusercontent.com/rapid7/metasploit-framework/master/.ruby-version -q -O - )
rbenv install $RUBYVERSION
rbenv global $RUBYVERSION
ruby -v
##Installing Nmap
mkdir ~/Development
cd ~/Development
git clone https://github.com/nmap/nmap.git
cd nmap
./configure
make
sudo make install
make clean
##Installing Metasploit Framework
cd /opt
sudo git clone https://github.com/rapid7/metasploit-framework.git
sudo chown -R `whoami` /opt/metasploit-framework
cd metasploit-framework
#Install using bundler the required gems and versions:
cd metasploit-framework
# If using RVM set the default gem set that is create when you navigate in to the folder
rvm --default use ruby-${RUBYVERSION}@metasploit-framework
rvm ruby-2.6.3 do rvm gemset create metasploit-framework'
gem install bundler
bundle install
yard config --gem-install-yri
cd metasploit-framework
sudo bash -c 'for MSF in $(ls msf*); do ln -s /opt/metasploit-framework/$MSF /usr/local/bin/$MSF;done'
##Install Postgre SQL Server
sudo apt install postgresql-10 libpq-dev
sudo -u postgres createuser arif -s
# If you would like to set a password for the user, you can do the following
sudo -u postgres psql
postgres=# \password arif
##Configuring Postgre SQL Server
echo "export PATH=$PATH:/usr/lib/postgresql/10/bin" >> ~/.bashrc
. ~/.bashrc
sudo usermod -a -G postgres arif
sudo su - arif
cd /opt/metasploit-framework/
./msfdb init
msfconsole
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment