You are on page 1of 12

From Nguyn nh Vit + Student Groups

1/3

MT VI HNG DN V LINUX V CI T NS
I. Linux
Lm cho mi NSD c th s dng c a mm v CD-ROM: B sung thm cc dng sau y vo file /etc/fstab (mt s phin bn Linux t ng thc hin vic ny) - /dev/cdrom /mnt/cdrom iso9660 ro, user, noauto 0 0 - /dev/fd0 /mnt/floppy vfat, user, noauto 0 0 Sau (sau khi restart hoc logout + login) thc hin: - mount /mnt/floppy - mount /mnt/cdrom 1. S dng c a USB (Flash Drive, USB Drive v.v.): - Phi chuyn account thnh superuser (nh lnh su, ri vo mt khu ca superuser) - To 01 th mc nh x ni dung a USB: /mnt/usb-disk - Khi cm USB vo, nu cn truy cp: mount /dev/sda1 /mnt/usb-disk, sau c th truy cp n ti th mc /mnt/usb-disk - Trc khi rt usb-disk ra, cn thc hin lnh: umount /mnt/usb-disk 2. truy cp c Windows Partition t Linux: - y l trng hp ci t 2 h iu hnh (Dual Boot), t mi trng Linux chng ta mun truy cp h thng file ca Windows. Kh nng truy cp ny rt thun tin trong trng hp chng ta mun chuyn cc kt qu m phng sang mi trng Windows x l bng cc cng c phn mm quen thuc. - Khi ci Windows phi chn FAT32 ch khng chn NTFS (c th c mt s bn Linux khng i hi phi nht thit lm nh vy). - To 1 th mc nh x ni dung Partition ca Windows ( a logic C: ci Windows): /mnt/windows - B sung thm cc dng sau y vo file /etc/fstab: /dev/hda1 /mnt/windows auto

II. Ci t trong mi trng Linux: NS & Tracegraph @ gnuplot


1. Cc bc ci t NS trn Linux 1. Copy file ns-allinone-2.29_tar.gz vo th mc ca mnh (th d username) hoc th mc /usr/local/share (trng hp ny phi login l root, nhm ci ns, tracegraph, mgl cho mi user dng chung). 2. Thc hin gii nn: tar zxf ns-allinone-2.29_tar.gz. Tar chy vi pht, to h thng cy th mc cho NS. 3. nh dng lnh sau: . ./usr/local/share/ns-allinone-2.29/install (hoc c th chuyn vo th mc ri nh lnh: . ./install). Ch : sau du chm . c du cch (space). Qu trnh ci t NS thng cn t 15 pht n 30 pht hoc lu hn, tu tc tng my. Trn mn hnh c cc thng bo ca chng trnh install (c vi ln hi, c tr li y l xong). 4. Vic ci t thnh cng hay tht bi c c ngay trn mn hnh. Nu thnh cng s thy th mc ns-allinone-2.29/ns-2.29/bin; bn trong c file kh thi ns, nam v nhiu file kh thi khc. Cn phi t ng dn n th mc nu trn, thc hin nh hng dn II.4 di y.

From Nguyn nh Vit + Student Groups

2/3

2. Cc bi ci t Tracegraph v th vin Matlab m Tracegraph cn: 5. Copy cc file: 1/. tracegraph202linux.tar.gz, 2/ mglinstaller.gz vo th mc lm vic; nn copy v ci t cc chng trnh ny ti th mc: /usr/local/share. 6. Gii nn tracegraph202linux.tar.gz (ch cn gii nn v t ng dn): tar zxf tracegraph202linux.tar.gz 7. Gii nn, ci t th vin Matlab cho tracegraph v t ng dn ( tracegraph tm c): gunzip [ -d ] mglinstaller Ci t: nh dng lnh mglinstaller; khi c hi v th mc cha th vin, nn nh vo mgl 3. Ci t b sung chng trnh v th gnuplot - Gnuplot c trong b chng trnh ng dng ca hu ht cc phin bn Linux: Nu du nhc nh gnuplot n chy lun th khi phi lm g, dng c lun; nu khng: 8. Chn menu: System Setting -> Add/Remove Applications -> chuyn n menu con Scientific ... s thy mc chn l gnuplot, Tick chn, sau s c yu cu a CDROM tng ng vo . 4. B sung thm ng dn ti th mc hin thi cha cc file kh thi ns, nam, xgraph, trgraph v a thm vo bin mi trng ng dn n th mc cha th vin ca Matlab (tracgraph cn n): Th d user viet cn edit li file /home/viet/.bashrc (hoc .bash_profile): - C mt dng: PATH=$PATH:$HOME/BIN - Cn b sung cc dng sau: + PATH=$PATH:$HOME/BIN:./ + PATH=$PATH:/usr/local/share/ns-nsallinone-2.29/bin + PATH=$PATH:/usr/local/share/tracegraph202 + export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/share/mgl/bin/glnx86

