当前位置:网站首页>Installing ns-3 on ubuntu18.04

Installing ns-3 on ubuntu18.04

2020-11-06 01:28:00 itread01

[toc] I've installed it several times myself NS3 了 , The quality of other related blogs on the Internet is not very good , So I summed up a ns3 The installation process of . First go to the website https://www.nsnam.org/releases/ Download what you want to install NS-3 The original code of . Then use the following command to decompress : `tar xjf ns-allinone-3.26.tar.bz2` ![](https://img2020.cnblogs.com/blog/1546042/202011/1546042-20201104214053980-1478198818.png) #### First step : Deal with gcc/g++ edition ns3 You need to use gcc and g++ Compile , however Ubuntu18.04 The system preset gcc/g++ The version is usually in 7.X many , and ns3 Does not support too high version of gcc/g++, If not gcc/g++ If you're demoted , In compiling and installing ns3 When it comes to failure . You can order it first `gcc -v` Take a look at the current gcc/g++ edition . If it is high, execute the following command to lower gcc and g++ edition : ```bash # Install lower version gcc and g++ sudo apt-get install gcc-5 sudo apt-get install g++-5 # Enter /usr/bin Catalog cd /usr/bin # Back up first sudo mv gcc gcc.backup sudo mv g++ g++.backup # And then we download 5. Several versions of gcc and g++ Linking the past sudo ln -sf gcc-5 gcc sudo ln -sf g++-5 g++ # See if the downgrade was successful gcc -v ``` ** Be careful :**`sudo apt-get install gcc-5` If this order is written specifically gcc Version does not execute successfully on my system , But vaguely write a `gcc-5` You can execute it successfully , The command will automatically download a gcc-5.5.g++ Empathy . #### The second step : Install related dependencies In the formal compilation installation ns3 Before , You have to install a lot of dependent software first , Execute the following command to install the dependencies : ```bash sudo apt-get update sudo apt-get install gcc g++ python sudo apt-get install gcc g++ python python-dev sudo apt-get install mercurial sudo apt-get install bzr sudo apt-get install gdb valgrind sudo apt-get install gsl-bin libgsl-dev libgsl2 sudo apt-get install flex bison libfl-dev sudo apt-get install g++ gcc sudo apt-get install tcpdump sudo apt-get install sqlite sqlite3 libsqlite3-dev sudo apt-get install libxml2 libxml2-dev sudo apt-get install libgtk2.0-0 libgtk2.0-dev sudo apt-get install vtun lxc sudo apt-get install uncrustify sudo apt-get install doxygen graphviz imagemagick sudo apt-get install python-sphinx dia sudo apt-get install python-pygraphviz python-kiwi python-pygoocanvas libgoocanvas-dev sudo apt-get install libboost-signals-dev libboost-filesystem-dev sudo apt-get install openmpi* sudo apt-get install texlive texlive-extra-utils texlive-latex-extra ``` These commands can be copied into a script file and executed at one time , To avoid too much trouble to implement one by one . #### The third step : Officially install 1、 First into the catalog ns-allinone-3.26, Then execute the following command : ```bash cd ns-allinone-3.26 sudo ./build.py ``` 2、 Then go to the directory ns-3.26, Carry out orders ``` cd ns-3.26 sudo ./waf clean ``` 3、 In the catalog ns-3.26 Next , Execute the following command to complete the compilation and installation ``` sudo ./waf -d debug --enable-example --enable-tests configure sudo ./waf ``` As shown in the figure below , This indicates that the compilation is successful ![](https://img2020.cnblogs.com/blog/1546042/202011/1546042-20201104214144903-418778732.png) #### Step four : Test stay ns-allinone-3.26/ns-3.26 Under the catalogue , Execute the following command , Test whether the installation is successful : ``` sudo ./waf --run hello-simulator ``` Output Hello Simulator Indicates that the installation is successful ![](https://img2020.cnblogs.com/blog/1546042/202011/1546042-20201104214157973-1153073670.png) So far ns3 Visual animation tools netanim Still can't use the State , It will be updated later netanim The installation process of . ** References :** https://www.jianshu.com/p/2c6c38ebe936 https://blog.csdn.net/wuzhiwuweisun/article/details/

版权声明
本文为[itread01]所创,转载请带上原文链接,感谢