Setting up a Test Environment on Ubuntu Linux

Jonathan Cran edited this page Nov 4, 2017 · 40 revisions

The following instructions have not been tested since the last update. If you have any trouble with these instructions, please hop in the gitter.im room, and ask for help!!

Getting started

  • Get access to the system's CLI
  • Make sure you have enough memory (8GB+ is recommended)
free -m

Setting up Dependencies

This section helps you set up all the software and libraries that intrigue-core depends on.

  • Update the system
sudo apt-get -y update && sudo apt-get -y upgrade
  • Install Git and Build-Essential meta package
sudo apt-get -y install git-core build-essential
  • Install DB libraries
sudo apt-get -y install libpq-dev postgresql-9.6 postgresql-server-dev-9.6 redis-server
  • Check to see if a JRE is installed & if not installed, install a JRE
java -version
sudo apt-get -y install default-jre
  • Install nmap, zmap
sudo apt-get -y install nmap zmap
  • Install masscan
sudo apt-get -y install git gcc make libpcap-dev
git clone https://github.com/robertdavidgraham/masscan
cd masscan
make
sudo make install
  • Install PhantomJS & Imagemagick
sudo apt-get -y install build-essential chrpath libssl-dev libxft-dev libfreetype6-dev \
  libfreetype6 libfontconfig1-dev libfontconfig1 imagemagick
wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2
sudo tar xvjf phantomjs-2.1.1-linux-x86_64.tar.bz2 -C /usr/local/share/
sudo ln -s /usr/local/share/phantomjs-2.1.1-linux-x86_64/bin/phantomjs /usr/local/bin/
  • Make sure your user can run nmap, masscan as root. Add these lines to /etc/sudoers:
%users    ALL = (ALL) NOPASSWD: /usr/local/bin/nmap
%users    ALL = (ALL) NOPASSWD: /usr/local/bin/masscan
  • Install rbenv, ruby-build, and rbenv gemset and ruby
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
cd ~/.rbenv && src/configure && make -C src
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile 
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile

# note for Ubuntu Desktop use .bashrc, for those that are using zsh use .zshrc. 
source ~/.bash_profile 
# or source ~/.bashrc for desktop
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
git clone git://github.com/jf/rbenv-gemset.git $HOME/.rbenv/plugins/rbenv-gemset
rbenv install 2.4.0
  • Create a gemset
rbenv gemset create 2.4.0 core

Getting the code

  • Pull down the code from Github
git clone https://github.com/intrigueio/intrigue-core.git core
  • Install gems via bundler
cd core
gem install bundler --no-ri --no-rdoc
bundle install

Edit your postgres config to trust local connections

sudo vim /etc/postgresql/9.6/main/pg_hba.conf

When complete it should look like this:

# TYPE  DATABASE        USER            ADDRESS                 METHOD

# "local" is for Unix domain socket connections only
local   all             all                                     trust
# IPv4 local connections:
host    all             all             127.0.0.1/32            trust
# IPv6 local connections:
host    all             all             ::1/128                 trust

Use postgres as the backend server

sudo su -
su postgres
createuser intrigue -P # and enter a password
createdb intrigue_dev --owner intrigue

Configure & migrate the database

# now edit the config/database.yml file if you configured postgres 
bundle exec rake db:migrate

Edit the system config and set a password

Open config/config.json and edit the 'password' field

Start it up

  • Start the application
foreman start

  • Ensure it's running (should show it running on 127.0.0.1:7777)
netstat -lntp

Now, simply edit the database "development" config to correspond with your postgres database settings

OPTIONAL: Configure it to listen on 0.0.0.0:7777 ...

NOTE.. This can affect security of your system. You'll want to set a strong password (see above) before doing this. This is not a good idea unless you know what you're doing.

You've been warned. Open up an editor with vim config/puma.rb and edit the line bind 'tcp://127.0.0.1:7777' to bind 'tcp://0.0.0.0:7777'

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.