It need a little serious works to complete all the task, but if you are familiar with Linux command line it should be okay. The howto is written by Mike Chirico and you can find the complete step by step tutorial here. The main purpose of the howto is to configure smtp server (postfix) and email client (fetchmail) that support gmail system requirement such as SASL authentication, TLS encryption, and STARTTLS. At the end of the howto you’ll be teached how to configure cron job for the email client (fetchmail) so it will automatically backup copies of your emails periodically. After completing all the steps now you can start to access your Gmail through command line.