I am installing the ubuntu16.04 version on VMware and then installing the NS2.35.
1. Download NS2 installation package, here I choose the ns-allinone-2.35.tar.gz compression format of all in one installation package,all in one installation package contains all the components, more convenient, also attached:
Http://www.isi.edu/nsnam/ns/ns-build.html
2. Before the installation, you need to do some preparatory work to configure the environment, enter the following code:
$sudo apt-get install build-essential
$sudo apt-get install TCL8. 4 Tcl8. 4-dev tk8. 4 tk8. 4-dev
$sudo apt-get install Libxmu-dev libxmu-headers
3.NS2 Decompression and installation (can also be downloaded in Ubuntu under the Internet command)
First Copy the ns-allinone-2.35.tar.gz to the home/xxx folder. XXX Represents the Ns2 folder that you set up yourself . Then go to the terminal, enter
TAR-XZVF ns-allinone-2.35. tar.gz
CD NS-allinone-2.35
. /install
No accident, this part must have a variety of problems, such as my problem is:
Linkstate/ls.h:137:note:declarations in dependent base ' std::map<int , LSIDSEQ, std::less<int,std::allocator<std::p air<const int, Lsidseq>>>' is not found by unqualified lookup
Linkstate/ls.h:137:note:use ' This,erase ' instead
Make: * * * [LINKSTATE/LS.O] Error 1
Ns make failed!
edit ns-2.35/linkstate/ls.h, i.e.
Gedit ns-2.35/linkstate/ls.h
The code for line 137 is determined by the
void Eraseall () {Erase (Basemap::begin (), Basemap::end ());}
Switch
void Eraseall () { this->erase (Basemap::begin (), Basemap::end ());}
It would be nice to replace erase with This->erase.
Execute again . The/install can be installed successfully.
Because everyone's computer is different, so the problem may be different, so we suggest that you have problems to use Google to check.
4. Configure Environment variables
If the installation succeeds, the terminal will prompt to configure environment variables, including PATH,Ld_library_path,tcl_library three environment variables.
re-open a terminal and enter:
sudo gedit. BASHRC
At the end of the file, add the following code:
Export path= $PATH:/home/xxx/ns-allinone-2.35/bin:/home/xxx/ns-allinone-2.35/tcl8.5.10/unix:/ home/xxx/ns-allinone-2.35/tk8.5.10/Unix
Export Ld_library_path= $LD _library_path:/home/xxx/ns-allinone-2.35/otcl-1.14:/home/xxx/ ns-allinone-2.35/lib
Export Tcl_library= $TCL _library:/home/xxx/ns-allinone-2.35/tcl8.5.10/library
Note the two environment variable paths are separated by a colon:
Then run:
source. BASHRC
The configuration of the environment variable is completed.
5. Verification of installation completion
re-open a terminal and enter:
Ns
If a% is present, it proves that NS2 has been installed successfully.
If the% does not appear , you can re-enter it at the terminal:
source. BASHRC
Ns
This time should be the perfect appearance of the %, prove that the ns2 should be installed.
6. Example Example
In Terminal input:
CD ns-allinone-2.35/ns-2.35/tcl/ex
NS EXAMPLE.TCL
If the data appears, it proves that NS2 is working properly.
Re-enter
NS SIMPLE.TCL
If the NAM Control window and the Help screen appear, the Nam installation is successful. Animated presentations can be made in the Nam Control window. Since then, the ns2.35 has beencompletely installed successfully.
Nam cannot start
Enter Nam directory:CD ns-allinone-2.35/nam-1.15
Enter after sudo./configure, and then sudo make
Last sudo make install
Command line input nam eject nam console instructions Nam installation succeeded.
Note: If nam is installed through the "sudo apt-get install Nam" , the Nam command will report an exception
"Segment error, core file has been dumped "
Users who encounter this problem can "sudo apt-get remove--purge nam" uninstall Nam and configure it to press STEP6 installation.
< Span lang= "en-US" > < Span lang= "en-US" > The TCP protocol packet and delay is displayed with Gnuplot, first install Gnuplot:sudo apt-get installs gnuplot-x11
< Span lang= "en-US" > < Span lang= "en-US" > then Gawk-f EXMPLE.TCL out.tr > PC (Install gawk command first)
< Span lang= "en-US" > < Span lang= "en-US" > terminal:
< Span lang= "en-US" > < Span lang= "en-US" >gnuplot
The plot ' PC ' with lines displays the interface.
Installation of NS-2.35 under ubuntu16.04 and understanding of simple examples