Вы находитесь на странице: 1из 5

NS-2 Installation Manual

Acknowledgments

Installation Process:

NS-2 installation is not an easy task, unless you follow the proper instructions. This manual will
help you in installing NS-2 easily. The procedures given in this manual are taken from different
websites and put together. This document contains installation instructions based on my personal
experience, starting from installation of Linux Fedora 11 till NS-2 complete installation.

See the links given at the end, and you will be able to grasp majority of the ideas from there. Infact,
I myself have taken the commands and procedures from these sites and managed to install NS-2.
Let us start with the installation process.

Step I

First step is to install Linux. In my case it is Fedora 11. Just go to the Fedora web site
(http://fedoraproject.org/en/get-fedora) and download iso image of Fedora 11. You can use the
conventional way of installing Linux on your machine.

Step II

It is not the installation which creates problems, but post installation procedures which have to be
kept in mind if you want to install NS-2 properly. See the following steps given below:

1. After Linux installation is successfully done, it is time to install NS-2. If you are a newbie
to this environment I would suggest to install ns-2 all in one package. I have done the same.
2. Download ns-allinone-2.34 from the ns-2 website
(http://www.isi.edu/nsnam/ns/ns-build.html#allinone).
3. Before installation you have to update your current version of Linux. In my case one very
common problem was unavailability of repositories. You have to have gcc and tcl/tk
already to install NS-2 because NS-2 has dependency on gcc and tcl/tk.
4. These two dependencies do not come with iso image and when you try updating your
repositories, it usually gives an error stated "Error:Cannot retrieve repository metadata
(repomd.xml) for repository: fedora. Please verify its path and try again"
5. How to resolve this issue? Simple do the following steps and you will start getting the
repositories:
5.1. You need to edit two of your repository files: (1) /etc/yum.repos.d/fedora.repo and
(2) /etc/yum.repos.d/fedora-updates.repo. While editing comment (put #) all the
lines that start with 'mirrorlist' and un-comment (delete #) all the lines that start
with 'baseurl'. Save both the files and close them.

Bilal A. Khan: bilal26@hotmail.co.uk Page 1


5.2. Once the step given above is successfully done now its turn to edit the file located
at /etc/hosts. Delete what ever is written in this file and replace both the lines with
the following:

80.239.156.215 mirrors.fedoraproject.org
213.129.242.84 mirrors.rpmfusion.org

5.3. Save the file named hosts and close it now.


5.4. First job done. You can now download the repositories successfully.

Step III

6. Its time to download and install the dependencies before we jump onto installation of NS-2.
7. For getting the dependencies we need to 'yum' a few dependencies. 'yum' is a very powerful
command which downloads and installs the dependencies from the repositories. You also
have to keep in mind that you have to be a power user (root user) to run these commands.
For coming into the power mode write 'su' in the terminal. It will ask you for the root
password. Put in the password and there you go... You are in root mode. Follow the series
of command given and let it get downloaded and installed. You will automatically
understand once you look at the terminal.
7.1. yum install autoconf
7.2. yum install automake
7.3. yum install gcc-c++
7.4. yum install libX11-devel
7.5. yum install xorg-x11-proto-devel
7.6. yum install libXt-devel
7.7. yum install libXmu-devel
8. This should be kept in mind that all these commands will take some time to complete their
course of action, so one has to be patient.
9. As NS-2 has already been downloaded, you have to untar it. Write the following command
to untar the file.
9.1. tar -xzf ns-allinone-2.34.tar.gz
9.2. cd ns-allinone-2.34.tar.gz
9.3. ./install
10. Sit back and relax, it will take a bit of a time to get NS-2 installed.
11. Once NS-2 is installed successfully, a message will be displayed on the terminal that NS-2
is installed successfully.
12. If you are excited that NS-2 is installed successfully, you are wrong. Its not over yet. You
yet have to register the variables in the environment. Reason for doing so is that it creates
the linkage to all the executables created by NS-2. tcl scripts usually call these executables.
Without setting the variable to their environment NS-2 will not work. Follow the following
instructions to register the variables to the environment:
12.1. Go to /etc folder from terminal and type:

Bilal A. Khan: bilal26@hotmail.co.uk Page 2


gedit ~/.bashrc

This will open the bashrc file and now you can edit in this file

12.2. Remember to replace user/local by your installation path like I have


mentioned in the lines below: At the end of the file, type the following (do not
forget to give your installation path):

# LD_LIBRARY_PATH

OTCL_LIB=/home/BilalAKhan/Desktop/ns-allinone-2.34/otcl-1.13

NS2_LIB=/home/BilalAKhan/Desktop/ns-allinone-2.34/lib

X11_LIB=/home/X11R6/lib

USR_LOCAL_LIB=/home/BilalAKhan/Desktop/local/lib

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$OTCL_LIB:
$NS2_LIB:$X11_LIB:$USR_LOCAL_LIB

# TCL_LIBRARY

TCL_LIB=/home/BilalAKhan/Desktop/ns-allinone-2.34/tcl8.4.18/library

USR_LIB=/home/lib

export TCL_LIBRARY=$TCL_LIB:$USR_LIB

# PATH

XGRAPH=/home/BilalAKhan/Desktop/ns-allinone-2.34/bin:/home/BilalAKhan/ns
-allinone-2.34/tcl8.4.18/unix:/home/BilalAKhan/Desktop/ns-allinone-2.34/tk8.4.1
8/unix

NS=/home/BilalAKhan/Desktop/ns-allinone-2.34/ns-2.34/

NAM=/home/BilalAKhan/Desktop/ns-allinone-2.34/nam-1.14/

PATH=$PATH:$XGRAPH:$NS:$NAM

Bilal A. Khan: bilal26@hotmail.co.uk Page 3


12.3. Once you have written the code above. Save the file and write the folowing
command on the terminal:

source ~/.bashrc

12.4. Once this step is done, try validating your installed NS-2 by writing
./validate on the terminal. It will take a long time till it completely validates the
system. With me it took approx 1.5 hours to validate.
13. Once the successful validation is done, NS-2 is ready to use. On the terminal type 'ns' and
a % sign will appear. If you see this sign, which means that NS-2 is ready to use. Go to the
tutorials given on the web and start using NS-2.

Reference and Bibliography


[1]
http://www.linuxforums.org/forum/linux-newbie/134588-ns2-installation-guide-fedora-7-a.html

[2] http://nsnam.isi.edu/nsnam/index.php/Downloading_and_installing_ns-2
[3] http://yonghoon.livejournal.com/4799.html
[4] http://www.fedoraguide.info/index.php?title=Main_Page#How_to_Upgrade_Fedora

Bilal A. Khan: bilal26@hotmail.co.uk Page 4


[5]
http://digitizor.com/2009/06/17/how-to-fix-the-cannot-retrieve-repository-metadata-repomd-xml
-error-in-fedora-11/
[6] http://lowfatlinux.com/linux-rpm-uninstall.html
[7]
http://www.linuxforums.org/forum/linux-newbie/64514-newbie-needs-help-ns2-software-installat
ion.html

Bilal A. Khan: bilal26@hotmail.co.uk Page 5

Вам также может понравиться