Sunday, December 6, 2015

How to uninstall ns2 from Ubantu

Uninstall just ns2

sudo apt-get remove ns2
This will remove just the ns2 package itself.

Uninstall ns2 and it's dependencies

sudo apt-get remove --auto-remove ns2
This will remove the ns2 package and any other dependant packages which are no longer needed.

Purging your config/data too

If you also want to delete your local/config files for ns2 then this will work.
sudo apt-get purge ns2
Or similarly, like this ns2
sudo apt-get purge --auto-remove ns2

Step by step installation of ns-2.34 on ubuntu 14.04

Step by step installation of ns2.34 on ubuntu 14.04


step 1: step1: Download ns-allinone-2.34.tar.gz

Download link:
http://sourceforge.net/projects/nsnam/files/allinone/ns-allinone-2.34/

step 2:Copy it to home folder(not compulsory, you can change as per your choice )

step 3:Open Terminal (Altr+ctrl+t)

step 3:Install the basic packages required to install the ns2




        $sudo apt-get update

        $sudo apt-get install build-essential autoconf automake libxmu-dev


step 4: Extract tar file to home. In terminal default directory is home.
            Run follwing command to extract tar file to home directory

          $tar -zxvf ns-allinone-2.34.tar.gz

step 5: Edit line 137 of ns-allinone-2.35/ns-2.35/linkstate/ls.h file as

    
        void eraseAll() this->erase(baseMap::begin(), baseMap::end()); }

              after change save and close this file.

step 6: Modify the specified files in ns-allinone-2.34 folder as specified below:

         i. In ns-allinone-2.34/otcl-1.13/configure 
            

         change SHLIB_LD="ld -shared" to SHLIB_LD="gcc -shared"

        ii. ns-allinone-2.34/ns-2.34/tools/ranvar.cc  line:219 change

           return GammaRandomVariable::GammaRandomVariable(1.0 + alpha_, beta_).value() * pow (u, 1.0 / alpha_);
                      to
            return GammaRandomVariable(1.0 + alpha_, beta_).value() * pow (u, 1.0 / alpha_); 
 


     
         iii.Change the lines 183 and 185 in file ns-allinone-2.34/ns-2.34/mobile/nakagami.cc to
              resultPower = ErlangRandomVariable(Pr/m, int_m).value();
                      and
              resultPower = GammaRandomVariable(m, Pr/m).value();

        iv.Next add a bellow line after line 64 in ns-allinone-2.34/ns-2.34/mac/mac-802_11Ext.h
              #include <stddef.h> 



step 7:To install ns2  go to ns-allinone-2.34 directory and run ./install

           $ cd ns-allinone-2.34/
      
           $./install

            it will take 20- 30 min or may be more time to install

step 8: After this go to base directory and following command

         $cd ns-allinone-2.34/ns-2.34

           $sudo make install  

step 10: Run ns

            $ns

             It will show % sign
             type exit to exit

            Run nam command

            $nam

             it will show nam window



if nam shows you error like segmentation fault(core dumped)

go to nam-1.15 and run

$cd ns-allinone-2.34/nam-1.14

$sudo cp nam /usr/local/bin


now run nam

$nam