Installation steps:
0 × 00-clone the Metasploit project from github to the local device;
0 × 01-install and configure postgresql;
0 × 02-install a specific version of ruby and resolve dependencies;
0 × 00 clone Metasploit project from github to local
Github has everything. Many good projects can be found on it. First, open the terminal and enter the following command. Because 10.9.3 comes with git, no additional installation is required.
git clone https://github.com/rapid7/metasploit-framework.git /usr/local/share/metasploit-framework
After cloning the file to a local directory, copy the configuration file database in the metasploit-framework/config/directory. add yml to environment variables (database. yml may not exist. Copy the database directly. yml. example)
Add the following configuration to $ HOME/. bash_profile or another configuration file.
export MSF_DATABASE_CONFIG=/usr/local/share/metasploit-framework/config/database.yml
Install and configure postgresql 0 × 01
After metasploit is downloaded, you are not in a rush to configure it, because the default metasploit database postgresql has not been installed
You can directly use brew to download and automatically install postgresql. You can run the following command:
brew install postgresql --without-ossp-build
Wait until the automatic installation is complete. initialize postgresql (if an error occurs, delete/usr/local/var/postgres and try again)
initdb /usr/local/var/postgres
After initialization, add database users and create corresponding databases for metasploit.
createuser msf -P -h localhost createdb -O msf msf -h localhost
(If you do not understand the above parameters, you can use Baidu. I will not explain it too much here)
After completing the preceding steps, you need to change the metasploit database connection configuration, that is, the database. yml file in step 1.
In database. yml, modify the information as follows:
production: adapter: postgresql database: msf username: msf password: <your password> host: 127.0.0.1 port: 5432 pool: 75 timeout: 5
Step 3!
(You can add alisa to facilitate every postgresql startup)
alias pg_start='pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start'alias pg_stop='pg_ctl -D /usr/local/var/postgres stop'
0 × 02 install a specific version of ruby and solve the dependency
Speaking of ruby multi-version management, rbenv is the most powerful tool here (which can be found on github or directly installed using brew)
brew install rbenv ruby-build
After rbenv is installed, add the following settings to $ HOST/. bash_profile or another configuration file:
eval "$(rbenv init -)"
You can use rbenv to install ruby of a specific version. First, list the currently available ruby versions.
rbenv install --list
We can see that almost all ruby versions are available. Here we choose to install the ruby-1.9.3-p547 (because OS X 10.9.3 comes with ruby 2.0.0, which may cause problems in some places)
rbenv install 1.9.3-p547
This may take a while. rbenv will install ruby of each version under $ HOST/. rbenv/versions/. After that, set the downloaded version to the default version.
rbenv rehashrbenv global 1.9.3-p547
After that, open the terminal again and enter ruby-version to see that the current default ruby version has been set to 1.9.3-p547.
Install bundle below to solve the dependency problem
gem install bundle
Connection problems may occur during installation. Just try it several times.
After the bundle is installed, go to the metasploit home directory again to solve the dependency of the module package.
cd /usr/local/share/metasploit-frameworkrbenv rehashbundle install
(During the bundle install process, the installation of a specific version of the module may fail. Solution: Use the gem to install the alternative version according to the version restrictions in GemFiles, delete GemFiles. lock, re-run bundle install)
After the dependency is resolved, you can run msfconsole in the directory to start the metasploit terminal controller (postgresql has been started, otherwise the database will not be connected)
You can batch send the msf command ln to the bin
for MSF in $(ls msf*); do ln -s /usr/local/share/metasploit-framework/$MSF /usr/local/bin/$MSF;done
The following is