# How to Install GNS3 on FreeBSD 12.1-p1



## Russell Rinaldi (Dec 23, 2019)

This how-to assumes that you are somewhat experienced in FreeBSD and have installed python 3.6. Linux_base-c7 is installed with linux_enable="YES" in rc.conf. *You should have a backup of your system* and be able to restore it to a working configuration if anything goes wrong. Because this method utilizes some source not available via pkg manager or ports, it may not be entirely supported by FreeBSD forums. This is running on FreeBSD  12.1-RELEASE-p1, MATE Desktop, nvidia-driver-390.87_3 on AMD 3900X.

1. *Prep:* Install all the packages needed  by gns3-gui, gns3-server and ubridge. Note: The py36-qt5-websockets port doesn't exists that I know of, so we will compile it from source in step 2.


py36-pip-19.1.1 :  Tool for installing and managing Python packages
py36-qt5-core-5.12.2  :  Python bindings for the Qt5 toolkit, QtCore module
py36-qt5-gui-5.12.2  :  Python bindings for the Qt5 toolkit, QtGui module
py36-qt5-network-5.12.2 :  Python bindings for the Qt5 toolkit, QtNetwork module
py36-qt5-opengl-5.12.2 :  Python bindings for the Qt5 toolkit, QtOpenGL module
py36-qt5-svg-5.12.2 :  Python bindings for the Qt5 toolkit, QtSvg module
py36-qt5-widgets-5.12.2 :  Python bindings for the Qt5 toolkit, QtWidgets module
py36-sip-4.19.17 : Python to C and C++ bindings generator
gmake : GNU version of 'make' utility
libpcap : Ubiquitous network traffic capture library

`pkg install py36-pip-19.1.1 py36-qt5-core py36-qt5-gui py36-qt5-network py36-qt5-widgets py36-qt5-svg` ...etc​
2. *Compile and install PyQt5.QtWebSockets*. Download the matched version of PyQt5 from https://www.riverbankcomputing.com/software/pyqt/download5 . Example: if pkg installed FreeBSD package qt5-core-5.12.2, download  PyQt5_gpl-5.12.2.tar.gz. I keep non-native sources in ~/src.

`user@localnet:~/src % tar xvf PyQt5_gpl-5.12.2.tar.gz`​`user@localnet:~/src % cd  PyQt5_gpl-5.12.2`​
Configure, passing the sip binary location.
`user@localnet: ~/src/PyQt5_gpl-5.12.2% python3.6 ./configure.py -e QtWebSockets --sip=/usr/local/bin/sip`​​Copy the sip header into the include directory:
`use@localnet:~/src/PyQt5_gpl-5.12.2 % cp /usr/local/include/python3.6/sip.h include/`
​We only want to install the QtWebSockets module since pkg already installed py36-qt5-core and the other modules we needed, cd into the QtWebSockets dir and run make.

`user@localnet:~/src/PyQt5_gpl-5.12.2 % cd QtWebSockets`​`user@localnet:~/src/PyQt5_gpl-5.12.2/QtWebSockets % make`​
Install as root
`root@localnet: ~/# src/PyQt5_gpl-5.12.2/QtWebSockets # make install`​​If all goes well, you should see the websockets module in /usr/local/lib/python3.6/site-packages/PyQt5 as QtWebSockets.so

3. *Compile and install ubridge*, which is needed to connect switch, router, etc. images.

Git ubridge from https://github.com/GNS3/ubridge and cd into the cloned directory:

`user@localnet: ~/src% git clone https://github.com/GNS3/ubridge`​`user@localnet: ~/src% cd ubridge`​
Gmake and gmake install as root:

`user@localnet:~/src/git/ubridge % gmake`​`user@localnet:~/src/git/ubridge % gmake install`​
4. *At last, we can install* gns3 using pip. I installed locally with the --user flag, as advised by the pip installation's warning.

`pip install --user  gns3-gui gns3-server`​​This will install gns3 binaries in ~/.local/bin​​Cheers!


----------



## luckied (Apr 24, 2020)

thanks for this! Replced py36 w/ 37 and websockets is now a pkg 
Just gotta get stupid Oracle vbox...


----------



## neoahmad (Dec 24, 2020)

Thanks for all help. I'm new for this system and I try to use it and install gns3. I was facing some issue and as your guide I try with some different installation full packages. 
I install Qt5 from pkg and then install py-Qt5 after that install  py-Qt5-websockets and continue with your guide.


----------



## kansukee (Jan 16, 2021)

Hi there, I tried following your guide but when I ran "python3.7 ./configure.py -e QtWebSockets --sip=/usr/local/bin/sip-module-3.7"
I got the following:
"
Querying qmake about your Qt installation...
Determining the details of your Qt installation...
This is the GPL version of PyQt 5.15.2 (licensed under the GNU General Public
License) for Python 3.7.9 on freebsd12.

Type 'L' to view the license.
Type 'yes' to accept the terms of the license.
Type 'no' to decline the terms of the license.

Do you accept the terms of the license? yes
Found the license file pyqt-gpl.sip.
Installing sip.h in /usr/home/danny/Downloads/PyQt5-5.15.2/include...
Checking to see if the dbus support module should be built...
Qt v5.15.2 is being used.
The qmake executable is /usr/local/bin/qmake.
Qt is built as a shared library.
SIP 5.5.0 is being used.
The sip executable is /usr/local/bin/sip-module-3.7.
These PyQt5 modules will be built: QtWebSockets.
The PyQt5 Python package will be installed in
/usr/local/lib/python3.7/site-packages.
PyQt5 is being built with generated docstrings.
The Designer plugin will be installed in /usr/local/lib/qt5/plugins/designer.
The qmlscene plugin will be installed in /usr/local/lib/qt5/plugins/PyQt5.
The QScintilla API file will be installed in
/usr/local/share/qt5/qsci/api/python.
The PyQt5 PEP 484 stub files will be installed in
/usr/local/lib/python3.7/site-packages/PyQt5.
The dbus support module will be installed in
/usr/local/lib/python3.7/site-packages/dbus/mainloop.
The PyQt5 .sip files will be installed in /usr/local/share/sip/PyQt5.
pyuic5, pyrcc5 and pylupdate5 will be installed in /usr/local/bin.
The interpreter used by pyuic5 is /usr/local/bin/python3.7.
Generating the C++ source for the QtWebSockets module...
Error: Unable to create the C++ code.

From a search I did, this seems to be an issue with the compiler (I have gcc 9_4 installed via pkg install). I am running FreeBSD 12.2 Release. How can I get around this error? I'm not a programmer so I have no idea of where to start.


----------

