You first need to set an environmental variable to LEGATO_ROOT. (Set LEGATO_ROOT to the directory where you installed legato-xx.yy.z).
For setting up environmental variable,
open .profile in your editor. Bash command: ‘<EDITOR> ~/.profile’, where EDITOR can be any editor such as gedit or vim.
Add, export LEGATO_ROOT=<path to the directory where you have installed legato>
Save and exit.
To check if LEGATO_ROOT is set or not, use printenv LEGATO_ROOT command on bash.