The link shared by Arun is comprehensive and includes every aspect
For a fresh 6.4 install, you'd follow the same steps for standalone install. Check the Deploying AEM section @ Adobe Experience Manager Help | Deploying User Guide based on your requirements of standalone installation or app server installation and in case you want to set up a separate datastore. Once the server is set up, you could fix the source code and migrate it using package manager or vault tools or a similar tool.
Make sure to convert crx to oak using - java -Xmx4096m -jar aem-quickstart.jar -v -x crx2oak -xargs -- --load-profile <<YOUR_PROFILE>> <<ADDITIONAL_FLAGS>>
Follow the steps mentioned here -- Performing an In-Place Upgrade
Couple of links:
https://helpx.adobe.com/experience-manager/6-3/sites/deploying/using/pre-upgrade-maintenance-tasks.htmlPlanning Your Upgrade
Pre-Upgrade Maintenance Tasks
Adobe Experience Manager Help | Repository Restructuring in AEM 6.4 -- repository restructuring guidelines
Assessing the Upgrade Complexity with the Pattern Detector -- use this to understand the scope of changes/rework required