III. Ci t trong mi trng Windows: NS & Tracegraph @ gnuplot


1. Nhng file cn download v: 9. ns.exe, nam.exe: y l cc file kh thi chy c ngay trong mi trng Windows. 10. mglinstaller.exe, tcl832.exe (cc s ch phin bn, nh 832, c th khc nhau ty theo vic n c vit cho phin bn ns no): y l cc file nn s bung ra khi chy ci t th vin cho Matlab (mglinstaller) v b thng dch ngn ng tcl (tcl832.exe)... 11. gp41-July18_2006-winbin.zip: y l file nn cha chng trnh v th gnuplot (khng thuc d n Vint). Nu khng dng gnuplot th khng cn n n (ns v nam khng quan h g vi gnuplot c). 12. tracegraph202windows.zip (tn c th thay i i cht). 2. To th mc lm vic: 13. Nn to mt th mc (folder) ring trn a cng ci NS, NAM, Tracegraph v gnuplot. Th d: E:\NS\NS4Windows. 14. Copy tt c cc (5) file nu trn vo th mc ny. 3. Ci t tcl ns v nam c th lm vic (chy c): - Vi ns.exe v nam.exe, cn ci t tcl c th s dng c. Cho chy tcl832.exe (nh tn nu chuyn sang ch command line nh trong DOS, hoc kch p vo biu tng ca n

From Nguyn nh Vit + Student Groups

3/3

ging nh vic chy cc chng trnh khc trong Windows). Chng trnh ci t ny (tcl832.exe) s hi chng mun ci vo th mc no, nn chn th mc nh trnh by trn \NS\NS4Windows (dng browse tm v chn th mc). Sau khi ci tcl, chng ta s thy xut hin th mc Tcl. By gi c th chy ns v nam; tuy nhin c th gi thc hin chng mi ni, cn phi t ng dn n th mc lm vic m chng ta to ra (trnh by di y). Nu mun th xem ns chy c cha, c th chuyn sang ch command line (MS DOS mode), vo th mc cha ns, nh ns (Enter), nu thy k t %, tc l ns chy. Nu mun ra khi ns, nh CTRL_C.

3. Ci t phn mm Tracegraph v th vin Matlab Tracegraph c th lm vic (chy c): - Cho chy mglinstaller.exe, chng trnh ci t ny s hi chng mun ci vo th mc no, ng thi hin sn th mc Default chnh l th mc ang cha mglinstaller (nn nh Enter chn chnh th mc ny). - Sau khi chy xong, chng ta s thy xut hin 2 th mc con mi: bin v toolbox. - Gii nn Tracegraph202-windws.zip ti th mc lm vic ca chng ta. 4. t ng dn ti th mc cha cc file kh thi ns, nam, trgraph v gnuplot: - Vo Control Panel System Advanced Environment Variable System variables kch vo dng c ch Path .... Edit B sung vo cui danh sch cc ng dn, cc ng dn n th mc cha cc file kh thi m chng ta s s dng v th vin Matlab cho Trace graph, nh sau: E:\NS\NS4Windows;E:\NS\NS4Windows\Tcl\bin;E:\NS\NS4Windows\tracegraph202;E:\NS\ NS4Windows\bin\win32;E:\NS\NS4Windows\gnuplot\binaries - Sau khi nhp xong cc ng dn b sung, ln lt chn cc button OK cho n khi ra n Control Panel. - cc ng dn mi b sung c hiu lc, khng nht thit phi khi ng li (Restart) my, ch cn logout ri li login l c. Cc bn sinh vin v HVCH ch : 1. Nu bn no bit v thy cn b sung thm cc bc no , mt sinh vin lnh mi t te c th thc hin d dng; hy vit b sung v gi cho thy Vit (bng giy hoc email). 2. Ai c sng kin g, hy thng bo rng ri cho mi ngi cng bit.

