jpegoptim: 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/jpegoptim - from package: jpegoptim

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

On Debian possible default full paths are:

/usr/bin/jpegoptim - from package: jpegoptim

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