WordPress cannot update or install on localhost unless the user rights are correct.
edit the file /etc/apache2/envvars
locate lines:
export APACHE_RUN_USER = www-data
export APACHE_RUN_GROUP= www-data
Change this to:
export APACHE_RUN_USER = YourUserName
export APACHE_RUN_GROUP= YourUserName
Then FTP works.
NB: the user must be one with the right to read, write and execute within the apache folders.
Thanx to this WordPress support page.