From Nguyn nh Vit + Student Groups

4/3

HOW TO: Install Network Simulator 2 & Network animator (NSnam) on Ubuntu Hardy
August 29th, 2008 28 Comments So Ive been given a Final Year Project that deals with vehicular communication on a VANET (Vehicle Ad-hoc Network). It involves hardware implementation of an embedded system modules to a cars CAN-BUS so as to communicate with the cars ECUs and between cars themselves. If everything goes well, this would probably be implemented in luxury cars such as Audis & BMWs (were testing using the AUDI cars) - or maybe not. Anyway, to cut the long story short, opensource is the way to go and thus, I needed free softwares to simulate changing network topology and routing algorithms. After a few considerations, NS2/Nam is my prefered choice. Installing it in Fedora 9 seems to be a breeze but Ubuntu has its setbacks. However, it is not difficult to overcome. First, you have to download the NS2 allinone installation file from here and untar the compressed file (Im using release ns2-2.33). Common to Ubuntu distribution, the OS is lack of developer tools like compilers and stuffs. Thus, make sure you already have installed your build essentials. If you havent, sudo apt-get install build-essential Next, youll need some dependencies which will allow the installation process to be successful. Else, youll probably get a make: *** [tk3d.o] Error 1 tk8.4.14 make failed! error. sudo apt-get install autoconf automake libxmu-dev After installation is successful, its time to install the NS2/Nam program cd ns-allinone-2.33 ./install The installation process will take several minutes (depending on your machines processing power) with lots of installation verbose on your terminal. When the installation has ended, it will tell the user that installation is successful. Next, youll need to change some Environment values in order to make your program work correctly. sudo gedit ~/.bashrc Add these lines to your bashrc file. Replace your directory with the installation directory of your ns2 program. #environment values for NS2/NAM # LD_LIBRARY_PATH OTCL_LIB=/your directory/ns-allinone-2.33/otcl-1.13 NS2_LIB=/your directory/ns-allinone-2.33/lib

From Nguyn nh Vit + Student Groups

5/3

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 directory/tcl8.4.18/library USR_LIB=/usr/lib export TCL_LIBRARY=$TCL_LIB:$USR_LIB # PATH XGRAPH=/your directory/ns-allinone-2.33/bin:/your 2.33/tcl8.4.18/unix:/your directory/ns-allinone-2.33/tk8.4.18/unix NS=/your directory/ns-allinone-2.33/ns-2.33/ NAM=/your directory/ns-allinone-2.33/nam-1.13/ PATH=$PATH:$XGRAPH:$NS:$NAM Then type, source ~/.bashrc Next, you would want to validate the installation process. Go to the library and, cd ns-2.33 ./validate This will take a much longer time than the first installation command (./install). After installation, a validation confirmation validate overall report: all tests passed will be shown. To use ns2 simulator, just type, $> ns Hope this help for those who are planning to use the NS-2.

directory/ns-allinone-

Tags: HOW TO guides 28 responses so far 1 allison // Sep 12, 2008 at 9:11 pm Excellent advice. One typo Ill clarify for the NBs; The following line: source ~./bashrc

From Nguyn nh Vit + Student Groups

6/3

