Install OMNeT++
OMNeT++ is an extensible, modular, component-based C++ simulation library and framework, primarily for building network simulators. This article provides detailed instructions of how to install OMNeT++ on Windows, WSL, macOS, Linux.
You can download the latest OMNeT++ 6.0.1 through the following links.
Configure
Extract the installation files and ensure that the target path contains only letters and underscores. Avoid using characters such as @ ? # $ & ( ) \ | : ; ‘ ’ “ ” < >, and it is preferable to avoid spaces and tabs. The default target path for extraction should be the final storage location for the program. Once the compilation and deployment are completed, it is recommended not to move the program. Otherwise, additional settings or reconfiguration and recompilation may be required.
The file “configure.user” in the extracted files contains all the user-selectable configurations. Unless you have specific requirements, it is recommended to keep the defaults. Below is all the configurations in “configure.user,” along with some additional explanations.
|
|
Compile and Install
Windows
After extracting the files, open “omnetpp-6.0/mingwenv.cmd”. Upon running it for the first time, it will automatically extract and install the MinGW environment (without conflicting with any existing MinGW installations). Once the installation is complete, a new command prompt window will open automatically.
Since the Windows installation package already includes all the necessary dependencies, there is no need to install any additional packages. Simply follow the prompts and enter the ./configure
command, which will automatically generate the Makefile based on your current user configuration. Once the Makefile is generated, you can proceed with the compilation by entering make
as instructed. The compilation process may take some time.
You can set the -j
parameter of make
, which determines the number of parallel compilation tasks allowed to execute simultaneously. This allows for more efficient utilization of CPU resources and faster compilation. For example, you can use make -j8
to allow a maximum of 8 compilation tasks to run simultaneously. You can set it to the number of CPU cores or supported threads, or use make -j$(nproc)
to compile with the maximum number of processes allowed.
After compiling OMNeT++ 6.0, two shortcuts will be generated in the OMNeT++ folder. One shortcut is used to launch the IDE, and the other is used to launch the terminal. You can copy these shortcuts to your desktop for quick access to OMNeT++.
Windows Subsystem for Linux (WSL)
The execution speed of OMNeT++ on Linux is significantly faster than on Windows. If you want to use a Linux development environment on Windows, WSL (Windows Subsystem for Linux) is a good choice. In this section, a brief introduction to the configuration of WSLis provided. After completing the installation and configuration of WSL, you can follow the instructions in the Installation of OMNeT++ on Linux guide to install OMNeT++.
-
It is highly recommended to install OMNeT++ within WSL2. However, this has certain requirements for the Windows version. Your Windows version should be newer than Windows 10 version 2004 (build 19041). You can check your Windows version by pressing the Windows + R, typing “winver”, and running the command to view the Windows version.
-
Not all versions of WSL support GUI applications. If your Windows version is newer than Windows 11 (build 22000.*) or Windows 11 Insider Preview (builds 21362+), installing WSL2 will automatically install WSLg, which allows you to run GUI applications directly. If you are a Windows 10 user and unable to install WSLg, you will need to set up an X-Window Server on your Windows system to display GUI applications.
-
Currently, WSL’s support for GUI applications is not yet fully mature. There may be some bugs when running OMNeT++ in WSL, such as issues with 3D model rendering. However, it should be sufficient for most use cases and requirements.
WSL Setup
It is recommended to use Windows Terminal and PowerShell 7 as your toolkit. You can install Windows Terminal by searching for it in the Microsoft Store. As for PowerShell 7, you can download the latest release from the Official GitHub Page and install it.
Install WSL for the First Time
Run Windows Terminal as an administrator and open a PowerShell 7 terminal. Enter the following command to install WSL.
|
|
Fill in the [Linux distribution name] you want to install. You can use the command wsl -l -o
to view all the online downloadable distributions currently provided by Microsoft.
Sometimes, installation may fail due to network issues. You can try setting it to download data from the website instead of downloading it from the Microsoft Store.
|
|
The first time you install WSL, you need to restart your computer. After restarting, the system will automatically start the Linux installation process, which may take a few minute, please wait for it to complete. Once everything is ready, follow the prompts in the window to set the username and password for Linux.
Update to WSL2
By default, Linux is installed on WSL2. You can use the command wsl -l -v
to view the installed Linux distributions and their respective WSL versions.
If you already have a Linux distribution running on WSL1, you can upgrade it to run on WSL2.
|
|
You can set the default WSL version for future installations using the following command.
|
|
WSL GUI Setup
Windows 11
If your system version is newer than Windows 11 (build 22000.*) or Windows 11 Insider Preview (builds 21362+), WSLg will be automatically installed when you install WSL, which provides GUI support. It is recommended to update the software packages before proceeding with further operations.
|
|
By default, WSL does not come with a desktop environment or any GUI tools installed. To use GUI tools, you need to install them separately. You need to install the xdg-utils
package, it necessary for OMNeT++ compilation. Other GUI tools like file managers and text editors can be installed based on your requirements.
|
|
After completing the steps mentioned above, you can refer to Installation of OMNeT++ on Linux to proceed with the installation. The final result of the installation should resemble the following.
Windows 10
Windows 10 currently does not support WSLg, so you will need to install VcXsrv on Windows to provide an X-Window Server for WSL (or any other software that provides an X-Window Server, such as X410). You can download and install the latest version of VcXsrv from SourceForge. Additionally, you need to configure the DISPLAY
environment variable on your Linux. You can use any one of the following commands to set the environment variable. To avoid setting the environment variable every time you open a new Linux terminal, you can add command to your .bashrc
file (or the appropriate file based on your shell).
|
|
Before proceeding with further operations, it is recommended to update all packages on your Linux.
|
|
By default, WSL does not come with a desktop environment or any GUI tools installed. To use GUI tools, you need to install them separately. You need to install the xdg-utils
package, it necessary for OMNeT++ compilation. Other GUI tools like file managers and text editors can be installed based on your requirements.
|
|
Before running GUI programs in WSL, you need to start VcXsrv in Windows to provide an X-Window Server for WSL. Start VcXsrv and configure it with the following settings:
- Keep default settings on “Select display settings” and “Select how to start client” pages.
- In the “Extra settings” section, check “Disable access control”.
Installation of OMNeT++ on Linux
配置完成后启动 VcXsrv,注意每次运行GUI程序之前需要先在 Windows 上启动 VcXsrv。之后参照 Linux 下的 OMNeT++ 的安装 进行安装即可,最终安装完成后的效果如下:
Remember to start VcXsrv on Windows each time before running a GUI program. Then, you can proceed with Installation of OMNeT++ on Linux. The final result of the installation should resemble the following:
macOS
-
To use OMNeT++ on macOS, your macOS version should be 11.x or higher.
-
As of the date of document editing, OMNeT++ does not have native support for Apple Silicon. Therefore, when using OMNeT++ on devices with Apple Silicon, you may encounter some bugs or compatibility issues.
Compile Enviroment Setup
Open the Terminal and enter the following command,to install the Xcode Command Line Tools
|
|
In order to run unsigned code in the Terminal, some system setting is required.
- Open “System Preferences” on your macOS.
- Go to “Privacy & Security” and click on the “Privacy” tab.
- In the left sidebar, scroll down and find “Developer Tools”, check the “Terminal”.
To enable proper code debugging, it is necessary to disable global code signing enforcement
|
|
Open “System Preferences” -> “Security & Privacy”, check the “Anywhere” option in the “General” section.
This setting will somewhat decrease the security of the computer. When you no longer need this feature, you can restore the signature check by running the following command in the terminal.
|
|
Compile
Switch the working directory of the terminal to the directory where OMNeT++ is extracted. Since the macOS installation package includes all the necessary dependencies, there is no need to install any additional packages. Simply run the following command to configure and compile.
|
|
You can set the -j
parameter of make
, which specifies the number of parallel compilation tasks allowed to run simultaneously. This allows for more efficient utilization of CPU resources and speeds up the compilation process. For example, you can use make -j8
to allow a maximum of 8 compilation tasks to run simultaneously. You can also set it to the number of CPU cores or supported threads. Using make -j$(sysctl -n hw.ncpu)
to compile with a task number equals to the number of CPU cores. After completion, you can launch the IDE by entering omnetpp
in the terminal.
You can add the following command to the .zshrc
file (or the appropriate file depending on the shell you are using) to avoid source the environment variables every time you open the terminal.
|
|
Linux
OMNeT++ is installed from source code, and all its dependencies are open-source software. In theory, you can always find a way to install OMNeT++ on almost all Linux distributions. However, in practice, the OMNeT++ IDE requires GLIBC >= 2.28, which means that Linux distributions with GLIBC versions lower than 2.28 cannot directly compile OMNeT++ (e.g., Ubuntu 18.04, RHEL7, etc.).
Install Dependencies
Installing OMNeT++ on Linux requires manually configuring the installation environment and installing the necessary packages for OMNeT++. Below are commands for three categories of Linux distributions to install the required packages. For Arch-based Linux distributions, you can directly install OMNeT++ using this Package.
Linux | Command |
---|---|
Debian-Based | sudo apt install build-essential clang lld gdb bison flex perl python3 python3-pip qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools libqt5opengl5-dev libxml2-dev zlib1g-dev doxygen graphviz libwebkit2gtk-4.0-37 |
RedHat-Based | sudo dnf install make gcc gcc-c++ clang lld bison flex perl python3-devel python3-pip qt5-devel libxml2-devel zlib-devel doxygen graphviz |
SUSE | sudo zypper in make gcc gcc-c++ clang lld bison flex perl python3-devel python3-pip libqt5-qtbase-devel libxml2-devel zlib-devel doxygen graphviz |
Not all repositories of Linux distributions necessarily include all of the mentioned packages. If you encounter a situation where a package is not available, you can consider installing a similar package from the repository of the same category of Linux distribution or manually compiling from source code.
Linux distributions without a desktop environment may require the additional installation of
xdg-utils
in order to compile OMNeT++ properly.
OMNeT++ requires some python packages, you can use the following command to install them.
|
|
OMNeT++ offers several optional features that are not mandatory. You can choose to install these features based on your specific needs.
-
OpenSceneGraph (>=3.2) provides 3D model rendering functionality for OMNeT++, allowing you to create 3D simulation scenes. Although it is an optional feature, it is recommended to install it as the
configure.user
configuration file enables this feature by default.1 2 3 4 5 6 7 8
# Debian-Based Debian/Ubuntu/Kali-Linux/Deepin sudo apt install libopenscenegraph-dev # RedHat-Based RHEL/CentOS/OracleLinux/Fedora/AlmaLinux/RockyLinux sudo dnf install OpenSceneGraph-devel # SUSE openSUSE/SLES sudo zypper install libOpenSceneGraph-devel
-
osgEarth (>=2.7) is a terrain rendering engine developed based on OpenSceneGraph, and it extends the functionality of OpenSceneGraph. However, not all Linux distribution repositories include osgEarth, and often it needs to be compiled and installed from source code.
1 2 3 4 5 6 7
# Debian-Based Debian 10/Ubuntu 20.04/Deepin sudo apt install openscenegraph-plugin-osgearth libosgearth-dev # RedHat-Based only Fedora sudo dnf install osgearth-devel # SUSE not support
-
MPI is used in OMNeT++ to enable parallel and distributed simulations.
1 2 3 4 5 6 7 8
# Debian-Based Debian/Ubuntu/Kali-Linux/Deepin sudo apt-get install mpi-default-dev # RedHat-Based RHEL/CentOS/OracleLinux/Fedora/AlmaLinux/RockyLinux sudo dnf install openmpi-devel # SUSE openSUSE/SLES sudo zypper install openmpi-devel
-
Akaroa (>=2.7.9) is a tool that can enhance the feasibility of simulations by accelerating them through MRIP (Multiple Replications in Parallel) technology. Akaroa can only be installed by compiling the source code, and currently, you need to apply for or purchase the corresponding license from the official website.
It only ensures that OMNeT++ can be compiled successfully. However, it does not guarantee the successful execution of the OMNeT++ IDE. For example, you may need to install gtk3
in order to properly render the graphical interface of the OMNeT++ IDE.
If you are using a Linux distribution with a desktop environment, you generally don’t need to worry about missing dependencies. However, if your Linux distribution does not have the necessary components, you may need to identify the missing dependencies based on the error messages and manually install them to fulfill the requirements.
Compile
Switch the working directory of the terminal to the directory of OMNeT++, use the following command to compile OMNeT++
|
|
You can set the -j
parameter of make
, which determines the number of parallel compilation tasks allowed to execute simultaneously. This allows for more efficient utilization of CPU resources and faster compilation. For example, you can use make -j8
to allow a maximum of 8 compilation tasks to run simultaneously. You can set it to the number of CPU cores or supported threads, or use make -j$(nproc)
to compile with the maximum number of processes allowed.
After the compilation, you can launch the OMNeT++ IDE by entering omnetpp
in the terminal.
You can add the following command to the .bashrc
file (or the appropriate file depending on the shell you are using) to avoid source the environment variables every time you open the terminal.
|
|
OMNeT++ 6.0 will automatically add the .desktop
files for the OMNeT++ IDE and Shell to the ~/.local/share/applications
folder after installation, allowing you to directly launch OMNeT++ by clicking on the shortcuts in the Launcher.
Verify Installation
Switch to the working directory to “omnetpp-6.0/samples/aloha”, run “./aloha”. After running it, the Qt simulation environment will start. In the “Set Up Inifile Configuration” window, you can choose any configuration and click on “Run Simulation” to execute the simulation. If it runs without any abnormal output, it indicates that the environment configuration is generally correct.