You will need to install the following packages to build the gems on Linux
sudo apt-get install libxml2-dev libxslt-dev libmagickcore-dev libmagickwand-dev libmysqlclient-dev libsqlite3-dev imagemagick
If you have linecache19 errors, you must to install libssl-dev package and reinstall or recompile ruby-X.X, after you try bundle.
If you have zlib erros when try to install rails on rvm, you must to install zlib1g-dev package
If you have errors with readline, you must to install: libreadline-dev
sudo apt-get install libreadline-dev zlib1g-dev libssl-dev