should actually be: source ~/.bashrc (bashrc is a hidden file) 2 firdooze // Sep 26, 2008 at 10:59 am Thanks for pointing out the mistake. Fixed it! =) 3 Craft // Oct 23, 2008 at 2:33 pm Hi, I also tried to install ns-allinone on ArchLinux. Ive followed your tips, but I have a little problem with nam. Can you use your nam ? Mines showing this error: [code omitted because of length] : no event type or button # or keysym while executing bind Listbox { %W yview scroll [expr {- (%D / 120) * 4}] units } invoked from within if {[tk windowingsystem] eq classic || [tk windowingsystem] eq aqua} { bind Listbox { %W yview scroll [expr {- (%D)}] units } bind Li 4 Sandilya // Oct 24, 2008 at 1:58 pm Hey , I really owe u guysI was stuck at some point when i was installing NS2 on my Ubuntu OS. There was some problem with the nam binary. But I figured out a lot after reading your instructions. I have read through a lot of instructions but i felt urs were the best and simplest for people who havent dealt with NS2 earlier.Thanx a million and God bless. Thanx again.Cherio. Best Regards, Sandilya. 5 Sully // Nov 11, 2008 at 1:45 am Works great for me on Hardy. Thanks!

From Nguyn nh Vit + Student Groups

7/3

6 sujay // Nov 11, 2008 at 1:06 pm thank you, u saved me a days work 7 rajeswaran // Nov 14, 2008 at 4:02 pm i installed opensusue 10.2 i want to install and work NS2 for VANET. please send the procedure to my mailid 8 moad // Nov 16, 2008 at 8:34 am Its good thanks for help 9 Ashwath // Nov 20, 2008 at 3:09 pm Was very helpful, will recommend to my friends too! Thanks. 10 firdooze // Dec 3, 2008 at 4:37 pm Hey guys, no problem man. I am glad to help! Just that Im kinda busy with school work (mainly working on some VANET routing protocol), thus I may take sometime to reply back. Sorry bout that. @Craft: My NAM works fine. Did your validation process went without error messages? Worsecase would be to change to another distro. Ive tried it on Ubuntu and Fedora with 100% success. @Rajeswaran: The installation process should be similar. 11 Ufuk // Dec 30, 2008 at 4:56 pm NAM=/your directory/FYP/ns-allinone-2.33/nam-1.13/ FYP ??? what does it mean? is it ur dirs name? thnx in advance 12 firdooze // Jan 15, 2009 at 1:20 pm oh sorry, ignore the FYP. It was part of my directory. heeh.. 13 arun // Jan 19, 2009 at 6:13 pm

From Nguyn nh Vit + Student Groups

8/3

hey.. i followed the steps you have said for nstalling ns2 on ubuntu. But after everything is finished, when I type ns nothing happens. I dont get any % symbol please help! P.S. I use ubuntu on virtualbox software. 14 firdooze // Jan 20, 2009 at 2:01 am arun > I am guessing that you might have forgotten to edit and use the bashrc file. 15 blorent // Feb 4, 2009 at 11:40 pm Hi, I have the same issue as Craft, running Arch Linux too. I suspect this is caused by a wrong X11_LIB (/usr/X11R6/lib doesnt exist on Arch) I tried several other possibilities but no success se far If anyone can help 16 tomy // Feb 25, 2009 at 1:55 am good evening, first thank you for your effort, i have some problem with the instruction ./validate, its return me: validate overall report: some portable tests failed: ./test-all-red to re-run a specific test, cd tcl/test; ./test-all-TEST-NAME any idea how to procede? thank you very much ^^ 17 2009_Beginner // Feb 27, 2009 at 9:06 pm Hello ! I hope you can help me with this problem. I was trying to do some mobile ad hoc simulations but now I have a problem. After starting the simulation I cannot see it in NAM. It gives error like this: invalid command name n while executing n -t * -s 0 -x 0 -y 0 -Z 0 -z 100 -v circle -c black (file mobile100.nam line 1)

From Nguyn nh Vit + Student Groups

9/3

