.rpm stands for "redhat package manager" - developed by red hat (obviously) for easy install of packages. to install an rpm, you just type
rpm -ihv filename.rpm
a .gz file is usually a compressed source package. installing these is usually a bit more involved, but not terribly difficult. first, the file needs to be uncompressed, (also called untarred, don't ask why
tar -zxvf filename.tar.gz
sometimes, the package will include installation instructions, in which case, follow the instructions. however, usually there's a standard couple of lines to run :
usually, that does it.