New year.. new semester.. and new subjects too. In this semester I joined the CBNS (Computer Based Network Simulation) course and luckily it’s use the NS2 Network Simulator that run on Linux environment. I’ve managed to install it on my Slacky 13.0 and I want to share my “Trial & Error”. To put all things simple, I use the ns-allinone version, although there are individual package also , It’ll produce error when compiled on new Linux distribution, since some library are too old.
Ok, lets start it..
Grab the ns-allinone package
bowo@pcxslack:~$ wget http://downloads.sourceforge.net/project/nsnam/allinone/ns-allinone-2.34/ns-allinone-2.34.tar.gz?use_mirror=nchc
Extract downloaded copy of ns-allinone
bowo@pcxslack:~$ mkdir build; cd build; tar -xzf ../ns-allinone-2.34.tar.gz bowo@pcxslack:~/build$ ls cloudcity/ kde4-windeco-nitrogen-3.3.2-Source/ ns-allinone-2.34/ bowo@pcxslack:~/build$ cd ns-allinone-2.34/
Build
To build it, just run install script that provided in the package. It’ll need C compiler. In most of new Linux distribution, GNU C Compiler aka. gcc is included.
bowo@pcxslack:~/build/ns-allinone-2.34$ ls -l total 100 -rw-r--r-- 1 bowo users 660 2009-06-15 00:35 INSTALL.WIN32 -rw-r--r-- 1 bowo users 2070 2009-06-15 00:35 README drwxr-xr-x 2 bowo users 4096 2010-02-05 20:04 bin/ drwxr--r-x 3 bowo users 4096 2010-02-05 19:48 cweb/ drwxr-xr-x 5 bowo users 4096 2010-02-05 20:03 dei80211mr-1.1.4/ drwxr-xr-x 9 bowo users 4096 2009-06-15 00:35 gt-itm/ drwxr-xr-x 2 bowo users 4096 2010-02-05 19:51 include/ -rwxr-xr-x 1 bowo users 25175 2009-06-15 00:35 install* drwxr-xr-x 4 bowo users 4096 2010-02-05 20:04 lib/ drwxr-xr-x 12 bowo users 4096 2010-02-05 20:02 nam-1.14/ drwxr-xr-x 63 bowo users 4096 2010-02-08 13:39 ns-2.34/ lrwxrwxrwx 1 bowo users 9 2010-02-05 20:02 otcl -> otcl-1.13/ drwxr-xr-x 7 bowo users 4096 2010-02-05 19:52 otcl-1.13/ drwxr-xr-x 2 bowo users 4096 2010-02-05 19:48 sgb/ drwxr-xr-x 4 bowo users 4096 2010-02-05 20:04 share/ drwxr-xr-x 12 bowo users 4096 2009-06-15 00:35 tcl8.4.18/ lrwxrwxrwx 1 bowo users 10 2010-02-05 20:02 tclcl -> tclcl-1.19/ drwxr-xr-x 6 bowo users 4096 2010-02-05 19:52 tclcl-1.19/ drwxr-xr-x 13 bowo users 4096 2009-06-15 00:35 tk8.4.18/ drwxr-xr-x 4 bowo users 4096 2010-02-05 19:48 xgraph-12.1/ drwxr-xr-x 11 bowo users 4096 2010-02-05 19:48 zlib-1.2.3/ bowo@pcxslack:~/build/ns-allinone-2.34$ ./install
Build process will be started
Configuration
If build process is successful, we will this messages:
---------------------------------------------------------------------------------- Please put /home/bowo/build/ns-allinone-2.34/bin:/home/bowo/build/ns-allinone-2.34/tcl8.4.18/unix:/home/bowo/build/ns-allinone-2.34/tk8.4.18/unix into your PATH environment; so that you\'ll be able to run itm/tclsh/wish/xgraph. IMPORTANT NOTICES: (1) You MUST put /home/bowo/build/ns-allinone-2.34/otcl-1.13, /home/bowo/build/ns-allinone-2.34/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/bowo/build/ns-allinone-2.34/tcl8.4.18/library into your TCL_LIBRARY environmental variable. Otherwise ns/nam will complain during startup.After these steps, you can now run the ns validation suite with cd ns-2.34; ./validateFor 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.
Just follow what it said :^) edit
~/.bashrc
to add PATH environment.bowo@pcxslack:~/build/ns-allinone-2.34$ vim ~/.bashrc
Go to the end line of file and add the code like this:
export PATH="$PATH:/home/bowo/build/ns-allinone-2.34/bin:/home/bowo/build/ns-allinone-2.34/tcl8.4.18/unix:/home/bowo/build/ns-allinone-2.34/tk8.4.18/unix" export TCL_LIBRARY="/home/bowo/build/ns-allinone-2.34/tcl8.4.18/library"
Use super user (root) to add
LD_LIBRARY_PATH
environment variable by editing file/etc/ld.so.conf
. Add the two line of code at the line of file, my/etc/ld.so.conf
would be like this:bowo@pcxslack:~/build/ns-allinone-2.34$ sudo su Password: root@pcxslack:/home/bowo/build/ns-allinone-2.34# vim /etc/ld.so.conf ... /usr/local/lib /usr/i486-slackware-linux/lib /usr/lib/seamonkey /opt/kde3/lib /usr/lib/wvstreams /home/bowo/build/ns-allinone-2.34/otcl-1.13 /home/bowo/build/ns-allinone-2.34/lib
Reboot system to update all configuration. To test it, open konsole or xterm and run ns and or nam.
bowo@pcxslack:~$ ns % exit bowo@pcxslack:~$ nam