I am using NAM version 1.13, for ns2.32 on Linux (Fedora 8 and kernel 2.6). I have installed it as allinone version. If you have experience with this kind of problems please help. Thank you in advance! 18 firdooze // Feb 28, 2009 at 1:11 am @Beginner: Maybe you could try running the nam file on command line rather than automatically after the ns2 simulation. If it was generated successfully by NS2, I dont see why there would be an error. @tomy: Do check your installation output file and try run the specific test name as instructed by the installer. @Blorrent: Just wondering whether are your running a x64 machine? Because I had some similar problem with X11 files on an 64bit server running in a cluster. I had to chance the ./configure files to include the 64 environment library in the x11 line. (/usr/X11/lib64) 19 nicko // Mar 1, 2009 at 11:53 pm great! it works thanks to your explanations 20 Rajeswaran // Mar 3, 2009 at 1:15 pm Need help to install and run ns2 step by step procedure on opensuse 10.2 21 sean // Mar 13, 2009 at 7:28 pm Ive the same problem as craft. When I try to run nam I get: $ nam: [code omitted because of length] : no event type or button # or keysym while executing bind Listbox { %W yview scroll [expr {- (%D / 120) * 4}] units } invoked from within if {[tk windowingsystem] eq classic || [tk windowingsystem] eq aqua} { bind Listbox {

From Nguyn nh Vit + Student Groups

10/3

%W yview scroll [expr {- (%D)}] units } bind Li Any Ideas? 22 30fillos // Mar 16, 2009 at 8:39 am thx for me work exelent 23 sachin // Mar 17, 2009 at 6:29 am Me too have same problem like sean and craft 24 firdooze // Mar 20, 2009 at 10:02 pm You guys installed the all-inone version right? Did the validate process throw up any errors? 25 lyat // Mar 24, 2009 at 9:34 pm I found a solution here : http://forums.fedoraforum.org/showthread.php?t=206795 and it works for me. Im running ns on archlinux 26 lyat // Mar 24, 2009 at 10:24 pm little precision when I execute ./validate some tests failed but ns works well enjoy! 27 Lynn Hsan // Apr 8, 2009 at 8:00 am Hi, ive already install NS simulator what you said above and wrote tcl file. i want to know is where do i put my tcl file under ns directory..when i run ns i got error messages as follows: hanlinnhsan@hanlinnhsan-laptop:~/Desktop/ns-allinone-2.33$ ls bin include nam-1.13 README tclcl zlib-1.2.3 cweb install ns-2.33 sgb tclcl-1.19 dei80211mr-1.1.4 INSTALL.WIN32 otcl share tk8.4.18 gt-itm lib otcl-1.13 tcl8.4.18 xgraph-12.1

From Nguyn nh Vit + Student Groups

11/3

hanlinnhsan@hanlinnhsan-laptop:~/Desktop/ns-allinone-2.33$ ns run couldnt read file run: no such file or directory 28 I. A. Musbah // Apr 15, 2009 at 11:33 pm Hi guys ,,, I am working on ns2.29.2 based on Cygwin, I have problem with NAM it dose not work with it gives me code omitted because of length no event type or button or keysym while executing bind Listbox { %W yview scroll [expr {- (%D / 120) * 4}] units ..... please anyone have faced this problem help me . thanks

OK I have solved the problem. First go to the link below and download both the patches. I uesed only one and it workrd. Then extract the ns-allinone-2.33 archive and copy the patches in tk8.4.18 directory. http://bugs.gentoo.org/show_bug.cgi?id=225999 The command session is below. [badar@linux ~]$ cd ns-allinone-2.33/tk8.4.18/ [badar@linux tk8.4.18]$ ls bitmaps compat library macosx tk-8.4.18-tkBind.patch win ChangeLog doc license.terms README tk-8.4-lastevent.patch xlib changes generic mac tests unix [badar@linux tk8.4.18]$ patch -p1 < ./tk-8.4 tk-8.4.18-tkBind.patch tk-8.4-lastevent.patch [badar@linux tk8.4.18]$ patch -p1 < ./tk-8.4-lastevent.patch can't find file to patch at input line 3 Perhaps you used the wrong -p or --strip option? The text leading up to this was: -------------------------|--- generic/tk.h.orig 2008-02-06 16:31:40.000000000 +0100 |+++ generic/tk.h 2008-07-24 08:21:46.000000000 +0200 --------------------------

From Nguyn nh Vit + Student Groups

12/3

File to patch: generic/tk.h patching file generic/tk.h [badar@linux tk8.4.18]$ cd .. [badar@linux ns-allinone-2.33]$ ./install I used patch for the first time and could not figure out exact option. So you have to manually enter generic/tk.h above. Anyone to give correct patch options.

You might also like