sto tentando di installare apache-tomcat. Ho provveduto ad installare JRE

quando tento di lanciare startup.sh mi ritorna questo tipo di errore:

The BASEDIR enviroment variable is not defined correctly
this enviroment variable is needed to run this program.

come posso fare a settare la variabile??