For this you have to have ssh access configured and host setted up. Also you have to have credentials to the mysql database connection and database where will be intalles test tables.
Once you have all setted up and ready connect to your website using ssh and open your website root folder (usually its public_html or www).
Then launch one by one commands below.

 wget http://www.magentocommerce.com/downloads/assets/1.9.0.1/magento-1.9.0.1.tar.gz
 wget http://www.magentocommerce.com/downloads/assets/1.9.0.0/magento-sample-data-1.9.0.0.tar.gz
 tar -zxvf magento-1.9.0.1.tar.gz
 tar -zxvf magento-sample-data-1.9.0.0.tar.gz
 mv magento-sample-data-1.9.0.0/media/* magento/media/
 mv magento-sample-data-1.9.0.0/magento_sample_data_for_1.9.0.0.sql magento/magento_sample_data_for_1.9.0.0.sql
 mv magento/* magento/.htaccess .
 chmod -R o+w var var/.htaccess app/etc
 chmod -R o+w media
 chmod 755 mage
 mysql -h localhost -u <database_username> -p <database_name> < magento_sample_data_for_1.9.0.0.sql
 rm -rf magento_sample_data_for_1.9.0.0.sql magento-sample-data-1.9.0.0.tar.gz magento-sample-data-1.9.0.0.tar.gz magento-1.9.0.1.tar.gz magento-sample-data-1.9.0.0
 

 
 The first two lines will download archives and second two lines will unpack it.
 The 5th-7th lines will move all files into website folder.
 The lines 8th - 10th will set up magento default folder permissions.
 On the line 11th you need to replace <database_username> with your username for the mysql connection. If your server located at different host you also need to replace localhost with mysql database server address. The <database_name> should be replaced with your store database.