With the newest versions of Gnome Shell (for example, Gnome 3.8) you may have noticed that the old gconf-editor will no longer assist you with modifying your environment. This is because Gnome is now using the dconf system instead. It should be very much the same as gconf was.
First, install dconf-editor.
For Debian-based users you can
$ sudo apt-get install dconf-editor
Or for RPM users (like Fedora),
$ sudo yum install dconf-editor
Then, just run dconf-editor.
Navigate to org → gnome → shell → overrides → button_layout
Change the value to close:
You can also use spacer at some point to add a space, or add additional buttons with minimize and maximize.
That's it!