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: コマンドが見つかりません