echo "export CATALINA_HOME=/usr/share/tomcat6" > /etc/profile.d/tomcat.sh
echo "export CATALINA_BASE=/usr/share/tomcat6" >> /etc/profile.d/tomcat.sh
echo "export CATALINA_OPTS=-server -Xms384M -Xmx512M" >> /etc/profile.d/environment
Replace "/usr/share/tomcat6" to the actual tomcat installation directory