Ubuntu24安装ns3 (Network Simulator 3) 最新版--new

如果部署期间有其他问题请到 这里

前奏

本次使用 4U/8G 的Ubuntu24

rambo@test1:~$ hostname
test1
rambo@test1:~$ hostname -I
172.16.186.151 

rambo@test1:~$ cat /etc/os-release 
PRETTY_NAME="Ubuntu 24.04 LTS"


rambo@test1:~$ cat /etc/apt/sources.list.d/ubuntu.sources
Types: deb
URIs: http://mirrors.tuna.tsinghua.edu.cn/ubuntu/
Suites: noble noble-updates noble-backports
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg

Types: deb
URIs: http://mirrors.aliyun.com/ubuntu/
Suites: noble-security
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg


rambo@test1:~$ sudo apt update -y

安装

# 安装依赖
rambo@test1:~$ sudo apt install -y g++ python3 cmake git \
gir1.2-goocanvas-2.0  gir1.2-gtk-3.0  \
python3-gi python3-gi-cairo  python3 python3-sphinx \
tcpdump wireshark \
sqlite3 libsqlite3-dev qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools \
openmpi-bin doxygen graphviz imagemagick \
imagemagick texlive-latex-extra texlive-font-utils \
libeigen3-dev gsl-bin libgsl-dev libgslcblas0 libxml2 libxml2-dev libgtk-3-dev \
lxc-utils bridge-utils \
libxml2 libxml2-dev libboost-all-dev ccache \
build-essential libalgorithm-merge-perl  lto-disabled-list





# 安装
rambo@test1:~$ wget https://www.nsnam.org/releases/ns-allinone-3.43.tar.bz2
rambo@test1:~$ tar -jxvf ns-allinone-3.43.tar.bz2
rambo@ub24-desktop:~$ cd ns-allinone-3.43/
rambo@ub24-desktop:~/ns-allinone-3.43$ time ./build.py --enable-examples --enable-tests
....
  ....
 =>  /usr/bin/python3 ns3 build
