According to this step, it will certainly be able to be installed, but when I encounter a problem when adding environment variables, running ns will prompt that ns2. if the problem persists, you can add environment variables, I wish you success. STEP ($ do not enter): 1. Open the terminal to install the necessary tools: $ sudoapt-getinstallbuild-essential (enter the password when prompted) $ sudoapt-getinstalltcl8.4tcl8.4-devt
According to this step, it will certainly be able to be installed, but when I encounter a problem when adding environment variables, running ns will prompt that ns2. if the problem persists, you can add environment variables, I wish you success.
STEP ($ do not enter ):
1. Open the terminal to install necessary tools:
$ Sudo apt-get install build-essential (enter the password when prompted)
$ Sudo apt-get install tcl8.4 tcl8.4-dev tk8.4 tk8.4-dev
$ Sduo apt-get install libxmu-dev libxmu-headers
2. $ sudo apt-cache search x11-dev displays the following command (to prevent installation interruption and exit in case of tk8.4.14)
Ibx11-dev-X11 client-side library (development headers)
Xlibs-dev-X Window System client library development files transitional package
Libghc6-x11-dev-Haskell X11 binding for GHC
Libooc-x11-dev-X11 specific les for the oo2c compiler (devel)
Libgl1-mesa-swx11-dev-A free implementation of the OpenGL API -- development support files
Install the above components separately. The command is as follows:
$ Sudo apt-get install libx11-dev
$ Sudo apt-get install xlibs-dev
$ Sudo apt-get install libghc6-x11-dev
$ Sudo apt-get install libooc-x11-dev)
3. Import and download the directory of the ns-allinone-2.34.tar.gz file. decompress:
$ Tar-xzvf ns-allinone-2.34.tar.gz
In this case, you can copy the folder to the directory you want to install (I installed it to/usr/local/NS2.) [Linux community www.Linuxidc.com] and enter the directory:
$ Sudo mv ns-allinone-2.34/usr/local/NS2.
$ Cd/usr/local/NS2./ns-allinone-2.34
Then modify the following two places (for untu9.04 and later versions ):
Enter the cd otcl-1.13, enter the otcl-1.13 directory, find configure. in. Change 77 rows, SHLIB_LD = "ld-shared" to SHLIB_LD = "gcc-shared"
Modify configure row 6,304th SHLIB_LD = "ld-shared" to SHLIB_LD = "gcc-shared"
4. Enter the installation process:
$ Cd .. (back to home ns-allinone-2.34)
$ Sudo./install (install)
5. Configure Environment Variables
Enter the/home/* user * directory (** indicates the user name, for example,/home/bluer), and then
$ Sudo gedit. bashrc
Add at the end of the file (remember to replace/usr/local/NS2 ):
PATH = "$ PATH:/usr/local/NS2./ns-allinone-2.34/bin:/usr/local/NS2./ns-allinone-2.34/tcl8.4.18/unix: /usr/local/int32/ns-allinone-2.34/tk8.4.18/unix"
LD_LIBRARY_PATH = "/usr/local/NS2./ns-allinone-2.34/otcl-1.13:/usr/local/NS2./ns-allinone-2.34/lib"
TCL_LIBRARY = "$ TCL_LIBRARY:/usr/local/int32/ns-allinone-2.34/tcl8.4.18/library"
Save and exit (the above content is prompted after installation, see the bold Section ).
Make environment variables take effect source. bashrc (omitted)
6. Verify NS2.
Enter terminal input cd/ns-allinone-2.34/ns-2.34
./Validate (it may take some time. Please wait. I have waited for about an hour ).
After the verification is completed, you will see the following information:
These messages are NOT errors and can be ignored:
Warning: using backward compatibility mode
This test is not implemented in backward compatibility mode
Validate overall report: all tests passed
7. Enter sudo apt-get install gawk (for gawk), which is faster, one minute
8. Enter sudo apt-get install gnuplot (for gnuplot), which can be completed within 5 minutes.
9. End
Enter ns in the terminal. If % is displayed, the installation is successful.
You can also run the built-in instance for testing: ns/ns-allinone-2.34/ns-2.34/tcl/ex/simple. tcl,
The nam simulation window is displayed.