I'm not going to go into detail about how to migrate; there are many sites like this one that explain the process. The two programs I used were YPops 0.8.6.2 and gexodus 0.2. To find a version of YPops for Linux I went to YPops sourceforge page.
YPops for Linux doesn't have much documentation, I had to figure out how to run it by trial and error. Here are some of the little caveats…
In ypops.ini, to specify which mail folders you want to download you need to edit the line Folders=. For example if you want to download the mail in Sent and MyMail, set 'Folders=Sent, MyMail'. Setting 'EmailCategory=97' means all mail in the inbox and specified folders will be downloaded. Setting EmailCategory to 117 means only the unread messages will be downloaded. I also set 'MaxEmails=400'. This basically means that it would download all my email at once, since I had less than 400.
I used Thunderbird as my pop3 client. I had problems downloading email with large attachments until I changes the value for connection timeout. To do this go to Tools->Options->Advanced->General. Then set Connection Timeout to 999
Gexodus is very straightforward. But, after getting many errors trying to upload mail to my gmail account, I noticed that the emails that were causing the problem did not have subject lines. Gexodus apparently won't mail messages without a subject line. I solved that by editing the mbox file and adding an appropriate subject line to the offending emails.