[0/2] Re-checking globbed directories...
[1946/1946] Linking CXX executable /home/rambo/ns-allinone-3.43/ns-3.43/build/utils/ns3.43-print-introspected-doxygen-default
Finished executing the following commands:
/usr/bin/cmake --build /home/rambo/ns-allinone-3.43/ns-3.43/cmake-cache -j 3
Leaving directory `/home/rambo/ns-allinone-3.43/./ns-3.43'

real	59m0.899s
user	155m13.115s
sys	14m55.442s




rambo@ub24-desktop:~/ns-allinone-3.43$ cd ns-3.43
rambo@ub24-desktop:~/ns-allinone-3.43/ns-3.43$ ./ns3 run first
[0/2] Re-checking globbed directories...
ninja: no work to do.
At time +2s client sent 1024 bytes to 10.1.1.2 port 9
At time +2.00369s server received 1024 bytes from 10.1.1.1 port 49153
At time +2.00369s server sent 1024 bytes to 10.1.1.1 port 49153
At time +2.00737s client received 1024 bytes from 10.1.1.2 port 9


rambo@ub24-desktop:~/ns-allinone-3.43/ns-3.43$ ./ns3 run second
[0/2] Re-checking globbed directories...
ninja: no work to do.
At time +2s client sent 1024 bytes to 10.1.2.4 port 9
At time +2.0118s server received 1024 bytes from 10.1.1.1 port 49153
At time +2.0118s server sent 1024 bytes to 10.1.1.1 port 49153
At time +2.02161s client received 1024 bytes from 10.1.2.4 port 9

rambo@ub24-desktop:~/ns-allinone-3.43/ns-3.43$ cd ..
rambo@ub24-desktop:~/ns-allinone-3.43$ cd netanim-3.109

# 打开网页版 (需要图形化)
rambo@ub24-desktop:~/ns-allinone-3.43/netanim-3.109$ ./NetAnim

====================================================================
# 设置终端类型
rambo@ub24-desktop:~/ns-allinone-3.43/netanim-3.109$ export TERM=xterm-256color

# 安装终端相关的支持库
rambo@ub24-desktop:~/ns-allinone-3.43/netanim-3.109$ sudo apt install -y ncurses-term

# 安装qt
rambo@ub24-desktop:~/ns-allinone-3.43/netanim-3.109$ sudo apt install -y gnuplot-x11 qt5-qmake qtbase5-dev qtchooser

# 在gnuplot中执行以下命令来检查支持的终端类型:
gnuplot> set terminal
Available terminal types:
            block  Pseudo-graphics using Unicode block or Braille characters
       cairolatex  LaTeX picture environment using graphicx package and Cairo backend
           canvas  HTML Canvas object
              cgm  Computer Graphics Metafile
          context  ConTeXt with MetaFun (for PDF documents)
          domterm  DomTerm terminal emulator with embedded SVG
           dpu414  Seiko DPU-414 thermal printer [small medium large]
             dumb  ascii art for anything that prints text
              dxf  dxf-file for AutoCad (default size 120x80)
              emf  Enhanced Metafile format
         epscairo  eps terminal based on cairo
         epslatex  LaTeX picture environment using graphicx package
     epson_180dpi  Epson LQ-style 180-dot per inch (24 pin) printers
      epson_60dpi  Epson-style 60-dot per inch printers
      epson_lx800  Epson LX-800, Star NL-10, NX-1000, PROPRINTER ...
              fig  FIG graphics language V3.2 for XFIG graphics editor
              gif  GIF images using libgd and TrueType fonts
           hp500c  HP DeskJet 500c, [75 100 150 300] [rle tiff]
             hpdj  HP DeskJet 500, [75 100 150 300]
             hpgl  HP7475 and relatives [number of pens] [eject]
           hpljii  HP Laserjet series II, [75 100 150 300]
Press return for more:  
             hppj  HP PaintJet and HP3630 [FNT5X9 FNT9X17 FNT13X25]
             jpeg  JPEG images using libgd and TrueType fonts
       kittycairo  kitty in-terminal graphics using cairo
          kittygd  kitty in-terminal graphics using libgd
              lua  Lua generic terminal driver
          nec_cp6  NEC printer CP6, Epson LQ-800 [monochrome color draft]
          okidata  OKIDATA 320/321 Standard
              pbm  Portable bitmap [small medium large] [monochrome gray color]
             pcl5  PCL5e/PCL5c printers using HP-GL/2
         pdfcairo  pdf terminal based on cairo
           pict2e  LaTeX2e picture environment
              png  PNG images using libgd and TrueType fonts
         pngcairo  png terminal based on cairo
       postscript  PostScript graphics, including EPSF embedded files (*.eps)
          pslatex  LaTeX picture environment with PostScript \specials
            pstex  plain TeX with PostScript \specials
         pstricks  LaTeX picture environment with PSTricks macros
          sixelgd  sixel using libgd and TrueType fonts
         sixeltek  Sixel output using bitmap graphics
            starc  Star Color Printer
              svg  W3C Scalable Vector Graphics
      tandy_60dpi  Tandy DMP-130 series 60-dot per inch graphics
Press return for more: 
          tek40xx  Tektronix 4010 and others; most TEK emulators
          tek410x  Tektronix 4106, 4107, 4109 and 420X terminals
          texdraw  LaTeX texdraw environment
             tikz  TeX TikZ graphics macros via the lua script driver
         tkcanvas  Tk canvas widget
          unknown  Unknown terminal type - not a plotting device
            vttek  VT-like tek40xx terminal emulator
             webp  single frame or animation using cairo, pango, and libwebp
            xterm  Xterm Tektronix 4014 Mode

====================================================================

# 测试
gnuplot-nox、gnuplot-qt、gnuplot-x11 这3个任意安装一个即可,不要全部安装,会有冲突

rambo@ub24-desktop:~$ sudo apt install -y gnuplot-nox

# 设置terminal
rambo@ub24-desktop:~$ gnuplot
gnuplot> plot x**2+2*x+1

posted @ 2025-01-13 17:47  Linux大魔王  阅读(631)  评论(0)    收藏  举报