wget http://ftp.br.debian.org/debian/pool/main/p/pgtune/pgtune_0.9.3-2_all.deb \
&& sudo dpkg -i pgtune_0.9.3-2_all.deb \
&& rm pgtune_0.9.3-2_all.deb
cd /etc/postgresql/9.4/main
sudo pgtune -i postgresql.conf -o postgresql.conf.pgtune
git diff postgresql.conf postgresql.conf.pgtune
when happy with it
sudo mv postgresql.conf postgresql.conf.bak \
&& sudo mv postgresql.conf.pgtune postgresql.conf \
&& sudo service postgresql restart