Posts Tagged ‘Ubuntu 12.04’

Installing NS-3 in Ubuntu 12.04

September 11, 2012 47 comments

I like to write things down for myself. I am not working with NS-3 these days but if you have more questions, please  refer to the detailed installation guide from the NS website.

If you are reading this post, then I presume you already know what NS-3 is. I have followed the following steps to install and configure NS3 in Ubuntu 12.04.

Open a terminal and run the following commands to install the list of required packages (you may not need all the packages):

sudo apt-get install gcc g++ python              
sudo apt-get install gcc g++ python python-dev
sudo apt-get install mercurial
sudo apt-get install bzr
sudo apt-get install gdb valgrind
sudo apt-get install gsl-bin libgsl0-dev libgsl0ldbl
sudo apt-get install flex bison libfl-dev
sudo apt-get install g++-3.4 gcc-3.4
sudo apt-get install tcpdump
sudo apt-get install sqlite sqlite3 libsqlite3-dev
sudo apt-get install libxml2 libxml2-dev
sudo apt-get install libgtk2.0-0 libgtk2.0-dev
sudo apt-get install vtun lxc
sudo apt-get install uncrustify
sudo apt-get install doxygen graphviz imagemagick sudo apt-get install texlive texlive-extra-utils texlive-latex-extra
sudo apt-get install python-sphinx dia
sudo apt-get install python-pygraphviz python-kiwi python-pygoocanvas libgoocanvas-dev
sudo apt-get install libboost-signals-dev libboost-filesystem-dev
sudo apt-get install openmpi*

You can either download and build development version or get a tarball directly and untar it.  I would recommend you to choose the second option initially.

Option 1: Using Mercurial

mkdir repos
cd repos
hg clone

Option 2: Downloading NS-3 using a tarball

mkdir tarballs
cd tarballs wget
tar xjf ns-allinone-3.13.tar.bz2

To build your NS-3, run the following command:


Configuration with Waf:

./waf distclean
./waf configure    // (or use this > ./waf configure –enable-examples –enable-tests)
./waf build

Now, test your installation using:

./   // or use this ( if you want to test core modules only) > ./ -c core

Get ready to run your  program. You need waf (a python based framework designed for configuring, compiling and installing applications). Use the following command to run your program:

./waf – -run filename

Your program must be in /scratch directory, because when you run waf they are build at the same time. For example, I am copying a from a example directory to scratch directory to run the program. Go to your ns directory and run the command to copy, configure and run:

cp examples/tutorial/ scratch/
./waf –run scratch/myfirst

If you do everything correctly, you should be able to see the following in your command line.

Waf: Entering directory ‘/home/user/repos/ns-3-allinone/ns-3-dev/build’
Waf: Leaving directory ‘/home/userrepos/ns-3-allinone/ns-3-dev/build’
’build’ finished successfully (1.175s)
Sent 1024 bytes to
Received 1024 bytes from
Received 1024 bytes from

If you have something to visualize run the command : ./waf –run scratch/your_program –visualize, and to plot your output use: ./waf –run scratch/your_program | gnuplot

Cheers 🙂


How to use a guest OS installed on Windows 7 – VirtualBox to another VirtualBox – Ubuntu

If you bumped into this post somehow, that means you really really want to use a guest operating system installed on your host operating system (i.e. Windows 7) using VirtualBox to another installed VirtualBox on different host operating system (i.e Ubuntu).

The process involves the following steps:

  1. Run VirtualBox in windows 7
  2. Select File Menu, and click Export Appliances
  3. Choose your desired guest operating system that you want to use.
  4. click next to create a ovf  (Open Virtualization Format) of your guest os.
  5. Now, copy your guestos.ovf file to Ubuntu and run VirtualBox.
  6. Select File Menu, and click Import Appliances
  7. Select guestos.ovf file and click next.
  8. Boom ! You got it !

Cheers !

Install VirtualBox in Ubuntu 12.04

September 10, 2012 1 comment

Installing VirtualBox in Ubuntu 12.04 is very easy, and what you need to do is to run the following commands in your terminal.

Open your terminal, login as  root, and run the command below to update your system:

apt-get update

After that, run the following commands to add VirtualBox repository’s key and VirtualBox repository in Ubuntu:

wget -q -O- | sudo apt-key add –
sh -c ‘echo “deb precise contrib” >> /etc/apt/sources.list’

Now, you are ready to install VirtualBox in your system using the following command:

apt-get install virtualbox-4.1

Enjoy your installed VirtualBox to load and run Guest Operating System  in it’s own virtual environment.