Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: cannot open display: localhost:0.0 - trying to open Firefox from CentOS 6.2 64bit and display on Win7

I am on a Windows7 machine and I'm trying to get firefox to open on the centOS machine, but be displayed on my current screen. When typing firefox in terminal, I am getting the following error:

Error: cannot open display: localhost:0.0

To setup the display I used the command

$ export DISPLAY=localhost:0.0

Some site suggested using the following, but it didn't work either:

$ export DISPLAY=:0.0

I am using PuTTY and I have the Enable X11 forwarding check box checked and XMing is running on Windows. Additionally, the sshd_config on centOS file seems to be setup properly as well:

$ cat /etc/ssh/sshd_config |grep -i x11
#X11Forwarding no
X11Forwarding yes
#X11DisplayOffset 10
X11UseLocalhost yes

I've looked over numerous pages and searched StackOverflow as well, but none have managed to help me in any way. Thank you in advance.

like image 779
SaiyanGirl Avatar asked Sep 10 '12 17:09

SaiyanGirl


2 Answers

So, it turns out that X11 wasn't actually installed on the centOS. There didn't seem to be any indication anywhere of it not being installed. I did the following command and now firefox opens:

yum groupinstall 'X Window System' 

Hope this answer will help others that are confused :)

like image 101
SaiyanGirl Avatar answered Oct 13 '22 00:10

SaiyanGirl


I faced this issue once and was able to resolve it by fixing of my /etc/hosts. It just was unable to resolve localhost name... Details are here: http://itvictories.com/node/6

In fact, there is 99% that error related to /etc/hosts file

X server just unable to resolve localhost and all consequent actions just fails.

Please be sure that you have a record like

127.0.0.1 localhost

in your /etc/hosts file.

like image 31
Aleks Avatar answered Oct 13 '22 00:10

Aleks