2010년 7월 28일 수요일

Installation of Network Simulator NS2

OS : xubuntu 9.04
NS2 Ver. : ns-allinone-2.34

xubuntu에 ns2 설치 전 꼭 필요한 필수 패키지들이 있다.
다음과 같이 설치한다.

$ apt-get install gcc, g++, libc6-dev, tcl8.5, tk8.5, tcl8.5-dev, tk8.5-dev, libxmu-dev

이미 xubuntu 배포판 설치 시 설치되어 있는 경우도 있으므로 패스~ 
패키지 설치가 끝나면 ns2 설치를 위해 다음 링크에서 2.34 버전을 다운로드 받는다.

http://sourceforge.net/projects/nsnam/files/allinone/ns-allinone-2.34/

다운로드 받은 ns-allinone-2.34를 /opt 에 위치시키고 압축해제 한 후 해당 폴더에서 ./install 명령을 통해 설치를 한다.

$ tar –xvf ns-allinone-2.34.tar.gz
$ ./install

설치가 정상적으로 완료되면 다음과 같은 내용을 볼 수 있다.
------------------------------------------------------------------------------
Please put /opt/ns-allinone-2.34/bin:/opt/ns-allinone-2.34/tcl8.4.18/unix:/opt/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 /opt/ns-allinone-2.34/otcl-1.13, /opt/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 /opt/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; ./validate

For 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.
-------------------------------------------------------------------------------

설치가 완료되면 path를 설정한다. ~/.bashrc 파일을 열고 다음의 내용을 추가한다.

# LD_LIBRARY_PATH
OTCL_LIB=/opt/ns-allinone-2.34/otcl-1.13
NS2_LIB=/opt/ns-allinone-2.34/lib
X11_LIB=/usr/X11R6/
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=/opt/ns-allinone-2.34/tcl8.4.18/library
USR_LIB=/usr/lib
export TCL_LIBRARY=$TCL_LIB:$USR_LIB

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

저장한 후 설정된 내용을 적용시킨다.

$ source ~/.bashrc

마지막으로 실행은 다음과 같다.

$ ns
%

위와 같은 내용이 눈에 보인다면 성공이다... 종료는 exit 명령을 사용한다.

댓글 없음:

댓글 쓰기