Packages required for installation on both Redhat and Debian based servers.
sh# yum install libmad libid3tag which are available in rpm forge repository.
download and install mpg321 rpm which is available on the internet or you can download it from http://rpm.pbone.net
sh# rpm -Uvh mpg321-0.2.10.4-2.fc10.i386.rpm
next is to install vorbis-tools
sh# yum install vorbis-tools
sh# apt-get install mpg321 vorbis-tools
suppose you are have test.mp3 and need to convert it into test.ogg
run the mentioned command
sh # mpg321 test.mp3 -w - | oggenc -o test.ogg -
Note : Don't forget to put trailing "-"