Sunday, 18 January 2015

How to install ns2 network simulator on linux

To install ns2 network simulator on linux you to need download some libraries in addition to downloading the actual package and also have to add some environment vaiables.

Follow these steps to download ns2 in your linux machine.

1. Download these libraries
    $ sudo apt-get update
    $ sudo apt-get install tcl8.5-dev tk8.5-dev build-essential autoconf automake perl xgraph libxv-dev libxt-dev libx11-dev

While you are downloading these libraries you may notice some of these were already installed.

2. Now after downloading all the libraries download ns2 package, you can easily find that on web or you can do this. http://sourceforge.net/projects/nsnam/
  

   $ tar -xzf ns-allinone-2.35.tar.gz
   $ cd ns-allinone-2.35

Before installing it
   $ gedit ns-2.35/linkstate/ls.h

In line 137 change erase() to this->erase() 
   $ ./install 

3. After downloading all the required package and libraries, set the environmental variable path to otcl, ns2 and nam in .bashrc file.
Change /home/shubham/ns2 with your path to ns-allonone-2.34

# LD_LIBRARY_PATH
OTCLLIB=/home/shubham/ns2/ns-allinone-2.35/otcl-1.14
NS2=/home/shubham/ns2/ns-allinone-2.35/lib
USR_LocalLIB=/usr/local/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$OTCLLIB:$NS2:$USR_LocalLIB

# TCL_LIBRARY
TCLIB=/home/shubham/ns2/ns-allinone-2.35/tk8.5.10/library
USRLIB=/usr/lib
export TCL_LIBRARY=$TCLIB:$USRLIB

# PATH
XGRAPH=/home/shubham/ns2/ns-allinone-2.35/xgraph-12.2/:/path/to/ns-allinone-2.35/bin:/path/to/ns-allinone-2.35/tcl8.5.10/unix:/path/to/ns-allinone-2.35/tk8.5.10/unix
NS=/home/shubham/ns2/ns-allinone-2.35/ns-2.35
NAM=/home/shubham/ns2/ns-allinone-2.35/nam-1.15
export PATH=$PATH:$XGRAPH:$NS:$NAM

4. Now validate it.
   $ source .bashrc
   $ cd ns-allinone-2.35
   $ cd ns-2.35
   $ ./validate

Now ns2 will be installed and to check if it is installed then type ns and press enter if symbol changes to % then ns is installed.
   $ ns
   %
 
 
 

Saturday, 17 January 2015

How to run tor on entire computer using proxychains and polipo

For running tor on the entire system, follow following steps.

1. Firstly download proxychains $ sudo apt-get install proxychains

2. Now, configure proxychains
     $ sudo nano /etc/proxychains.config
   
3. The bottom of the file replace "socks4" with "socks5" and "9050" with "9150" without "".

4. Now connect tor and remove the system proxy.

5. Install polipo
   $ sudo proxychains apt-get install polipo

6. Polipo will be downloaded using tor network and now configure polipo.

7.  $ sudo nano /etc/polipo/config 

Add following lines to end of the file.

socksParentProxy = localhost:9050
diskCacheRoot=""
disableLocalInterface=true

8. $ sudo service polipo restart

9. After all this is done change your system proxy to 127.0.0.1 and port 8123. If any application requires proxy supply this proxy.

10. After everything is setup, now you can download from terminal without using proxychains again and again, just type $ sudo apt-get install <package>

So, these were the steps to run tor on the entire linux machine.

How to migrate android studio form windows to linux

If you using android studio in windows and wants to move your work to linux, then you are at the right place. Google has lately made this really easy with the stable release of android studio.
Follow these steps:

1. Download android studio for linux and android sdk from google developer site https://developer.android.com/sdk/index.html

2. After downloading both the files extract them in your home folder.

3. Now  $ cd android-studio/bin/
             $ ./studio.sh

4. Now, install wizard will appear and follow the step to install it. You can download the sdk from this wizard or use the installed sdk by choosing custom installation and providing the path of the sdk.

5. During the installation you have to give the path of java jdk. It is usually /usr/local/jdk1.x.x/

Sometimes after the installation, new won't be able to create a new project then you try importing a project and then creating a new project.