在Ubuntu18.04上安装OMNeT++5.4.1

OMNeT++ is an extensible, modular, component-based C++ simulation library and framework, primarily for building network simulators.

下载

先进入官网,点击download就能进入版本选择界面.

我下的是2018-06-29发布的OMNeT++ 5.4.1,是个248Mib的tgz格式的压缩包,也可以点击这里直接下载

下载好了以后解压到工作目录里,按照README里面写的,目录结构是这样:

omnetpp/         OMNeT++ root directory
  bin/           OMNeT++ executables (opp_run, nedtool, scavetool, etc.)
  include/       header files for simulation models
  lib/           library files
  images/        icons that can be used in network graphics
  doc/           simulation manual (PDF), readme, license, etc.
    manual/      Simulation Manual in HTML
    ide-customization-guide/ HTML version of IDE Customization Guide
    ide-developersguide/ HTML version of IDE Developers Guide
    api/         API reference in HTML
    nedxml-api/  API reference for the NEDXML library
    parsim-api/  API reference for the parallel simulation support
    tictoc-tutorial/  introduction into using OMNeT++
  src/           OMNeT++ sources
    sim/         simulation kernel
      parsim/    files for distributed execution
      netbuilder/files for dynamically reading NED files
    envir/       common code for runtime user interfaces
    cmdenv/      command-line runtime user interface
    tkenv/       Tcl/Tk-based graphical runtime user interface
    qtenv/       Qt-based graphical runtime user interface
    nedxml/      nedtool, message compiler, NED infrastructure
    layout/      graph layouting library
    scave/       library for processing result files
    eventlog/    library for processing event log files
    common/      common utility classes
    utils/       makefile generator and various utilities
  ide/           the OMNeT++ Integrated Development Environment
  misc/          various 3rd party contributions
  test/          regression test suite
    core/        regression test suite for the simulation library
    distrib/     regression test suite for built-in distributions
    ...
  tools/         3rd party tools and libraries bundled with OMNeT++
    win64/       on Windows, contains MSYS tools and the MinGW-W64 toolchain
    macosx/      on OS X, contains various 3rd party libraries (e.g. OSG, osgEarth, Qt)

Sample simulations are in the samples directory.

  samples/     directories for sample simulations
    aloha/     models the Aloha protocol
    cqn/       Closed Queueing Network
    ...

安装指南在./doc文件夹下能找到,Ubuntu的安装指南在Chapter5,我这里在Ubuntu18.04上进行安装.

安装依赖

  1. 更新软件列表 sudo apt-get update
  2. 安装依赖包(其实我的Ubuntu18.04里好像都有,但检查一遍也不亏)
      sudo apt-get install build-essential gcc g++ bison flex perl python python3 qt5-default libqt5opengl5-dev tcl-dev tk-dev libxml2-dev zlib1g-dev default-jre doxygen graphviz libwebkitgtk-1.0
    
  3. 如果需要仿真3D场景的话,还需要安装OpenSceneGraph (3.2+)和osgEarth(2.7+)
      sudo add-apt-repository ppa:ubuntugis/ppa
      sudo apt-get update
      sudo apt-get install openscenegraph-plugin-osgearth libosgearth-dev
    
  4. 然后在omnetpp的根目录下跑一下./configure检查一下依赖安好没有,跳出来个Warning提醒Akaroa没安,反正是optional的,我也就没安.

安装

先编译,在根目录下运行make,然后就可以等一会儿了.

运行

编译完以后,直接在终端里敲omnetpp就能打开那个IDE了,就像这样

omnetpp.png

IDE的执行文件会在./IDE/omnetpp,我这里把它加到bash里去:

  • cd到Desktop Entry文件目录去: cd /usr/share/applications
  • 新建并修改omnetpp的Entry: sudo atom omnetpp.desktop(没安atom的话也可以换成gedit,但我就是喜欢atom)
  • 把这一段复制进去(注意修改omnetpp的根目录,我的是在/home/x/root/omnetpp-5.4.1)
    [Desktop Entry]
    Name=OMNeT++
    Icon=/home/x/root/omnetpp-5.4.1/ide/ico.png
    Exec=/home/x/root/omnetpp-5.4.1/ide/omnetpp
    Type=Application
    Categories=Development
    
    

    我写的比较水,你也可以把comment之类的加上,然后在bash里它就出现了(虽然不知道为什么没有图标,也许重启一次就好了…)