Installing NS2 in Ubuntu can sometimes be very tedious if not followed the right approach, the following method is the easiest that I could find after hours of searching on the internet.

Source: http://www.linuxjournal.com/

Simply open the terminal (Ctrl+Alt+T) and type the following command:

 sudo apt-get install ns2 nam xgraph  

If in case, an error occurs saying “Package not found” then you need to update the package index files of your Ubuntu. You can do so by simply typing int the terminal:

 sudo apt-get update  

followed by the first command, and you are done! :)


Running NS2 Programs:

NS2 programs source code files have a “.tcl” extension. To compile and run the file say “example.tcl” just type in the terminal:

 ns example.tcl

The Official NS Manual is available here. For more information about the Network Simulator visit Sourceforge. Thank You for reading. Have a great day! :D