On a fresh install of Drupal 7 (I also encountered it in Drupal 8), you may find everything goes smoothly until you want to install a theme or module from the admin panel. If you’re running into the issue I had, when you submit the request you will be redirected to a page that requests your FTP details.
Now, you can of course just enter the FTP details and be on your merry Drupal way. Although after the third, fourth, fifth time it may start to test your patience. Best to get it resolved.
From the command line cd to the root of your Drupal install and enter:
sudo chown -R www-data sites/default
This will make the directory owned by Apache, and thus enable the upload of themes & modules from the admin panel.