I installed wordpress in my ubuntu machine but problem is when ever I want to install theme or plugin it require to put ftp credential for localhost. I search on google about this. Lot of article suggest lot of things in this regard. After reading all of this I have understood that this is problem with linux permission(ownership). You need to chown your apache account for that. Here is the command
sudo chown www-data:www-data -R <your wordpress publishing directory>