m2: command not found

Have You tried accessing the binary with the full path?

Maybe Your $PATH variable doesn't contain the default paths? echo $PATH should give something like:

[root@server ~]# echo $PATH
/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin

If it's empty, You may set the PATH variable with this command

export PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin"

On CentOS possible default full paths are:

/usr/bin/M2 - from package: Macaulay2

You may install the required package with command yum install {package}

On Debian possible default full paths are:

/var/lib/wims/public_html/bin/m2 - from package: wims

You may install the required package with command apt-get install {package}
Error in other languages:
m2: bevel nie gevind nie
m2: comandă negăsită
m2: comando não encontrado
m2: commande introuvable
m2: command not found
m2: käsku ei ole
m2: không tìm thấy lệnh
m2: komanda nerasta
m2: Kommando nicht gefunden.
m2: kommandot finns inte
m2: komut yok
m2: nie znaleziono polecenia
m2: níor aimsíodh an t-ordú
m2: no se encontró la orden
m2: no s'ha trobat l'ordre
m2: opdracht niet gevonden
m2: parancs nem található
m2: perintah tidak ditemukan
m2: príkaz nenájdený
m2: příkaz nenalezen
m2: команда не найдена
m2: командата не е открита
m2: 命令找不到
m2: コマンドが見つかりません