2017年8月18日 星期五

[Step by step] NS2 Installation on Ubuntu 16.04 (the most complete step!!!)

有鑑於網路上的教學文太老舊了
很多套件已經不存在
有一些內容也是多餘的
就讓我用最清楚的步驟
教你如何輕鬆完成NS2安裝
這次練習用英文寫教學文看看XD

This is my first time to write the document by English.
I am trying my best to describe each step clearly.
Let me know if you meet some problem on installation.
Enjoy!

Step1 : Run these 2 commands(執行以下兩個指令)
$ sudo apt-get update
$ sudo apt-get upgrade -y

Step2 : Download NS2-all-in-one from website(從這下載NS2-all-in-one軟體)
https://goo.gl/yi1eG7

Step3 : Modify the ls.h file in line 137(修改ls.h這個檔案的137行)
$ vim ~/ns-allinone-2.35/ns-2.35/linkstate/ls.h


change
void eraseAll() { erase(baseMap::begin(), baseMap::end()); }
to

void eraseAll() { this->erase(baseMap::begin(), baseMap::end()); }

Step4 : Install essential packages(安裝所需套件)
$ sudo apt-get install build-essential autoconf automake libxmu-dev libperl4-corelibs-perl

$ cd to ns-allione-2.35
$ ./install

If you see this picture, done!



Step5 : Add the following stuff to .bashrc(加點東西到.bashrc)
$ vim ~/.bashrc
 

# LD_LIBRARY_PATH
OTCL_LIB=/home/john/ns-allinone-2.35/otcl-1.14
NS2_LIB=/home/john/ns-allinone-2.35/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=/home/john/ns-allinone-2.35/tcl8.5.10/library
USR_LIB=/usr/lib
export TCL_LIBRARY=$TCL_LIB:$USR_LIB
# PATH
XGRAPH=/home/john/ns-allinone-2.35/bin:/home/john/ns-allinone-2.35/tcl8.5.10/unix:/home/john/ns-allinone-2.35/tk8.5.10/unix
#the above two lines beginning from xgraph and ending with unix should come on the same line
NS=/home/john/ns-allinone-2.35/ns-2.35/
NAM=/home/john/ns-allinone-2.35/nam-1.15/
PATH=$PATH:$XGRAPH:$NS:$NAM

NOTE:
"/home/john/ns-allinone-2.35/" is my NS2 folder's location,
you should change that to where it located.
("/home/john/ns-allinone-2.35/" 是我的NS2資料夾位置,請根據安裝位置自行切換資料夾位置)
 
Step6 : Verify the installation(驗證安裝完整性)
$ cd ns-2.35 
$ ./validate
 
(Just wait for a while...)(等他跑完就好)
 
After you see this message...(當你看到這個訊息)
"validate overall report: all tests passed"
 
Done!!!!!!!!!!
 
Thanks for your visiting.(謝謝觀看我的文章!)

沒有留言:

張貼留言