Gtk-WARNING **: cannot open display: on Ubuntu Server

Did you install xserver or a display server like unity,cinnamon, or gnome?

gedit or any graphical programs need a display server to be able to run.