NAM is a separate application, nam 1.14 and 1.15 will work with even the oldest versions of ns2.
nam 1.14 is a "one file application", i.e. /usr/local/bin/nam
nam 1.15 is more complicated, was designed to also work with a Mac computer :
Depends on the tcl / tk it was built with ..... in the right location.
(That's why "Ubuntu nam" fails: tcl/tk get updates. nam: No updates because of lowest possible ns2 / nam priority)
How to install 'nam'
1) tar xvf ns-allinone-2.35_gcc5.tar.gz
Or 2) Use a package ........ example :
cd Downloads/
sudo apt install ./nam_1.14_amd64.deb