Installing ns2.31 on Ubuntu7.04

From Nsnam
Jump to: navigation, search

This page discusses how to install ns-allinone-2.34 on Ubuntu 9.04 (Jaunty Jackelope).

Contents

Download and install

First, we download the ns-2 all-in-one file [54.4 MB].

$ wget http://nchc.dl.sourceforge.net/sourceforge/nsnam/ns-allinone-2.34.tar.gz
$ tar -xzvf ns-allinone-2.34.tar.gz
$ cd ns-allinone-2.34
$ sudo apt-get install build-essential autoconf automake libxmu-dev
$ ./install

If your ubuntu version is 9.10, you must change the variable of environment CC

$ export CC=gcc-4.3


Set environment variables

$ gedit ~/.bashrc 

Add the following lines to the end of the file. Remember replace "/your/path" by the folder where you have stored extracted the ns-2 file (For example, if your Linux account name is purple, and you have extracted the file to your home directory, you have to change /your path to /home/purple)

# LD_LIBRARY_PATH
OTCL_LIB=/your/path/ns-allinone-2.34/otcl-1.13
NS2_LIB=/your/path/ns-allinone-2.34/lib
X11_LIB=/usr/X11R6/lib
USR_LOCAL_LIB=/usr/local/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$OTCL_LIB:$NS2_LIB:$X11_LIB:$USR_LOCAL_LIB

# TCL_LIBRARY
TCL_LIB=/your/path/ns-allinone-2.34/tcl8.4.18/library
USR_LIB=/usr/lib
export TCL_LIBRARY=$TCL_LIB:$USR_LIB

# PATH
XGRAPH=/your/path/ns-allinone-2.34/bin:/your/path/ns-allinone-2.34/tcl8.4.18/unix:/your/path/ns-allinone-2.34/tk8.4.18/unix
NS=/your/path/ns-allinone-2.34/ns-2.34/
NAM=/your/path/ns-allinone-2.34/nam-1.14/
PATH=$PATH:$XGRAPH:$NS:$NAM

Ensure that it immediately takes effect:

$ source ~/.bashrc

Note: the previous step is important; else you cannot successfully run ns-2.

(Alternatively, you may have to restart your X-windows, that is logout, and then login, or restart your computer.)

Now, the installation has been completed. Try:

$ ns

The "%" symbol appears on the screen. Type "exit" to quit.

Validation

To run the ns validation suite:

$ cd ns-2.34
$ ./validate

Next step?

You might need a good tutorial to move forward:

Marc Greis's tutorial

Possible error messages

If you typed "ns" and got the following:

The program 'ns' is currently not installed. You can install it by typing:
sudo apt-get install host  '''(DO NOT do this step)'''
Make sure you have the 'universe' component enabled
bash: ns: command not found

It probably means the environment variables have not been set correctly. Make sure the ~/.bashrc file has been edited correctly and that it has either been sourced as described above or that the system has been restarted.

---

This error also occurs when you are still working in the same Terminal. Open a new Terminal and type 'ns'

References

[1]Distribution Specific instructions

[2]NS-2.28Allinone_Howto

Personal tools