The version I selected is the latest version 2.35 and the installation environment is Ubuntu14.04. 1. Download The ns2installation package. Here I select the allinone installation package in the ns-allinone-2.35.tar.gz compression format. The allinone installation package contains all the components, which is more convenient.
The version I selected is the latest version 2.35 and the installation environment is Ubuntu 14.04.
1. Download The ns2installation package. Here I select the all in one installation package in the ns-allinone-2.35.tar.gz compression format. The all in one installation package contains all the components, which is more convenient. Attachment:
http://www.isi.edu/nsnam/ns/ns-build.html
2. Configure the environment before installation. Enter the following code:
$sudo apt-get install build-essential$sudo apt-get install tcl8.4 tcl8.4-dev tk8.4 tk8.4-dev$sduo apt-get install libxmu-dev libxmu-headers
3. decompress and install NS2.
Copy ns-allinone-2.35.tar.gz to the home/xxx folder first. Xxx represents the NS2. Then enter the terminal and enter
tar -xzvf ns-allinone-2.31.tar.gzcd ns-allinone-2.31./install
If there is no accident, there must be various problems in this part. For example, my problems are:
linkstate/ls.h:137:58: note: declarations in dependent base ‘std::map
, std::allocator
>>’ are not found by unqualified lookuplinkstate/ls.h:137:58: note: use ‘this->erase’ insteadmake: *** [linkstate/ls.o] Error 1Ns make failed!
This is simple, as long as you edit the ns-2.35/linkstate/ls. h, that is
gedit ns-2.35/linkstate/ls.h
Change the 137th lines of code from
void eraseAll() { erase(baseMap::begin(), baseMap::end()); }
Change
void eraseAll() { this->erase(baseMap::begin(), baseMap::end()); }
That is, replace erase with this-> erase.
Run "./install" again to complete the installation.
Tips: because each person's machine has different environmental conditions and different errors, various problems may occur. It is recommended that you paste the bug code to google for search, which can be solved in general. The important thing is said three times:Be sure to use google! Be sure to use google! Be sure to use google!
4. Configure Environment Variables
If the installation is successful, the Environment prompts you to configure environment variables, including PATH, LD_LIBRARY_PATH, and TCL_LIBRARY.
Open a terminal and enter:
sudo gedit .bashrc
Add the following code at the end of the file:
Export PATH = $ PATH:/home/xxx/ns-allinone-2.31/bin:/home/xxx/ns-allinone-2.31/tcl8.4.14/unix: /home/xxx/ns-allinone-2.31/tk8.4.14/unixexport LD_LIBRARY_PATH = $ LD_LIBRARY_PATH:/home/xxx/ns-allinone-2.31/otcl-1.13:/home/xxx/ns-allinone-2.31/libexport TCL_LIBRARY = $ TCL_LIBRARY: /home/xxx/ns-allinone-2.31/tcl8.4.14/library
// Note that the paths of two environment variables must be separated by colons.
Then run:
source .bashrc
Environment variable configuration is completed.
5. Verification of installation completion
Open a terminal and enter:
ns
If % appears, it indicates that the NS2.
If % does not appear, enter the following again on the terminal:
source .bashrc
ns
At this time, % should appear perfectly, proving that NS2.
6. instance example
Enter at the terminal:
cd ns-allinone-2.31/ns-2.31/tcl/exns example.tcl
If data appears, it indicates that the NS2.
Enter
ns simple.tcl
If the nam control window and help screen appear, the nam installation is successful. You can perform an animation demonstration in the nam control window. Since then, ns2.35 has been fully installed.
Ubuntu 13.04 install ns2.35 http://www.linuxidc.com/Linux/2014-03/98266.htm
For more information about Ubuntu, see Ubuntu special page http://www.linuxidc.com/topicnews.aspx? Tid = 2
This article permanently updates the link address: Http://www.linuxidc.com/Linux/2016-03/128820.htm