I installed Ns2.35 using ns-allinone-2.35 based on ubuntu system. So here are the steps.
1. Download ns-allinone-2.35 from http://www.isi.edu/nsnam/ns/ns-build.html or http://mac.softpedia.com/progDownload/ns-2-Download-59777.html
2. Now you have to resolve some dependencies.
sudo apt-get install binutils gcc g++ make glibc Xlibs-dev libx11-dev libxmu-dev libxmu-headers
3. Place downloaded file in home directory and type tar -xzvf ns-allinone-2.35.tar.gz
chown -R ubuntu(your user name) ns-allinone-2.35
4.cd ns-allinone-2.35
5. Now sudo ./install
Error encountered by me:-
In file included from linkstate/ls.cc:67:0:
linkstate/ls.h: In instantiation of ‘void LsMap::eraseAll() [with Key = int; T = LsIdSeq]’:
linkstate/ls.cc:396:28: required from here
linkstate/ls.h:137:20: error: ‘erase’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
linkstate/ls.h:137:20: note: declarations in dependent base ‘std::map, std::allocator > >’ are not found by unqualified lookup
linkstate/ls.h:137:20: note: use ‘this->erase’ instead
make: *** [linkstate/ls.o] Error 1
Ns make failed!
Solution:
a. Go to ns-allinone-2.35/ns-2.35/linkstate/
b. Now edit ls.h
In line number 137, in place of void eraseAll() { erase(baseMap::begin(), baseMap::end()); }
make it void eraseAll() { this->erase(baseMap::begin(), baseMap::end()); }
c. Save the file and again run ./install
Ns-allinone package has been installed successfully.
Here are the installation places:
tcl8.5.10: /home/ubuntu/ns-allinone-2.35/{bin,include,lib}
tk8.5.10: /home/ubuntu/ns-allinone-2.35/{bin,include,lib}
otcl: /home/ubuntu/ns-allinone-2.35/otcl-1.14
tclcl: /home/ubuntu/ns-allinone-2.35/tclcl-1.20
ns: /home/ubuntu/ns-allinone-2.35/ns-2.35/ns
nam: /home/ubuntu/ns-allinone-2.35/nam-1.15/nam
xgraph: /home/ubuntu/ns-allinone-2.35/xgraph-12.2
gt-itm: /home/ubuntu/ns-allinone-2.35/itm, edriver, sgb2alt, sgb2ns, sgb2comns, sgb2hierns
----------------------------------------------------------------------------------
Please put /home/ubuntu/ns-allinone-2.35/bin:/home/ubuntu/ns-allinone-2.35/tcl8.5.10/unix:/home/ubuntu/ns-allinone-2.35/tk8.5.10/unix
into your PATH environment; so that you'll be able to run itm/tclsh/wish/xgraph.
IMPORTANT NOTICES:
(1) You MUST put /home/ubuntu/ns-allinone-2.35/otcl-1.14, /home/ubuntu/ns-allinone-2.35/lib,
into your LD_LIBRARY_PATH environment variable.
If it complains about X libraries, add path to your X libraries
into LD_LIBRARY_PATH.
If you are using csh, you can set it like:
setenv LD_LIBRARY_PATH <paths>
If you are using sh, you can set it like:
export LD_LIBRARY_PATH=<paths>
(2) You MUST put /home/ubuntu/ns-allinone-2.35/tcl8.5.10/library into your TCL_LIBRARY environmental
variable. Otherwise ns/nam will complain during startup.
6.
cd ~
sudo vim .bashrc
at the end line add :
export LD_LIBRARY_PATH=$PATH:/home/ubuntu/ns-allinone-2.35/otcl-1.14:/home/ubuntu/ns-allinone-2.35/lib
export TCL_LIBRARY=$PATH:/home/ubuntu/ns-allinone-2.35/tcl8.5.10/library
7.
After these steps, you can now run the ns validation suite with
cd ns-2.35; ./validate
For trouble shooting, please first read ns problems page
http://www.isi.edu/nsnam/ns/ns-problems.html. Also search the ns mailing list archive
for related posts.
8. sudo apt-get install gawk (for gawk) ,这个比较快,一分钟
9. sudo apt-get install gnuplot (for gnuplot) 这个5 分钟内可以完成
10. sudo vim /etc/environment
1. Download ns-allinone-2.35 from http://www.isi.edu/nsnam/ns/ns-build.html or http://mac.softpedia.com/progDownload/ns-2-Download-59777.html
2. Now you have to resolve some dependencies.
sudo apt-get install binutils gcc g++ make glibc Xlibs-dev libx11-dev libxmu-dev libxmu-headers
3. Place downloaded file in home directory and type tar -xzvf ns-allinone-2.35.tar.gz
chown -R ubuntu(your user name) ns-allinone-2.35
4.cd ns-allinone-2.35
5. Now sudo ./install
Error encountered by me:-
In file included from linkstate/ls.cc:67:0:
linkstate/ls.h: In instantiation of ‘void LsMap::eraseAll() [with Key = int; T = LsIdSeq]’:
linkstate/ls.cc:396:28: required from here
linkstate/ls.h:137:20: error: ‘erase’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
linkstate/ls.h:137:20: note: declarations in dependent base ‘std::map, std::allocator > >’ are not found by unqualified lookup
linkstate/ls.h:137:20: note: use ‘this->erase’ instead
make: *** [linkstate/ls.o] Error 1
Ns make failed!
Solution:
a. Go to ns-allinone-2.35/ns-2.35/linkstate/
b. Now edit ls.h
In line number 137, in place of void eraseAll() { erase(baseMap::begin(), baseMap::end()); }
make it void eraseAll() { this->erase(baseMap::begin(), baseMap::end()); }
c. Save the file and again run ./install
Ns-allinone package has been installed successfully.
Here are the installation places:
tcl8.5.10: /home/ubuntu/ns-allinone-2.35/{bin,include,lib}
tk8.5.10: /home/ubuntu/ns-allinone-2.35/{bin,include,lib}
otcl: /home/ubuntu/ns-allinone-2.35/otcl-1.14
tclcl: /home/ubuntu/ns-allinone-2.35/tclcl-1.20
ns: /home/ubuntu/ns-allinone-2.35/ns-2.35/ns
nam: /home/ubuntu/ns-allinone-2.35/nam-1.15/nam
xgraph: /home/ubuntu/ns-allinone-2.35/xgraph-12.2
gt-itm: /home/ubuntu/ns-allinone-2.35/itm, edriver, sgb2alt, sgb2ns, sgb2comns, sgb2hierns
----------------------------------------------------------------------------------
Please put /home/ubuntu/ns-allinone-2.35/bin:/home/ubuntu/ns-allinone-2.35/tcl8.5.10/unix:/home/ubuntu/ns-allinone-2.35/tk8.5.10/unix
into your PATH environment; so that you'll be able to run itm/tclsh/wish/xgraph.
IMPORTANT NOTICES:
(1) You MUST put /home/ubuntu/ns-allinone-2.35/otcl-1.14, /home/ubuntu/ns-allinone-2.35/lib,
into your LD_LIBRARY_PATH environment variable.
If it complains about X libraries, add path to your X libraries
into LD_LIBRARY_PATH.
If you are using csh, you can set it like:
setenv LD_LIBRARY_PATH <paths>
If you are using sh, you can set it like:
export LD_LIBRARY_PATH=<paths>
(2) You MUST put /home/ubuntu/ns-allinone-2.35/tcl8.5.10/library into your TCL_LIBRARY environmental
variable. Otherwise ns/nam will complain during startup.
6.
cd ~
sudo vim .bashrc
at the end line add :
export LD_LIBRARY_PATH=$PATH:/home/ubuntu/ns-allinone-2.35/otcl-1.14:/home/ubuntu/ns-allinone-2.35/lib
export TCL_LIBRARY=$PATH:/home/ubuntu/ns-allinone-2.35/tcl8.5.10/library
7.
After these steps, you can now run the ns validation suite with
cd ns-2.35; ./validate
For trouble shooting, please first read ns problems page
http://www.isi.edu/nsnam/ns/ns-problems.html. Also search the ns mailing list archive
for related posts.
8. sudo apt-get install gawk (for gawk) ,这个比较快,一分钟
9. sudo apt-get install gnuplot (for gnuplot) 这个5 分钟内可以完成
10. sudo vim /etc/environment
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/ubuntu/ns-allinone-2.35/ns-2.35"
source /etc/environment
or reboot your computer